Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
int main()
{
int i, n;
long int a, min = 1000000, max = -1000000, sum = 0;
scanf("%d", &n);
for (i = 1; i <= n; i++)
{
scanf("%ld", &a);
if (a < min)
min = a;
if (a > max)
max = a;
sum += a;
}
printf("%ld %ld %ld\n", min, max, sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173488/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173488/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 i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, 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
%cmp.not12 = icmp slt i32 %0, 1
br i1 %cmp.not12, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%sum.016 = phi i64 [ %add, %for.body ], [ 0, %entry ]
%max.015 = phi i64 [ %max.1, %for.body ], [ -1000000, %entry ]
%min.014 = phi i64 [ %spec.select, %for.body ], [ 1000000, %entry ]
%i.013 = phi i32 [ %inc, %for.body ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%1 = load i64, ptr %a, align 8, !tbaa !9
%spec.select = call i64 @llvm.smin.i64(i64 %1, i64 %min.014)
%max.1 = call i64 @llvm.smax.i64(i64 %1, i64 %max.015)
%add = add nsw i64 %1, %sum.016
%inc = add nuw nsw i32 %i.013, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.013, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%min.0.lcssa = phi i64 [ 1000000, %entry ], [ %spec.select, %for.body ]
%max.0.lcssa = phi i64 [ -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.2, i64 noundef %min.0.lcssa, i64 noundef %max.0.lcssa, i64 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, 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.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 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void) {
int n ,ai ,i ,max ,min;
long int sum = 0;
scanf("%d" ,&n);
for(i=0;i<n;i++){
scanf("%d" ,&ai);
sum += ai;
if(i==0){
max = ai;
min = ai;
}
else if(ai>max){
max = ai;
}
else if(ai<min){
min = ai;
}
}
printf("%d %d %ld\n" ,min ,max ,sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173530/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173530/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:
%n = alloca i32, align 4
%ai = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ai) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp19)
%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 %if.else, label %for.end
if.else: ; preds = %for.inc.peel, %if.else
%sum.023 = phi i64 [ %add, %if.else ], [ %conv.peel, %for.inc.peel ]
%min.022 = phi i32 [ %min.1, %if.else ], [ %1, %for.inc.peel ]
%max.021 = phi i32 [ %max.1, %if.else ], [ %1, %for.inc.peel ]
%i.020 = phi i32 [ %inc, %if.else ], [ 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
%conv = sext i32 %3 to i64
%add = add nsw i64 %sum.023, %conv
%cmp4 = icmp sgt i32 %3, %max.021
%spec.select = call i32 @llvm.smin.i32(i32 %3, i32 %min.022)
%max.1 = call i32 @llvm.smax.i32(i32 %3, i32 %max.021)
%min.1 = select i1 %cmp4, i32 %min.022, i32 %spec.select
%inc = add nuw nsw i32 %i.020, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %if.else, label %for.end, !llvm.loop !9
for.end: ; preds = %if.else, %for.inc.peel
%max.1.lcssa = phi i32 [ %1, %for.inc.peel ], [ %max.1, %if.else ]
%min.1.lcssa = phi i32 [ %1, %for.inc.peel ], [ %min.1, %if.else ]
%add.lcssa = phi i64 [ %conv.peel, %for.inc.peel ], [ %add, %if.else ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.1.lcssa, i32 noundef %max.1.lcssa, i64 noundef %add.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ai) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #4
; 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 = { 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 b;
int z;
int min;
int max;
long int sum;
min = 1000000;
max = -1000000;
sum = 0;
scanf("%d",&a);
for(b=0; b<a; b++) {
scanf("%d",&z);
if(min > z) {
min = z; }
if(max < z) {
max =z; }
sum = sum + z; }
printf("%d %d %ld\n",min,max,sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173581/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173581/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
%z = 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 %z) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, 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 ]
%b.013 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %z)
%1 = load i32, ptr %z, 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 %b.013, 1
%2 = load i32, ptr %a, 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 %z) #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 a;
int b;
int z;
int min;
int max;
long int sum;
min = 1000000;
max = -1000000;
sum = 0;
scanf("%d",&a);
for(b=0; b<a; b++) {
scanf("%d",&z);
if(min > z) {
min = z;
}
if(max < z) {
max =z;
}
sum = sum + z;
}
printf("%d %d %ld\n",min,max,sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173624/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173624/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
%z = 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 %z) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, 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 ]
%b.013 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %z)
%1 = load i32, ptr %z, 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 %b.013, 1
%2 = load i32, ptr %a, 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 %z) #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 num,i,min,max=0,n;
long sum=0;
scanf("%d",&num);
scanf("%d",&n);
min=max=sum=n;
for(i=0;i<num-1;i++){
scanf("%d",&n);
sum+=n;
if(min > n)
min=n;
if(max < n)
max=n;
}
printf("%d %d %ld\n",min,max,sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173668/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173668/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
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #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 %num)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%1 = load i32, ptr %num, 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 [ %add, %for.body ], [ %conv, %entry ]
%max.022 = phi i32 [ %max.1, %for.body ], [ %0, %entry ]
%min.021 = phi i32 [ %spec.select, %for.body ], [ %0, %entry ]
%i.020 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%2 = load i32, ptr %n, align 4, !tbaa !5
%conv5 = sext i32 %2 to i64
%add = add nsw i64 %sum.023, %conv5
%spec.select = call i32 @llvm.smin.i32(i32 %min.021, i32 %2)
%max.1 = call i32 @llvm.smax.i32(i32 %max.022, i32 %2)
%inc = add nuw nsw i32 %i.020, 1
%3 = load i32, ptr %num, align 4, !tbaa !5
%sub = add nsw i32 %3, -1
%cmp = icmp slt i32 %inc, %sub
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 ]
%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 %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #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,i,max,min,a[10000];
long sum;
sum=0;
max=-1000000;
min=1000000;
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_173710/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173710/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 n,a[10000],m,M,i=0;
long s=0;
scanf("%d",&n);
while(i<n){
scanf("%d",&a[i]);
i++;
}
i=0;
m=a[0];
M=a[0];
while(i<n){
if(m>a[i]) m=a[i];
if(M<a[i]) M=a[i];
s=s+a[i];
i++;
}
printf("%d %d %ld\n",m,M,s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173761/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173761/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) #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
%cmp37 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp37)
br label %while.body
while.body: ; preds = %entry, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.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)
%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 %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body
%.pre = load i32, ptr %a, align 16, !tbaa !5
%cmp539 = icmp sgt i32 %1, 0
br i1 %cmp539, label %while.body6.preheader, label %while.end22
while.body6.preheader: ; preds = %while.end
%wide.trip.count = zext i32 %1 to i64
%min.iters.check = icmp ult i32 %1, 4
br i1 %min.iters.check, label %while.body6.preheader65, label %vector.ph
vector.ph: ; preds = %while.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.splatinsert59 = insertelement <2 x i32> poison, i32 %.pre, i64 0
%minmax.ident.splat60 = shufflevector <2 x i32> %minmax.ident.splatinsert59, <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.phi54 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%vec.phi55 = phi <2 x i32> [ %minmax.ident.splat, %vector.ph ], [ %7, %vector.body ]
%vec.phi56 = phi <2 x i32> [ %minmax.ident.splat, %vector.ph ], [ %8, %vector.body ]
%vec.phi57 = phi <2 x i32> [ %minmax.ident.splat60, %vector.ph ], [ %5, %vector.body ]
%vec.phi58 = phi <2 x i32> [ %minmax.ident.splat60, %vector.ph ], [ %6, %vector.body ]
%3 = getelementptr inbounds [10000 x i32], ptr %a, 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.load61 = load <2 x i32>, ptr %4, align 8, !tbaa !5
%5 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %vec.phi57, <2 x i32> %wide.load)
%6 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %vec.phi58, <2 x i32> %wide.load61)
%7 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %vec.phi55, <2 x i32> %wide.load)
%8 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %vec.phi56, <2 x i32> %wide.load61)
%9 = sext <2 x i32> %wide.load to <2 x i64>
%10 = sext <2 x i32> %wide.load61 to <2 x i64>
%11 = add <2 x i64> %vec.phi, %9
%12 = add <2 x i64> %vec.phi54, %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.minmax63 = 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.minmax63)
%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 %while.end22, label %while.body6.preheader65
while.body6.preheader65: ; preds = %while.body6.preheader, %middle.block
%indvars.iv49.ph = phi i64 [ 0, %while.body6.preheader ], [ %n.vec, %middle.block ]
%s.043.ph = phi i64 [ 0, %while.body6.preheader ], [ %16, %middle.block ]
%M.041.ph = phi i32 [ %.pre, %while.body6.preheader ], [ %15, %middle.block ]
%m.040.ph = phi i32 [ %.pre, %while.body6.preheader ], [ %14, %middle.block ]
br label %while.body6
while.body6: ; preds = %while.body6.preheader65, %while.body6
%indvars.iv49 = phi i64 [ %indvars.iv.next50, %while.body6 ], [ %indvars.iv49.ph, %while.body6.preheader65 ]
%s.043 = phi i64 [ %add, %while.body6 ], [ %s.043.ph, %while.body6.preheader65 ]
%M.041 = phi i32 [ %M.1, %while.body6 ], [ %M.041.ph, %while.body6.preheader65 ]
%m.040 = phi i32 [ %spec.select, %while.body6 ], [ %m.040.ph, %while.body6.preheader65 ]
%arrayidx8 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv49
%17 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%spec.select = call i32 @llvm.smin.i32(i32 %m.040, i32 %17)
%M.1 = call i32 @llvm.smax.i32(i32 %M.041, i32 %17)
%conv = sext i32 %17 to i64
%add = add nsw i64 %s.043, %conv
%indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
%exitcond.not = icmp eq i64 %indvars.iv.next50, %wide.trip.count
br i1 %exitcond.not, label %while.end22, label %while.body6, !llvm.loop !14
while.end22: ; preds = %while.body6, %middle.block, %while.end
%m.0.lcssa = phi i32 [ %.pre, %while.end ], [ %14, %middle.block ], [ %spec.select, %while.body6 ]
%M.0.lcssa = phi i32 [ %.pre, %while.end ], [ %15, %middle.block ], [ %M.1, %while.body6 ]
%s.0.lcssa = phi i64 [ 0, %while.end ], [ %16, %middle.block ], [ %add, %while.body6 ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %m.0.lcssa, i32 noundef %M.0.lcssa, i64 noundef %s.0.lcssa)
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 <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 n, i, max, min,a[10001];
long long int sum;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
max = min = a[0];
sum = a[0];
for (i = 1; i < n; i++)
{
if (max < a[i])
max = a[i];
if (min > a[i])
min = a[i];
sum += (long long int)a[i];
}
printf("%d %d %lld\n", min, max, sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173804/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173804/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 [10001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 40004, 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
%cmp42 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp42)
br label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%.pre = load i32, ptr %a, align 16, !tbaa !5
%conv = sext i32 %.pre to i64
%cmp544 = icmp sgt i32 %1, 1
br i1 %cmp544, label %for.body7.preheader, label %for.end27
for.body7.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %1 to i64
%3 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %1, 5
br i1 %min.iters.check, label %for.body7.preheader71, label %vector.ph
vector.ph: ; preds = %for.body7.preheader
%n.vec = and i64 %3, -4
%ind.end = or i64 %n.vec, 1
%4 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %conv, i64 0
%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.splatinsert65 = insertelement <2 x i32> poison, i32 %.pre, i64 0
%minmax.ident.splat66 = shufflevector <2 x i32> %minmax.ident.splatinsert65, <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> [ %4, %vector.ph ], [ %13, %vector.body ]
%vec.phi60 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%vec.phi61 = phi <2 x i32> [ %minmax.ident.splat, %vector.ph ], [ %9, %vector.body ]
%vec.phi62 = phi <2 x i32> [ %minmax.ident.splat, %vector.ph ], [ %10, %vector.body ]
%vec.phi63 = phi <2 x i32> [ %minmax.ident.splat66, %vector.ph ], [ %7, %vector.body ]
%vec.phi64 = phi <2 x i32> [ %minmax.ident.splat66, %vector.ph ], [ %8, %vector.body ]
%offset.idx = or i64 %index, 1
%5 = getelementptr inbounds [10001 x i32], ptr %a, i64 0, i64 %offset.idx
%wide.load = load <2 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 2
%wide.load67 = load <2 x i32>, ptr %6, align 4, !tbaa !5
%7 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %vec.phi63, <2 x i32> %wide.load)
%8 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %vec.phi64, <2 x i32> %wide.load67)
%9 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %vec.phi61, <2 x i32> %wide.load)
%10 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %vec.phi62, <2 x i32> %wide.load67)
%11 = sext <2 x i32> %wide.load to <2 x i64>
%12 = sext <2 x i32> %wide.load67 to <2 x i64>
%13 = add <2 x i64> %vec.phi, %11
%14 = add <2 x i64> %vec.phi60, %12
%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
%rdx.minmax69 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %7, <2 x i32> %8)
%16 = call i32 @llvm.vector.reduce.smax.v2i32(<2 x i32> %rdx.minmax69)
%rdx.minmax = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %9, <2 x i32> %10)
%17 = call i32 @llvm.vector.reduce.smin.v2i32(<2 x i32> %rdx.minmax)
%bin.rdx = add <2 x i64> %14, %13
%18 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %3, %n.vec
br i1 %cmp.n, label %for.end27, label %for.body7.preheader71
for.body7.preheader71: ; preds = %for.body7.preheader, %middle.block
%indvars.iv54.ph = phi i64 [ 1, %for.body7.preheader ], [ %ind.end, %middle.block ]
%sum.048.ph = phi i64 [ %conv, %for.body7.preheader ], [ %18, %middle.block ]
%min.047.ph = phi i32 [ %.pre, %for.body7.preheader ], [ %17, %middle.block ]
%max.046.ph = phi i32 [ %.pre, %for.body7.preheader ], [ %16, %middle.block ]
br label %for.body7
for.body7: ; preds = %for.body7.preheader71, %for.body7
%indvars.iv54 = phi i64 [ %indvars.iv.next55, %for.body7 ], [ %indvars.iv54.ph, %for.body7.preheader71 ]
%sum.048 = phi i64 [ %add, %for.body7 ], [ %sum.048.ph, %for.body7.preheader71 ]
%min.047 = phi i32 [ %min.1, %for.body7 ], [ %min.047.ph, %for.body7.preheader71 ]
%max.046 = phi i32 [ %spec.select, %for.body7 ], [ %max.046.ph, %for.body7.preheader71 ]
%arrayidx9 = getelementptr inbounds [10001 x i32], ptr %a, i64 0, i64 %indvars.iv54
%19 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %max.046, i32 %19)
%min.1 = call i32 @llvm.smin.i32(i32 %min.047, i32 %19)
%conv24 = sext i32 %19 to i64
%add = add nsw i64 %sum.048, %conv24
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count
br i1 %exitcond.not, label %for.end27, label %for.body7, !llvm.loop !14
for.end27: ; preds = %for.body7, %middle.block, %for.end
%max.0.lcssa = phi i32 [ %.pre, %for.end ], [ %16, %middle.block ], [ %spec.select, %for.body7 ]
%min.0.lcssa = phi i32 [ %.pre, %for.end ], [ %17, %middle.block ], [ %min.1, %for.body7 ]
%sum.0.lcssa = phi i64 [ %conv, %for.end ], [ %18, %middle.block ], [ %add, %for.body7 ]
%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 40004, 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.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 <2 x i32> @llvm.smax.v2i32(<2 x i32>, <2 x i32>) #3
; 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 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.smin.v2i32(<2 x i32>) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.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 a=0,b=0,t=0,i=0,N=0;
long long c = 0;
for(scanf("%d",&N);N--;i++){
scanf("%d",&t);
if(!i||a>=t)a=t;
if(!i||b<=t)b=t;
c+=t;
}
printf("%d %d %lld\n",a,b,c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173862/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173862/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:
%t = alloca i32, align 4
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
store i32 0, ptr %t, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
store i32 0, ptr %N, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%dec16 = add nsw i32 %0, -1
store i32 %dec16, ptr %N, align 4, !tbaa !5
%tobool.not17 = icmp eq i32 %0, 0
br i1 %tobool.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 %t)
%1 = load i32, ptr %t, align 4
%conv.peel = sext i32 %1 to i64
%2 = load i32, ptr %N, align 4, !tbaa !5
%dec.peel = add nsw i32 %2, -1
store i32 %dec.peel, ptr %N, align 4, !tbaa !5
%tobool.not.peel = icmp eq i32 %2, 0
br i1 %tobool.not.peel, label %for.end, label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%c.021 = phi i64 [ %add, %for.body ], [ %conv.peel, %for.body.preheader ]
%b.019 = phi i32 [ %b.1, %for.body ], [ %1, %for.body.preheader ]
%a.018 = phi i32 [ %a.1, %for.body ], [ %1, %for.body.preheader ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%3 = load i32, ptr %t, align 4
%a.1 = call i32 @llvm.smin.i32(i32 %a.018, i32 %3)
%b.1 = call i32 @llvm.smax.i32(i32 %b.019, i32 %3)
%conv = sext i32 %3 to i64
%add = add nsw i64 %c.021, %conv
%4 = load i32, ptr %N, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %N, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %for.body.preheader, %entry
%a.0.lcssa = phi i32 [ 0, %entry ], [ %1, %for.body.preheader ], [ %a.1, %for.body ]
%b.0.lcssa = phi i32 [ 0, %entry ], [ %1, %for.body.preheader ], [ %b.1, %for.body ]
%c.0.lcssa = phi i64 [ 0, %entry ], [ %conv.peel, %for.body.preheader ], [ %add, %for.body ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.0.lcssa, i32 noundef %b.0.lcssa, i64 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 i,n, data[10000],min,max;
long long int sum = 0;
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%d", &data[i]);
}
min = data[0];
max = data[0];
for (i = 0; i < n; i++){
if (min>data[i]){
min = data[i];
}if (max < data[i]){
max = data[i];
}
sum +=data[i];
}
printf("%d %d %lld\n", min, max, sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173905/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173905/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
%data = 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 %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
%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 %data, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %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
%.pre = load i32, ptr %data, 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 %data, 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.043.ph = phi i32 [ %.pre, %for.body6.preheader ], [ %15, %middle.block ]
%min.042.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.043 = phi i32 [ %max.1, %for.body6 ], [ %max.043.ph, %for.body6.preheader66 ]
%min.042 = phi i32 [ %spec.select, %for.body6 ], [ %min.042.ph, %for.body6.preheader66 ]
%arrayidx8 = getelementptr inbounds [10000 x i32], ptr %data, i64 0, i64 %indvars.iv50
%17 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%spec.select = call i32 @llvm.smin.i32(i32 %min.042, i32 %17)
%max.1 = call i32 @llvm.smax.i32(i32 %max.043, 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 %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}
!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>
#include <stdlib.h>
int main(int argc, char *argv[]){
int i;
int dim;
int *data;
int min,max;
long long int sum;
//get data
scanf("%d", &dim);
data=(int *)malloc(sizeof(int)*dim);
for(i=0; i<dim; i++){
scanf("%d", &data[i]);
}
//init
sum=0;
min=data[0];
max=data[0];
//calc
for(i=0; i<dim; i++){
sum+=data[i];
if(min>data[i]){
min=data[i];
}
if(max<data[i]){
max=data[i];
}
}
printf("%d %d %lld\n", min, max, sum);
free(data);
return(0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_173949/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173949/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: nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%dim = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %dim) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %dim)
%0 = load i32, ptr %dim, align 4, !tbaa !5
%conv = zext i32 %0 to i64
%mul = shl nuw nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #8
%cmp52 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp52)
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 %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %dim, 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 %call1, align 4, !tbaa !5
%cmp754 = icmp sgt i32 %1, 0
br i1 %cmp754, label %for.body9.preheader, label %for.end29
for.body9.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.body9.preheader80, label %vector.ph
vector.ph: ; preds = %for.body9.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.splatinsert74 = insertelement <2 x i32> poison, i32 %.pre, i64 0
%minmax.ident.splat75 = shufflevector <2 x i32> %minmax.ident.splatinsert74, <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 ], [ %7, %vector.body ]
%vec.phi69 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%vec.phi70 = phi <2 x i32> [ %minmax.ident.splat, %vector.ph ], [ %11, %vector.body ]
%vec.phi71 = phi <2 x i32> [ %minmax.ident.splat, %vector.ph ], [ %12, %vector.body ]
%vec.phi72 = phi <2 x i32> [ %minmax.ident.splat75, %vector.ph ], [ %9, %vector.body ]
%vec.phi73 = phi <2 x i32> [ %minmax.ident.splat75, %vector.ph ], [ %10, %vector.body ]
%3 = getelementptr inbounds i32, ptr %call1, i64 %index
%wide.load = load <2 x i32>, ptr %3, align 4, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 2
%wide.load76 = load <2 x i32>, ptr %4, align 4, !tbaa !5
%5 = sext <2 x i32> %wide.load to <2 x i64>
%6 = sext <2 x i32> %wide.load76 to <2 x i64>
%7 = add <2 x i64> %vec.phi, %5
%8 = add <2 x i64> %vec.phi69, %6
%9 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %vec.phi72, <2 x i32> %wide.load)
%10 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %vec.phi73, <2 x i32> %wide.load76)
%11 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %vec.phi70, <2 x i32> %wide.load)
%12 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %vec.phi71, <2 x i32> %wide.load76)
%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.minmax78 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %9, <2 x i32> %10)
%14 = call i32 @llvm.vector.reduce.smin.v2i32(<2 x i32> %rdx.minmax78)
%rdx.minmax = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %11, <2 x i32> %12)
%15 = call i32 @llvm.vector.reduce.smax.v2i32(<2 x i32> %rdx.minmax)
%bin.rdx = add <2 x i64> %8, %7
%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.end29, label %for.body9.preheader80
for.body9.preheader80: ; preds = %for.body9.preheader, %middle.block
%indvars.iv64.ph = phi i64 [ 0, %for.body9.preheader ], [ %n.vec, %middle.block ]
%sum.058.ph = phi i64 [ 0, %for.body9.preheader ], [ %16, %middle.block ]
%max.057.ph = phi i32 [ %.pre, %for.body9.preheader ], [ %15, %middle.block ]
%min.056.ph = phi i32 [ %.pre, %for.body9.preheader ], [ %14, %middle.block ]
br label %for.body9
for.body9: ; preds = %for.body9.preheader80, %for.body9
%indvars.iv64 = phi i64 [ %indvars.iv.next65, %for.body9 ], [ %indvars.iv64.ph, %for.body9.preheader80 ]
%sum.058 = phi i64 [ %add, %for.body9 ], [ %sum.058.ph, %for.body9.preheader80 ]
%max.057 = phi i32 [ %max.1, %for.body9 ], [ %max.057.ph, %for.body9.preheader80 ]
%min.056 = phi i32 [ %spec.select, %for.body9 ], [ %min.056.ph, %for.body9.preheader80 ]
%arrayidx11 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv64
%17 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%conv12 = sext i32 %17 to i64
%add = add nsw i64 %sum.058, %conv12
%spec.select = call i32 @llvm.smin.i32(i32 %min.056, i32 %17)
%max.1 = call i32 @llvm.smax.i32(i32 %max.057, i32 %17)
%indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
%exitcond.not = icmp eq i64 %indvars.iv.next65, %wide.trip.count
br i1 %exitcond.not, label %for.end29, label %for.body9, !llvm.loop !14
for.end29: ; preds = %for.body9, %middle.block, %for.end
%min.0.lcssa = phi i32 [ %.pre, %for.end ], [ %14, %middle.block ], [ %spec.select, %for.body9 ]
%max.0.lcssa = phi i32 [ %.pre, %for.end ], [ %15, %middle.block ], [ %max.1, %for.body9 ]
%sum.0.lcssa = phi i64 [ 0, %for.end ], [ %16, %middle.block ], [ %add, %for.body9 ]
%call30 = 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 @free(ptr noundef nonnull %call1) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %dim) #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: 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 #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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i32> @llvm.smin.v2i32(<2 x i32>, <2 x i32>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i32> @llvm.smax.v2i32(<2 x i32>, <2 x i32>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v2i32(<2 x i32>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smin.v2i32(<2 x i32>) #5
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
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, !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;
int min = 1000000;
int max = -1000000;
long long int sum = 0;
int a[10000];
scanf("%d\n",&n);
for (i = 0; i < n; i++) {
scanf("%d ", &a[i]);
sum += a[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_173992/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_173992/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 [4 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 [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 ]
%max.033 = phi i32 [ %max.1, %for.body ], [ -1000000, %entry ]
%min.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.1, 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.smin.i32(i32 %min.032, i32 %1)
%max.1 = call i32 @llvm.smax.i32(i32 %max.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
%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 ]
%call18 = 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 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.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, x, min, max, i;
long long sum=0;
scanf("%d", &n);
for(i=1; i<=n; i++){
scanf("%d", &x);
if(i==1)
min = x;
else if(x < min)
min = x;
if(i==1)
max = x;
else if(x > max)
max = x;
sum += x;
}
printf("%d %d %lld\n", min, max, sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174049/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174049/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 i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not22 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp.not22)
%call1.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%1 = load i32, ptr %x, 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 = %entry, %for.body
%sum.026 = phi i64 [ %add, %for.body ], [ %conv.peel, %entry ]
%i.025 = phi i32 [ %inc, %for.body ], [ 2, %entry ]
%max.024 = phi i32 [ %spec.select21, %for.body ], [ %1, %entry ]
%min.023 = phi i32 [ %spec.select, %for.body ], [ %1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%3 = load i32, ptr %x, align 4
%spec.select = call i32 @llvm.smin.i32(i32 %3, i32 %min.023)
%spec.select21 = call i32 @llvm.smax.i32(i32 %3, i32 %max.024)
%conv = sext i32 %3 to i64
%add = add nsw i64 %sum.026, %conv
%inc = add nuw nsw i32 %i.025, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.025, %4
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%min.1.lcssa = phi i32 [ %1, %entry ], [ %spec.select, %for.body ]
%max.1.lcssa = phi i32 [ %1, %entry ], [ %spec.select21, %for.body ]
%add.lcssa = phi i64 [ %conv.peel, %entry ], [ %add, %for.body ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.1.lcssa, i32 noundef %max.1.lcssa, i64 noundef %add.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree 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(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_174092/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174092/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() {
int a, b;
int max = 0;
int min = 0;
long sum = 0;
scanf("%d\n", &a);
for (int i = 0; i < a ;i++) {
scanf("%d",&b);
if (max < b || i == 0) {
max = b;
}
if (min > b || i == 0) {
min = b;
}
sum += (long)b;
}
printf("%d %d %ld\n" ,min ,max ,sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174135/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174135/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:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%max.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
%min.0.lcssa = phi i32 [ 0, %entry ], [ %min.1, %for.body ]
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.body ]
%call9 = 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 %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
for.body: ; preds = %entry, %for.body
%i.021 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%sum.020 = phi i64 [ %add, %for.body ], [ 0, %entry ]
%min.019 = phi i32 [ %min.1, %for.body ], [ 0, %entry ]
%max.018 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b)
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp2 = icmp slt i32 %max.018, %1
%cmp3 = icmp eq i32 %i.021, 0
%or.cond = or i1 %cmp3, %cmp2
%spec.select = select i1 %or.cond, i32 %1, i32 %max.018
%cmp4 = icmp sgt i32 %min.019, %1
%or.cond10 = or i1 %cmp3, %cmp4
%min.1 = select i1 %or.cond10, i32 %1, i32 %min.019
%conv = sext i32 %1 to i64
%add = add nsw i64 %sum.020, %conv
%inc = add nuw nsw i32 %i.021, 1
%2 = load i32, ptr %a, 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(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_174179/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174179/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 n, i, x, min = __INT_MAX__, max = -__INT_MAX__;
long sum = 0;
scanf("%d", &n);
for(i = 0; i < n; i++) {
scanf("%d", &x);
if(x > max) max = x;
if(x < min) min = x;
sum += x;
}
printf("%d %d %ld\n", min, max, sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174221/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174221/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)
%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 [ %spec.select, %for.body ], [ -2147483647, %entry ]
%min.014 = phi i32 [ %min.1, %for.body ], [ 2147483647, %entry ]
%i.013 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %1, i32 %max.015)
%min.1 = call i32 @llvm.smin.i32(i32 %1, i32 %min.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 %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 [ 2147483647, %entry ], [ %min.1, %for.body ]
%max.0.lcssa = phi i32 [ -2147483647, %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.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.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(){
long int n,m,a[10000],i=0,b,c,d;
scanf("%ld",&n);
m=n;
while (n!=0){
scanf("%ld",&a[i]);
n--;
i++;
}
b=c=a[0];
for(int i=0;i<m;i++){
d+=a[i];
}
for(i=1;i<m;i++){
if(b<a[i]){
b=a[i];
}else if(c>a[i]){
c=a[i];
}
}
printf("%ld %ld %ld\n",c,b,d);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174265/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174265/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.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 i64, align 8
%a = alloca [10000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 80000, ptr nonnull %a) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not40 = icmp ne i64 %0, 0
call void @llvm.assume(i1 %cmp.not40)
br label %while.body
while.body: ; preds = %entry, %while.body
%i.041 = phi i64 [ %inc, %while.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i64], ptr %a, i64 0, i64 %i.041
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i64, ptr %n, align 8, !tbaa !5
%dec = add nsw i64 %1, -1
store i64 %dec, ptr %n, align 8, !tbaa !5
%inc = add nuw nsw i64 %i.041, 1
%cmp.not = icmp eq i64 %dec, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body
%.pre = load i64, ptr %a, align 16, !tbaa !5
%cmp442 = icmp sgt i64 %0, 0
call void @llvm.assume(i1 %cmp442)
%min.iters.check = icmp ult i64 %0, 4
br i1 %min.iters.check, label %for.body.preheader, label %vector.ph
vector.ph: ; preds = %while.end
%n.vec = and i64 %0, 9223372036854775804
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> [ <i64 undef, i64 0>, %vector.ph ], [ %4, %vector.body ]
%vec.phi58 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %5, %vector.body ]
%2 = getelementptr inbounds [10000 x i64], ptr %a, i64 0, i64 %index
%wide.load = load <2 x i64>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i64, ptr %2, i64 2
%wide.load59 = load <2 x i64>, ptr %3, align 16, !tbaa !5
%4 = add <2 x i64> %wide.load, %vec.phi
%5 = add <2 x i64> %wide.load59, %vec.phi58
%index.next = add nuw i64 %index, 4
%6 = icmp eq i64 %index.next, %n.vec
br i1 %6, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %5, %4
%7 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %0, %n.vec
br i1 %cmp.n, label %for.cond8.preheader, label %for.body.preheader
for.body.preheader: ; preds = %while.end, %middle.block
%indvars.iv.ph = phi i64 [ 0, %while.end ], [ %n.vec, %middle.block ]
%d.043.ph = phi i64 [ undef, %while.end ], [ %7, %middle.block ]
br label %for.body
for.cond8.preheader: ; preds = %for.body, %middle.block
%add.lcssa = phi i64 [ %7, %middle.block ], [ %add, %for.body ]
%cmp946 = icmp ugt i64 %0, 1
br i1 %cmp946, label %for.body11.preheader, label %for.end24
for.body11.preheader: ; preds = %for.cond8.preheader
%8 = add nsw i64 %0, -1
%xtraiter = and i64 %8, 1
%9 = icmp eq i64 %0, 2
br i1 %9, label %for.end24.loopexit.unr-lcssa, label %for.body11.preheader.new
for.body11.preheader.new: ; preds = %for.body11.preheader
%unroll_iter = and i64 %8, -2
br label %for.body11
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader ]
%d.043 = phi i64 [ %add, %for.body ], [ %d.043.ph, %for.body.preheader ]
%arrayidx6 = getelementptr inbounds [10000 x i64], ptr %a, i64 0, i64 %indvars.iv
%10 = load i64, ptr %arrayidx6, align 8, !tbaa !5
%add = add nsw i64 %10, %d.043
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %0
br i1 %exitcond.not, label %for.cond8.preheader, label %for.body, !llvm.loop !14
for.body11: ; preds = %for.body11, %for.body11.preheader.new
%c.049 = phi i64 [ %.pre, %for.body11.preheader.new ], [ %c.1.1, %for.body11 ]
%b.048 = phi i64 [ %.pre, %for.body11.preheader.new ], [ %b.1.1, %for.body11 ]
%i.147 = phi i64 [ 1, %for.body11.preheader.new ], [ %inc23.1, %for.body11 ]
%niter = phi i64 [ 0, %for.body11.preheader.new ], [ %niter.next.1, %for.body11 ]
%arrayidx12 = getelementptr inbounds [10000 x i64], ptr %a, i64 0, i64 %i.147
%11 = load i64, ptr %arrayidx12, align 8, !tbaa !5
%cmp13 = icmp slt i64 %b.048, %11
%spec.select = call i64 @llvm.smin.i64(i64 %c.049, i64 %11)
%b.1 = call i64 @llvm.smax.i64(i64 %b.048, i64 %11)
%c.1 = select i1 %cmp13, i64 %c.049, i64 %spec.select
%inc23 = add nuw nsw i64 %i.147, 1
%arrayidx12.1 = getelementptr inbounds [10000 x i64], ptr %a, i64 0, i64 %inc23
%12 = load i64, ptr %arrayidx12.1, align 8, !tbaa !5
%cmp13.1 = icmp slt i64 %b.1, %12
%spec.select.1 = call i64 @llvm.smin.i64(i64 %c.1, i64 %12)
%b.1.1 = call i64 @llvm.smax.i64(i64 %b.1, i64 %12)
%c.1.1 = select i1 %cmp13.1, i64 %c.1, i64 %spec.select.1
%inc23.1 = add nuw nsw i64 %i.147, 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.end24.loopexit.unr-lcssa, label %for.body11, !llvm.loop !15
for.end24.loopexit.unr-lcssa: ; preds = %for.body11, %for.body11.preheader
%b.1.lcssa.ph = phi i64 [ undef, %for.body11.preheader ], [ %b.1.1, %for.body11 ]
%c.1.lcssa.ph = phi i64 [ undef, %for.body11.preheader ], [ %c.1.1, %for.body11 ]
%c.049.unr = phi i64 [ %.pre, %for.body11.preheader ], [ %c.1.1, %for.body11 ]
%b.048.unr = phi i64 [ %.pre, %for.body11.preheader ], [ %b.1.1, %for.body11 ]
%i.147.unr = phi i64 [ 1, %for.body11.preheader ], [ %inc23.1, %for.body11 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end24, label %for.body11.epil
for.body11.epil: ; preds = %for.end24.loopexit.unr-lcssa
%arrayidx12.epil = getelementptr inbounds [10000 x i64], ptr %a, i64 0, i64 %i.147.unr
%13 = load i64, ptr %arrayidx12.epil, align 8, !tbaa !5
%cmp13.epil = icmp slt i64 %b.048.unr, %13
%spec.select.epil = call i64 @llvm.smin.i64(i64 %c.049.unr, i64 %13)
%b.1.epil = call i64 @llvm.smax.i64(i64 %b.048.unr, i64 %13)
%c.1.epil = select i1 %cmp13.epil, i64 %c.049.unr, i64 %spec.select.epil
br label %for.end24
for.end24: ; preds = %for.body11.epil, %for.end24.loopexit.unr-lcssa, %for.cond8.preheader
%b.0.lcssa = phi i64 [ %.pre, %for.cond8.preheader ], [ %b.1.lcssa.ph, %for.end24.loopexit.unr-lcssa ], [ %b.1.epil, %for.body11.epil ]
%c.0.lcssa = phi i64 [ %.pre, %for.cond8.preheader ], [ %c.1.lcssa.ph, %for.end24.loopexit.unr-lcssa ], [ %c.1.epil, %for.body11.epil ]
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %c.0.lcssa, i64 noundef %b.0.lcssa, i64 noundef %add.lcssa)
call void @llvm.lifetime.end.p0(i64 80000, ptr nonnull %a) #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 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
; 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 = { 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", !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}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int main(void){
int i,n,x,min=1000000,max=-1000000;
long long ss=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&x);
if(min > x)min = x;
if(max < x)max = x;
ss += x;
}
printf("%d %d %lld\n",min,max,ss);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174308/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174308/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 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)
%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
%ss.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 %x)
%1 = load i32, ptr %x, 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 %ss.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 ]
%ss.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 %ss.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>
int main(void){
int a,x;
int max=-1000000,min=1000000;
long int sum=0;
scanf("%d\n",&a);
for(int i=0;i<a;i++){
scanf("%d ",&x);
if(min>x){
min = x;
}
if(max<x){
max = x;
}
sum += x;
}
printf("%d %d %ld\n",min,max,sum);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174366/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174366/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 [4 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:
%a = alloca i32, align 4
%x = 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 %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %0, 0
br i1 %cmp12, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; 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 %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
for.body: ; preds = %entry, %for.body
%i.016 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%sum.015 = phi i64 [ %add, %for.body ], [ 0, %entry ]
%min.014 = phi i32 [ %spec.select, %for.body ], [ 1000000, %entry ]
%max.013 = phi i32 [ %max.1, %for.body ], [ -1000000, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x)
%1 = load i32, ptr %x, 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.013, i32 %1)
%conv = sext i32 %1 to i64
%add = add nsw i64 %sum.015, %conv
%inc = add nuw nsw i32 %i.016, 1
%2 = load i32, ptr %a, 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 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()
{
long int arr[10001],n,i,max,min,sum=0;
scanf("%ld",&n);
for(i=0;i<n;i++)
scanf("%ld", &arr[i]);
min=arr[0];
max=arr[0];
for(i=0;i<n;i++)
{
if(arr[i]>max)
max=arr[i];
if(arr[i]<min)
min=arr[i];
sum+=arr[i];
}
printf("%ld %ld %ld\n",min,max,sum);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174409/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174409/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.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:
%arr = alloca [10001 x i64], align 16
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 80008, ptr nonnull %arr) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp33 = icmp sgt i64 %0, 0
call void @llvm.assume(i1 %cmp33)
br label %for.body
for.body: ; preds = %entry, %for.body
%i.034 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 x i64], ptr %arr, i64 0, i64 %i.034
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.034, 1
%1 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%.pre = load i64, ptr %arr, align 16, !tbaa !5
%cmp535 = icmp sgt i64 %1, 0
br i1 %cmp535, label %for.body6.preheader, label %for.end18
for.body6.preheader: ; preds = %for.end
%xtraiter = and i64 %1, 1
%2 = icmp eq i64 %1, 1
br i1 %2, label %for.end18.loopexit.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %1, -2
br label %for.body6
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%sum.039 = phi i64 [ 0, %for.body6.preheader.new ], [ %add.1, %for.body6 ]
%min.038 = phi i64 [ %.pre, %for.body6.preheader.new ], [ %min.1.1, %for.body6 ]
%max.037 = phi i64 [ %.pre, %for.body6.preheader.new ], [ %spec.select.1, %for.body6 ]
%i.136 = phi i64 [ 0, %for.body6.preheader.new ], [ %inc17.1, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.body6 ]
%arrayidx7 = getelementptr inbounds [10001 x i64], ptr %arr, i64 0, i64 %i.136
%3 = load i64, ptr %arrayidx7, align 16, !tbaa !5
%spec.select = call i64 @llvm.smax.i64(i64 %3, i64 %max.037)
%min.1 = call i64 @llvm.smin.i64(i64 %3, i64 %min.038)
%add = add nsw i64 %3, %sum.039
%inc17 = or i64 %i.136, 1
%arrayidx7.1 = getelementptr inbounds [10001 x i64], ptr %arr, i64 0, i64 %inc17
%4 = load i64, ptr %arrayidx7.1, align 8, !tbaa !5
%spec.select.1 = call i64 @llvm.smax.i64(i64 %4, i64 %spec.select)
%min.1.1 = call i64 @llvm.smin.i64(i64 %4, i64 %min.1)
%add.1 = add nsw i64 %4, %add
%inc17.1 = add nuw nsw i64 %i.136, 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.end18.loopexit.unr-lcssa, label %for.body6, !llvm.loop !11
for.end18.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%spec.select.lcssa.ph = phi i64 [ undef, %for.body6.preheader ], [ %spec.select.1, %for.body6 ]
%min.1.lcssa.ph = phi i64 [ undef, %for.body6.preheader ], [ %min.1.1, %for.body6 ]
%add.lcssa.ph = phi i64 [ undef, %for.body6.preheader ], [ %add.1, %for.body6 ]
%sum.039.unr = phi i64 [ 0, %for.body6.preheader ], [ %add.1, %for.body6 ]
%min.038.unr = phi i64 [ %.pre, %for.body6.preheader ], [ %min.1.1, %for.body6 ]
%max.037.unr = phi i64 [ %.pre, %for.body6.preheader ], [ %spec.select.1, %for.body6 ]
%i.136.unr = phi i64 [ 0, %for.body6.preheader ], [ %inc17.1, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end18, label %for.body6.epil
for.body6.epil: ; preds = %for.end18.loopexit.unr-lcssa
%arrayidx7.epil = getelementptr inbounds [10001 x i64], ptr %arr, i64 0, i64 %i.136.unr
%5 = load i64, ptr %arrayidx7.epil, align 8, !tbaa !5
%spec.select.epil = call i64 @llvm.smax.i64(i64 %5, i64 %max.037.unr)
%min.1.epil = call i64 @llvm.smin.i64(i64 %5, i64 %min.038.unr)
%add.epil = add nsw i64 %5, %sum.039.unr
br label %for.end18
for.end18: ; preds = %for.body6.epil, %for.end18.loopexit.unr-lcssa, %for.end
%max.0.lcssa = phi i64 [ %.pre, %for.end ], [ %spec.select.lcssa.ph, %for.end18.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body6.epil ]
%min.0.lcssa = phi i64 [ %.pre, %for.end ], [ %min.1.lcssa.ph, %for.end18.loopexit.unr-lcssa ], [ %min.1.epil, %for.body6.epil ]
%sum.0.lcssa = phi i64 [ 0, %for.end ], [ %add.lcssa.ph, %for.end18.loopexit.unr-lcssa ], [ %add.epil, %for.body6.epil ]
%call19 = 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 8, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 80008, ptr nonnull %arr) #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.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 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", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void)
{
int n = 0; //整数の個数
int a[10000]; //数値を入れる配列
int max = 0; //最大値
int min = 0; //最小値
long long sum = 0; //合計
int i = 0;
//整数の数を入力する
scanf("%d", &n);
//整数を入力する
for (i = 0; i < n; i++)
{
scanf("%d", &a[i]);
}
max = min = a[0];
sum += a[0];
for (i = 1; i < n; i++)
{
if (a[i] > max)
max = a[i];
if (a[i] < min)
min = a[i];
sum += a[i];
}
printf("%d %d %ld\n", min, max, sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174452/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174452/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) #5
store i32 0, ptr %n, align 4, !tbaa !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
%cmp44 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp44)
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 %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%.pre = load i32, ptr %a, align 16, !tbaa !5
%conv = sext i32 %.pre to i64
%cmp546 = icmp sgt i32 %1, 1
br i1 %cmp546, label %for.body7.preheader, label %for.end28
for.body7.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %1 to i64
%3 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %1, 5
br i1 %min.iters.check, label %for.body7.preheader73, label %vector.ph
vector.ph: ; preds = %for.body7.preheader
%n.vec = and i64 %3, -4
%ind.end = or i64 %n.vec, 1
%4 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %conv, i64 0
%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.splatinsert67 = insertelement <2 x i32> poison, i32 %.pre, i64 0
%minmax.ident.splat68 = shufflevector <2 x i32> %minmax.ident.splatinsert67, <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> [ %4, %vector.ph ], [ %13, %vector.body ]
%vec.phi62 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%vec.phi63 = phi <2 x i32> [ %minmax.ident.splat, %vector.ph ], [ %9, %vector.body ]
%vec.phi64 = phi <2 x i32> [ %minmax.ident.splat, %vector.ph ], [ %10, %vector.body ]
%vec.phi65 = phi <2 x i32> [ %minmax.ident.splat68, %vector.ph ], [ %7, %vector.body ]
%vec.phi66 = phi <2 x i32> [ %minmax.ident.splat68, %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 <2 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 2
%wide.load69 = load <2 x i32>, ptr %6, align 4, !tbaa !5
%7 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %wide.load, <2 x i32> %vec.phi65)
%8 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %wide.load69, <2 x i32> %vec.phi66)
%9 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %wide.load, <2 x i32> %vec.phi63)
%10 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %wide.load69, <2 x i32> %vec.phi64)
%11 = sext <2 x i32> %wide.load to <2 x i64>
%12 = sext <2 x i32> %wide.load69 to <2 x i64>
%13 = add <2 x i64> %vec.phi, %11
%14 = add <2 x i64> %vec.phi62, %12
%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
%rdx.minmax71 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %7, <2 x i32> %8)
%16 = call i32 @llvm.vector.reduce.smax.v2i32(<2 x i32> %rdx.minmax71)
%rdx.minmax = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %9, <2 x i32> %10)
%17 = call i32 @llvm.vector.reduce.smin.v2i32(<2 x i32> %rdx.minmax)
%bin.rdx = add <2 x i64> %14, %13
%18 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %3, %n.vec
br i1 %cmp.n, label %for.end28, label %for.body7.preheader73
for.body7.preheader73: ; preds = %for.body7.preheader, %middle.block
%indvars.iv56.ph = phi i64 [ 1, %for.body7.preheader ], [ %ind.end, %middle.block ]
%sum.049.ph = phi i64 [ %conv, %for.body7.preheader ], [ %18, %middle.block ]
%min.048.ph = phi i32 [ %.pre, %for.body7.preheader ], [ %17, %middle.block ]
%max.047.ph = phi i32 [ %.pre, %for.body7.preheader ], [ %16, %middle.block ]
br label %for.body7
for.body7: ; preds = %for.body7.preheader73, %for.body7
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body7 ], [ %indvars.iv56.ph, %for.body7.preheader73 ]
%sum.049 = phi i64 [ %add25, %for.body7 ], [ %sum.049.ph, %for.body7.preheader73 ]
%min.048 = phi i32 [ %min.1, %for.body7 ], [ %min.048.ph, %for.body7.preheader73 ]
%max.047 = phi i32 [ %spec.select, %for.body7 ], [ %max.047.ph, %for.body7.preheader73 ]
%arrayidx9 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv56
%19 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %19, i32 %max.047)
%min.1 = call i32 @llvm.smin.i32(i32 %19, i32 %min.048)
%conv24 = sext i32 %19 to i64
%add25 = add nsw i64 %sum.049, %conv24
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%exitcond.not = icmp eq i64 %indvars.iv.next57, %wide.trip.count
br i1 %exitcond.not, label %for.end28, label %for.body7, !llvm.loop !14
for.end28: ; preds = %for.body7, %middle.block, %for.end
%max.0.lcssa = phi i32 [ %.pre, %for.end ], [ %16, %middle.block ], [ %spec.select, %for.body7 ]
%min.0.lcssa = phi i32 [ %.pre, %for.end ], [ %17, %middle.block ], [ %min.1, %for.body7 ]
%sum.0.lcssa = phi i64 [ %conv, %for.end ], [ %18, %middle.block ], [ %add25, %for.body7 ]
%call29 = 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) #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 <2 x i32> @llvm.smax.v2i32(<2 x i32>, <2 x i32>) #3
; 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 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.smin.v2i32(<2 x i32>) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.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){
// Your code here!
int n;
int a[100000] = {0};
scanf("%d",&n);
for(int i=0; i<n; i++){
scanf("%d",&a[i]);
}
long long sum = 0;
int min = a[0];
int max = a[0];
for(int i=0; i<n; i++){
sum += a[i];
if(min > a[i]) min = a[i];
if(max < a[i]) max = a[i];
}
printf("%d %d %ld\n",min,max,sum);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174496/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174496/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 [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %a) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400000) %a, i8 0, i64 400000, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp41 = icmp sgt i32 %0, 0
br i1 %cmp41, label %for.body, label %for.cond.cleanup7
for.cond.cleanup: ; preds = %for.body
%.pre = load i32, ptr %a, align 16, !tbaa !5
%cmp643 = icmp sgt i32 %15, 0
br i1 %cmp643, label %for.body8.preheader, label %for.cond.cleanup7
for.body8.preheader: ; preds = %for.cond.cleanup
%wide.trip.count = zext i32 %15 to i64
%min.iters.check = icmp ult i32 %15, 4
br i1 %min.iters.check, label %for.body8.preheader69, label %vector.ph
vector.ph: ; preds = %for.body8.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.splatinsert61 = insertelement <2 x i32> poison, i32 %.pre, i64 0
%minmax.ident.splat62 = shufflevector <2 x i32> %minmax.ident.splatinsert61, <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 i32> [ %minmax.ident.splat, %vector.ph ], [ %9, %vector.body ]
%vec.phi58 = phi <2 x i32> [ %minmax.ident.splat, %vector.ph ], [ %10, %vector.body ]
%vec.phi59 = phi <2 x i32> [ %minmax.ident.splat62, %vector.ph ], [ %7, %vector.body ]
%vec.phi60 = phi <2 x i32> [ %minmax.ident.splat62, %vector.ph ], [ %8, %vector.body ]
%vec.phi63 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %5, %vector.body ]
%vec.phi64 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%1 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %index
%wide.load = load <2 x i32>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 2
%wide.load65 = load <2 x i32>, ptr %2, align 8, !tbaa !5
%3 = sext <2 x i32> %wide.load to <2 x i64>
%4 = sext <2 x i32> %wide.load65 to <2 x i64>
%5 = add <2 x i64> %vec.phi63, %3
%6 = add <2 x i64> %vec.phi64, %4
%7 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %vec.phi59, <2 x i32> %wide.load)
%8 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %vec.phi60, <2 x i32> %wide.load65)
%9 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %vec.phi, <2 x i32> %wide.load)
%10 = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %vec.phi58, <2 x i32> %wide.load65)
%index.next = add nuw i64 %index, 4
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %6, %5
%12 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%rdx.minmax66 = call <2 x i32> @llvm.smin.v2i32(<2 x i32> %7, <2 x i32> %8)
%13 = call i32 @llvm.vector.reduce.smin.v2i32(<2 x i32> %rdx.minmax66)
%rdx.minmax = call <2 x i32> @llvm.smax.v2i32(<2 x i32> %9, <2 x i32> %10)
%14 = call i32 @llvm.vector.reduce.smax.v2i32(<2 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond.cleanup7, label %for.body8.preheader69
for.body8.preheader69: ; preds = %for.body8.preheader, %middle.block
%indvars.iv53.ph = phi i64 [ 0, %for.body8.preheader ], [ %n.vec, %middle.block ]
%max.046.ph = phi i32 [ %.pre, %for.body8.preheader ], [ %14, %middle.block ]
%min.045.ph = phi i32 [ %.pre, %for.body8.preheader ], [ %13, %middle.block ]
%sum.044.ph = phi i64 [ 0, %for.body8.preheader ], [ %12, %middle.block ]
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%15 = load i32, ptr %n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp = icmp slt i64 %indvars.iv.next, %16
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
for.cond.cleanup7: ; preds = %for.body8, %middle.block, %entry, %for.cond.cleanup
%sum.0.lcssa = phi i64 [ 0, %for.cond.cleanup ], [ 0, %entry ], [ %12, %middle.block ], [ %add, %for.body8 ]
%min.0.lcssa = phi i32 [ %.pre, %for.cond.cleanup ], [ 0, %entry ], [ %13, %middle.block ], [ %spec.select, %for.body8 ]
%max.0.lcssa = phi i32 [ %.pre, %for.cond.cleanup ], [ 0, %entry ], [ %14, %middle.block ], [ %max.1, %for.body8 ]
%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 %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body8: ; preds = %for.body8.preheader69, %for.body8
%indvars.iv53 = phi i64 [ %indvars.iv.next54, %for.body8 ], [ %indvars.iv53.ph, %for.body8.preheader69 ]
%max.046 = phi i32 [ %max.1, %for.body8 ], [ %max.046.ph, %for.body8.preheader69 ]
%min.045 = phi i32 [ %spec.select, %for.body8 ], [ %min.045.ph, %for.body8.preheader69 ]
%sum.044 = phi i64 [ %add, %for.body8 ], [ %sum.044.ph, %for.body8.preheader69 ]
%arrayidx10 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv53
%17 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%conv = sext i32 %17 to i64
%add = add nsw i64 %sum.044, %conv
%spec.select = call i32 @llvm.smin.i32(i32 %min.045, i32 %17)
%max.1 = call i32 @llvm.smax.i32(i32 %max.046, i32 %17)
%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.cond.cleanup7, label %for.body8, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind 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 #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, 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 <2 x i32> @llvm.smax.v2i32(<2 x i32>, <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
; 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 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 = !{!"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(void)
{
int a[10000], n, i;
long min, max, sum;
scanf("%d", &n);
for(i=0; i<n; i++)
{
scanf("%d", &a[i]);
}
min = a[0];
max = a[0];
sum = 0;
for(i=0; i<n; i++)
{
if(min>=a[i])
{
min = a[i];
}
if(max<=a[i])
{
max = a[i];
}
sum = sum + a[i];
}
printf("%ld %ld %ld\n", min, max, sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174539/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174539/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:
%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)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp46 = icmp sgt i32 %0, 0
br i1 %cmp46, label %for.body, label %for.end32
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %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)
%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
%.pre = load i32, ptr %a, align 16, !tbaa !5
%3 = sext i32 %.pre to i64
%cmp648 = icmp sgt i32 %1, 0
br i1 %cmp648, label %for.body8.preheader, label %for.end32
for.body8.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %1 to i64
%xtraiter = and i64 %wide.trip.count, 1
%4 = icmp eq i32 %1, 1
br i1 %4, label %for.end32.loopexit.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body8
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%indvars.iv58 = phi i64 [ 0, %for.body8.preheader.new ], [ %indvars.iv.next59.1, %for.body8 ]
%sum.052 = phi i64 [ 0, %for.body8.preheader.new ], [ %add.1, %for.body8 ]
%max.051 = phi i64 [ %3, %for.body8.preheader.new ], [ %max.1.1, %for.body8 ]
%min.050 = phi i64 [ %3, %for.body8.preheader.new ], [ %spec.select.1, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.1, %for.body8 ]
%arrayidx10 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv58
%5 = load i32, ptr %arrayidx10, align 8, !tbaa !5
%conv11 = sext i32 %5 to i64
%spec.select = call i64 @llvm.smin.i64(i64 %min.050, i64 %conv11)
%max.1 = call i64 @llvm.smax.i64(i64 %max.051, i64 %conv11)
%add = add nsw i64 %sum.052, %conv11
%indvars.iv.next59 = or i64 %indvars.iv58, 1
%arrayidx10.1 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv.next59
%6 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%conv11.1 = sext i32 %6 to i64
%spec.select.1 = call i64 @llvm.smin.i64(i64 %spec.select, i64 %conv11.1)
%max.1.1 = call i64 @llvm.smax.i64(i64 %max.1, i64 %conv11.1)
%add.1 = add nsw i64 %add, %conv11.1
%indvars.iv.next59.1 = add nuw nsw i64 %indvars.iv58, 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.end32.loopexit.unr-lcssa, label %for.body8, !llvm.loop !11
for.end32.loopexit.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%spec.select.lcssa.ph = phi i64 [ undef, %for.body8.preheader ], [ %spec.select.1, %for.body8 ]
%max.1.lcssa.ph = phi i64 [ undef, %for.body8.preheader ], [ %max.1.1, %for.body8 ]
%add.lcssa.ph = phi i64 [ undef, %for.body8.preheader ], [ %add.1, %for.body8 ]
%indvars.iv58.unr = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next59.1, %for.body8 ]
%sum.052.unr = phi i64 [ 0, %for.body8.preheader ], [ %add.1, %for.body8 ]
%max.051.unr = phi i64 [ %3, %for.body8.preheader ], [ %max.1.1, %for.body8 ]
%min.050.unr = phi i64 [ %3, %for.body8.preheader ], [ %spec.select.1, %for.body8 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end32, label %for.body8.epil
for.body8.epil: ; preds = %for.end32.loopexit.unr-lcssa
%arrayidx10.epil = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv58.unr
%7 = load i32, ptr %arrayidx10.epil, align 4, !tbaa !5
%conv11.epil = sext i32 %7 to i64
%spec.select.epil = call i64 @llvm.smin.i64(i64 %min.050.unr, i64 %conv11.epil)
%max.1.epil = call i64 @llvm.smax.i64(i64 %max.051.unr, i64 %conv11.epil)
%add.epil = add nsw i64 %sum.052.unr, %conv11.epil
br label %for.end32
for.end32: ; preds = %for.body8.epil, %for.end32.loopexit.unr-lcssa, %entry, %for.end
%min.0.lcssa = phi i64 [ %3, %for.end ], [ 0, %entry ], [ %spec.select.lcssa.ph, %for.end32.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body8.epil ]
%max.0.lcssa = phi i64 [ %3, %for.end ], [ 0, %entry ], [ %max.1.lcssa.ph, %for.end32.loopexit.unr-lcssa ], [ %max.1.epil, %for.body8.epil ]
%sum.0.lcssa = phi i64 [ 0, %for.end ], [ 0, %entry ], [ %add.lcssa.ph, %for.end32.loopexit.unr-lcssa ], [ %add.epil, %for.body8.epil ]
%call33 = 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 %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 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"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
void memorec(double p_q,int beforeDenom,int prod,int count);
int ans = 0;
int p,q,a,n;
int main() {
while(1){
scanf("%d",&p);
scanf("%d",&q);
scanf("%d",&a);
scanf("%d",&n);
if(p == 0 && q == 0 && a == 0 && n == 0) return 0;
memorec((double)p/(double)q,1,1,1);
printf("%d\n",ans);
ans = 0;
}
}
void memorec(double p_q,int beforeDenom,int prod,int count){
double denominator = beforeDenom;
double result;
while(1){
if(prod*denominator>a) return;
result = p_q - 1/denominator;
if(result < 0.00000001 && result > -0.00000001){
ans++;
denominator++;
continue;
}
if(result > 0){
if(count+1 > n) return;
memorec(result,denominator,prod*denominator,count+1);
}
denominator++;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174597/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174597/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"
@ans = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@p = dso_local global i32 0, align 4
@q = dso_local global i32 0, align 4
@a = dso_local global i32 0, align 4
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
br label %while.body
while.body: ; preds = %entry, %if.end
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @p)
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @q)
%call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @a)
%call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @p, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 0
%1 = load i32, ptr @q, align 4
%cmp4 = icmp eq i32 %1, 0
%or.cond = select i1 %cmp, i1 %cmp4, i1 false
%2 = load i32, ptr @a, align 4
%cmp6 = icmp eq i32 %2, 0
%or.cond11 = select i1 %or.cond, i1 %cmp6, i1 false
%3 = load i32, ptr @n, align 4
%cmp8 = icmp eq i32 %3, 0
%or.cond12 = select i1 %or.cond11, i1 %cmp8, i1 false
br i1 %or.cond12, label %if.then, label %if.end
if.then: ; preds = %while.body
ret i32 0
if.end: ; preds = %while.body
%conv = sitofp i32 %0 to double
%conv9 = sitofp i32 %1 to double
%div = fdiv double %conv, %conv9
tail call void @memorec(double noundef %div, i32 noundef 1, i32 noundef 1, i32 noundef 1)
%4 = load i32, ptr @ans, align 4, !tbaa !5
%call10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
store i32 0, ptr @ans, align 4, !tbaa !5
br label %while.body
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @memorec(double noundef %p_q, i32 noundef %beforeDenom, i32 noundef %prod, i32 noundef %count) local_unnamed_addr #2 {
entry:
%conv = sitofp i32 %beforeDenom to double
%conv1 = sitofp i32 %prod to double
%mul36 = fmul double %conv1, %conv
%0 = load i32, ptr @a, align 4, !tbaa !5
%conv237 = sitofp i32 %0 to double
%cmp38 = fcmp ogt double %mul36, %conv237
br i1 %cmp38, label %cleanup, label %if.end.lr.ph
if.end.lr.ph: ; preds = %entry
%add = add nsw i32 %count, 1
br label %if.end
if.end: ; preds = %if.end.lr.ph, %while.cond.backedge
%.pre41 = phi i32 [ %0, %if.end.lr.ph ], [ %.pre42, %while.cond.backedge ]
%1 = phi i32 [ %0, %if.end.lr.ph ], [ %3, %while.cond.backedge ]
%mul40 = phi double [ %mul36, %if.end.lr.ph ], [ %mul, %while.cond.backedge ]
%denominator.039 = phi double [ %conv, %if.end.lr.ph ], [ %denominator.0.be, %while.cond.backedge ]
%div = fdiv double 1.000000e+00, %denominator.039
%sub = fsub double %p_q, %div
%cmp4 = fcmp olt double %sub, 1.000000e-08
%cmp6 = fcmp ogt double %sub, -1.000000e-08
%or.cond = and i1 %cmp4, %cmp6
br i1 %or.cond, label %if.then8, label %if.end10
if.then8: ; preds = %if.end
%2 = load i32, ptr @ans, align 4, !tbaa !5
%inc = add nsw i32 %2, 1
store i32 %inc, ptr @ans, align 4, !tbaa !5
br label %while.cond.backedge
while.cond.backedge: ; preds = %if.end10, %if.end17, %if.then8
%.pre42 = phi i32 [ %.pre41, %if.then8 ], [ %.pre.pre, %if.end17 ], [ %.pre41, %if.end10 ]
%3 = phi i32 [ %1, %if.then8 ], [ %.pre.pre, %if.end17 ], [ %.pre41, %if.end10 ]
%denominator.0.be = fadd double %denominator.039, 1.000000e+00
%mul = fmul double %denominator.0.be, %conv1
%conv2 = sitofp i32 %3 to double
%cmp = fcmp ogt double %mul, %conv2
br i1 %cmp, label %cleanup, label %if.end
if.end10: ; preds = %if.end
%cmp11 = fcmp ogt double %sub, 0.000000e+00
br i1 %cmp11, label %if.then13, label %while.cond.backedge
if.then13: ; preds = %if.end10
%4 = load i32, ptr @n, align 4, !tbaa !5
%cmp14.not = icmp sgt i32 %4, %count
br i1 %cmp14.not, label %if.end17, label %cleanup
if.end17: ; preds = %if.then13
%conv18 = fptosi double %denominator.039 to i32
%conv21 = fptosi double %mul40 to i32
tail call void @memorec(double noundef %sub, i32 noundef %conv18, i32 noundef %conv21, i32 noundef %add)
%.pre.pre = load i32, ptr @a, align 4, !tbaa !5
br label %while.cond.backedge
cleanup: ; preds = %while.cond.backedge, %if.then13, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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" }
!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>
int euku(int,int);
int main(){
int i;
long long n,m;
long long p;
long long q;
int l=0;
scanf("%lld %lld",&n,&m);
unsigned char s[1000000];
unsigned char t[1000000];
scanf("%s",s);
scanf("%s",t);
if(s[0]!=t[0]){
l++;
}
q = euku(n,m);
p = n*m/euku(n,m);
for(i=0; i<=q; i++){
if(s[i*n/q]!=t[i*m/q]){
l++;
}
}
if(l==0){
printf("%lld\n",p);
}else if(l>0){
printf("-1\n");
}
return 0;
}
int euku(int a,int b){
int r;
if(a>=b){
r = a % b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
return b;
}else{
r = b % a;
while(r!=0){
b = a;
a = r;
r = b % a;
}
return a;
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174647/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174647/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 [10 x i8] c"%lld %lld\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 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%m = alloca i64, align 8
%s = alloca [1000000 x i8], align 16
%t = alloca [1000000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %t) #5
%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 i8, ptr %s, align 16, !tbaa !5
%1 = load i8, ptr %t, align 16, !tbaa !5
%cmp.not = icmp ne i8 %0, %1
%spec.select = zext i1 %cmp.not to i32
%2 = load i64, ptr %n, align 8, !tbaa !8
%conv7 = trunc i64 %2 to i32
%3 = load i64, ptr %m, align 8, !tbaa !8
%conv8 = trunc i64 %3 to i32
%cmp.not.i = icmp slt i32 %conv7, %conv8
br i1 %cmp.not.i, label %if.else.i, label %if.then.i
if.then.i: ; preds = %entry
%rem.i = srem i32 %conv7, %conv8
%cmp1.not25.i = icmp eq i32 %rem.i, 0
br i1 %cmp1.not25.i, label %if.then.i54.thread, label %while.body.i
if.then.i54.thread: ; preds = %if.then.i
%sext = shl i64 %3, 32
%conv1083 = ashr exact i64 %sext, 32
br label %euku.exit71
while.body.i: ; preds = %if.then.i, %while.body.i
%r.027.i = phi i32 [ %rem2.i, %while.body.i ], [ %rem.i, %if.then.i ]
%b.addr.026.i = phi i32 [ %r.027.i, %while.body.i ], [ %conv8, %if.then.i ]
%rem2.i = srem i32 %b.addr.026.i, %r.027.i
%cmp1.not.i = icmp eq i32 %rem2.i, 0
br i1 %cmp1.not.i, label %euku.exit, label %while.body.i, !llvm.loop !10
if.else.i: ; preds = %entry
%rem3.i = srem i32 %conv8, %conv7
%cmp5.not28.i = icmp eq i32 %rem3.i, 0
br i1 %cmp5.not28.i, label %if.else.i63.thread, label %while.body6.i
if.else.i63.thread: ; preds = %if.else.i
%sext88 = shl i64 %2, 32
%conv1073 = ashr exact i64 %sext88, 32
br label %euku.exit71
while.body6.i: ; preds = %if.else.i, %while.body6.i
%r.130.i = phi i32 [ %rem7.i, %while.body6.i ], [ %rem3.i, %if.else.i ]
%a.addr.029.i = phi i32 [ %r.130.i, %while.body6.i ], [ %conv7, %if.else.i ]
%rem7.i = srem i32 %a.addr.029.i, %r.130.i
%cmp5.not.i = icmp eq i32 %rem7.i, 0
br i1 %cmp5.not.i, label %euku.exit, label %while.body6.i, !llvm.loop !12
euku.exit: ; preds = %while.body.i, %while.body6.i
%retval.0.i = phi i32 [ %r.130.i, %while.body6.i ], [ %r.027.i, %while.body.i ]
%conv10 = sext i32 %retval.0.i to i64
br i1 %cmp.not.i, label %if.else.i63, label %if.then.i54
if.then.i54: ; preds = %euku.exit
%.pre97 = srem i32 %conv7, %conv8
%cmp1.not25.i56 = icmp eq i32 %.pre97, 0
br i1 %cmp1.not25.i56, label %euku.exit71, label %while.body.i57
while.body.i57: ; preds = %if.then.i54, %while.body.i57
%r.027.i58 = phi i32 [ %rem2.i60, %while.body.i57 ], [ %.pre97, %if.then.i54 ]
%b.addr.026.i59 = phi i32 [ %r.027.i58, %while.body.i57 ], [ %conv8, %if.then.i54 ]
%rem2.i60 = srem i32 %b.addr.026.i59, %r.027.i58
%cmp1.not.i61 = icmp eq i32 %rem2.i60, 0
br i1 %cmp1.not.i61, label %euku.exit71, label %while.body.i57, !llvm.loop !10
if.else.i63: ; preds = %euku.exit
%.pre = srem i32 %conv8, %conv7
%cmp5.not28.i65 = icmp eq i32 %.pre, 0
br i1 %cmp5.not28.i65, label %euku.exit71, label %while.body6.i66
while.body6.i66: ; preds = %if.else.i63, %while.body6.i66
%r.130.i67 = phi i32 [ %rem7.i69, %while.body6.i66 ], [ %.pre, %if.else.i63 ]
%a.addr.029.i68 = phi i32 [ %r.130.i67, %while.body6.i66 ], [ %conv7, %if.else.i63 ]
%rem7.i69 = srem i32 %a.addr.029.i68, %r.130.i67
%cmp5.not.i70 = icmp eq i32 %rem7.i69, 0
br i1 %cmp5.not.i70, label %euku.exit71, label %while.body6.i66, !llvm.loop !12
euku.exit71: ; preds = %while.body.i57, %while.body6.i66, %if.else.i63.thread, %if.then.i54.thread, %if.then.i54, %if.else.i63
%conv1077 = phi i64 [ %conv10, %if.else.i63 ], [ %conv10, %if.then.i54 ], [ %conv1083, %if.then.i54.thread ], [ %conv1073, %if.else.i63.thread ], [ %conv10, %while.body6.i66 ], [ %conv10, %while.body.i57 ]
%retval.0.i75 = phi i32 [ %retval.0.i, %if.else.i63 ], [ %retval.0.i, %if.then.i54 ], [ %conv8, %if.then.i54.thread ], [ %conv7, %if.else.i63.thread ], [ %retval.0.i, %while.body6.i66 ], [ %retval.0.i, %while.body.i57 ]
%retval.0.i62 = phi i32 [ %conv7, %if.else.i63 ], [ %conv8, %if.then.i54 ], [ %conv8, %if.then.i54.thread ], [ %conv7, %if.else.i63.thread ], [ %r.130.i67, %while.body6.i66 ], [ %r.027.i58, %while.body.i57 ]
%mul79 = mul nsw i64 %3, %2
%conv14 = sext i32 %retval.0.i62 to i64
%div = sdiv i64 %mul79, %conv14
%cmp16.not91 = icmp slt i32 %retval.0.i75, 0
br i1 %cmp16.not91, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %euku.exit71
%4 = add nuw i32 %retval.0.i75, 1
%wide.trip.count = zext i32 %4 to i64
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 ]
%l.193 = phi i32 [ %spec.select, %for.body.preheader ], [ %spec.select52, %for.body ]
%mul19 = mul nsw i64 %2, %indvars.iv
%div20 = sdiv i64 %mul19, %conv1077
%arrayidx21 = getelementptr inbounds [1000000 x i8], ptr %s, i64 0, i64 %div20
%5 = load i8, ptr %arrayidx21, align 1, !tbaa !5
%mul24 = mul nsw i64 %3, %indvars.iv
%div25 = sdiv i64 %mul24, %conv1077
%arrayidx26 = getelementptr inbounds [1000000 x i8], ptr %t, i64 0, i64 %div25
%6 = load i8, ptr %arrayidx26, align 1, !tbaa !5
%cmp28.not = icmp ne i8 %5, %6
%inc31 = zext i1 %cmp28.not to i32
%spec.select52 = add nuw nsw i32 %l.193, %inc31
%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 !13
for.end: ; preds = %for.body, %euku.exit71
%l.1.lcssa = phi i32 [ %spec.select, %euku.exit71 ], [ %spec.select52, %for.body ]
%cmp34 = icmp eq i32 %l.1.lcssa, 0
br i1 %cmp34, label %if.then36, label %if.then40
if.then36: ; preds = %for.end
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %div)
br label %if.end43
if.then40: ; preds = %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end43
if.end43: ; preds = %if.then40, %if.then36
call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %t) #5
call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #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: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @euku(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%cmp.not = icmp slt i32 %a, %b
br i1 %cmp.not, label %if.else, label %if.then
if.then: ; preds = %entry
%rem = srem i32 %a, %b
%cmp1.not25 = icmp eq i32 %rem, 0
br i1 %cmp1.not25, label %cleanup, label %while.body
while.body: ; preds = %if.then, %while.body
%r.027 = phi i32 [ %rem2, %while.body ], [ %rem, %if.then ]
%b.addr.026 = phi i32 [ %r.027, %while.body ], [ %b, %if.then ]
%rem2 = srem i32 %b.addr.026, %r.027
%cmp1.not = icmp eq i32 %rem2, 0
br i1 %cmp1.not, label %cleanup, label %while.body, !llvm.loop !10
if.else: ; preds = %entry
%rem3 = srem i32 %b, %a
%cmp5.not28 = icmp eq i32 %rem3, 0
br i1 %cmp5.not28, label %cleanup, label %while.body6
while.body6: ; preds = %if.else, %while.body6
%r.130 = phi i32 [ %rem7, %while.body6 ], [ %rem3, %if.else ]
%a.addr.029 = phi i32 [ %r.130, %while.body6 ], [ %a, %if.else ]
%rem7 = srem i32 %a.addr.029, %r.130
%cmp5.not = icmp eq i32 %rem7, 0
br i1 %cmp5.not, label %cleanup, label %while.body6, !llvm.loop !12
cleanup: ; preds = %while.body, %while.body6, %if.then, %if.else
%retval.0 = phi i32 [ %a, %if.else ], [ %b, %if.then ], [ %r.130, %while.body6 ], [ %r.027, %while.body ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 = { 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 #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
|
#include<stdio.h>
#include<string.h>
int max(int,int);
int main(void){
char str[200];
int a,b,i;
while(1){
for(i=0;i<200;i++){
str[i]='\0';
}
scanf("%[^\n]%*c",str);
a=0;
b=0;
if(str[0]=='0')break;
for(i=1;str[i]!='\0';i++){
if(str[i]=='A')a++;
else if(str[i]=='B')b++;
}
if(a==max(a,b))a++;
else if(b==max(a,b))b++;
printf("%d %d\n",a,b);
}
return 0;
}
int max(int x,int y){
return (x<y)?y:x;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174704/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174704/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"%[^\0A]%*c\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 [200 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %str) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200) %str, i8 0, i64 200, i1 false), !tbaa !5
%call64 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%0 = load i8, ptr %str, align 16, !tbaa !5
%cmp265 = icmp eq i8 %0, 48
br i1 %cmp265, label %while.end, label %for.cond4
for.cond4: ; preds = %entry, %for.cond4.backedge
%indvars.iv = phi i64 [ %indvars.iv.be, %for.cond4.backedge ], [ 1, %entry ]
%a.0 = phi i32 [ %a.0.be, %for.cond4.backedge ], [ 0, %entry ]
%b.0 = phi i32 [ %b.0.be, %for.cond4.backedge ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [200 x i8], ptr %str, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx6, align 1, !tbaa !5
switch i8 %1, label %for.inc27 [
i8 0, label %for.end29
i8 65, label %if.then16
i8 66, label %if.then23
]
if.then16: ; preds = %for.cond4
%inc17 = add nsw i32 %a.0, 1
br label %for.inc27
if.then23: ; preds = %for.cond4
%inc24 = add nsw i32 %b.0, 1
br label %for.inc27
for.inc27: ; preds = %for.cond4, %if.then16, %if.then23
%a.1 = phi i32 [ %inc17, %if.then16 ], [ %a.0, %if.then23 ], [ %a.0, %for.cond4 ]
%b.1 = phi i32 [ %b.0, %if.then16 ], [ %inc24, %if.then23 ], [ %b.0, %for.cond4 ]
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br label %for.cond4.backedge
for.cond4.backedge: ; preds = %for.inc27, %for.end29
%indvars.iv.be = phi i64 [ %indvars.iv.next, %for.inc27 ], [ 1, %for.end29 ]
%a.0.be = phi i32 [ %a.1, %for.inc27 ], [ 0, %for.end29 ]
%b.0.be = phi i32 [ %b.1, %for.inc27 ], [ 0, %for.end29 ]
br label %for.cond4, !llvm.loop !8
for.end29: ; preds = %for.cond4
%cmp31.not = icmp sge i32 %a.0, %b.0
%cmp37.not = icmp sge i32 %b.0, %a.0
%inc34 = zext i1 %cmp31.not to i32
%a.2 = add nsw i32 %a.0, %inc34
%not.cmp31.not = xor i1 %cmp31.not, true
%narrow = and i1 %cmp37.not, %not.cmp31.not
%spec.select = zext i1 %narrow to i32
%b.2 = add nsw i32 %b.0, %spec.select
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.2, i32 noundef %b.2)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200) %str, i8 0, i64 200, i1 false), !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%2 = load i8, ptr %str, align 16, !tbaa !5
%cmp2 = icmp eq i8 %2, 48
br i1 %cmp2, label %while.end, label %for.cond4.backedge
while.end: ; preds = %for.end29, %entry
call void @llvm.lifetime.end.p0(i64 200, 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %x, i32 noundef %y) local_unnamed_addr #3 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %x, i32 %y)
ret i32 %cond
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; 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 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<math.h>
int main(void){
int n,i;
double hensa2,bunsan,sum,heikin;
while(1){
hensa2=0;
sum=0;
scanf("%d",&n);
if(n==0) break;
double s[n];
for(i=0;i<n;i++){
scanf("%lf",&s[i]);
sum+=s[i];
}
heikin=sum/n;
for(i=0;i<n;i++){
hensa2+=(s[i]-heikin)*(s[i]-heikin);
}
bunsan=hensa2/n;
printf("%lf\n",sqrt(bunsan));
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174748/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174748/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"%lf\00", align 1
@.str.2 = 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:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%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 %if.end
if.end: ; preds = %entry, %for.end16
%1 = phi i32 [ %19, %for.end16 ], [ %0, %entry ]
%2 = zext i32 %1 to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca double, i64 %2, align 16
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp133 = icmp sgt i32 %4, 0
br i1 %cmp133, label %for.body, label %for.end.thread
for.end.thread: ; preds = %if.end
%conv51 = sitofp i32 %4 to double
br label %for.end16
for.body: ; preds = %if.end, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %if.end ]
%sum.034 = phi double [ %add, %for.body ], [ 0.000000e+00, %if.end ]
%arrayidx = getelementptr inbounds double, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%5 = load double, ptr %arrayidx, align 8, !tbaa !9
%add = fadd double %sum.034, %5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body
%conv = sitofp i32 %6 to double
%div = fdiv double %add, %conv
%cmp637 = icmp sgt i32 %6, 0
br i1 %cmp637, label %for.body8.preheader, label %for.end16
for.body8.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %6 to i64
%xtraiter = and i64 %wide.trip.count, 3
%8 = icmp ult i32 %6, 4
br i1 %8, label %for.end16.loopexit.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body8
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%indvars.iv46 = phi i64 [ 0, %for.body8.preheader.new ], [ %indvars.iv.next47.3, %for.body8 ]
%hensa2.038 = phi double [ 0.000000e+00, %for.body8.preheader.new ], [ %16, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.3, %for.body8 ]
%arrayidx10 = getelementptr inbounds double, ptr %vla, i64 %indvars.iv46
%9 = load double, ptr %arrayidx10, align 16, !tbaa !9
%sub = fsub double %9, %div
%10 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %hensa2.038)
%indvars.iv.next47 = or i64 %indvars.iv46, 1
%arrayidx10.1 = getelementptr inbounds double, ptr %vla, i64 %indvars.iv.next47
%11 = load double, ptr %arrayidx10.1, align 8, !tbaa !9
%sub.1 = fsub double %11, %div
%12 = call double @llvm.fmuladd.f64(double %sub.1, double %sub.1, double %10)
%indvars.iv.next47.1 = or i64 %indvars.iv46, 2
%arrayidx10.2 = getelementptr inbounds double, ptr %vla, i64 %indvars.iv.next47.1
%13 = load double, ptr %arrayidx10.2, align 16, !tbaa !9
%sub.2 = fsub double %13, %div
%14 = call double @llvm.fmuladd.f64(double %sub.2, double %sub.2, double %12)
%indvars.iv.next47.2 = or i64 %indvars.iv46, 3
%arrayidx10.3 = getelementptr inbounds double, ptr %vla, i64 %indvars.iv.next47.2
%15 = load double, ptr %arrayidx10.3, align 8, !tbaa !9
%sub.3 = fsub double %15, %div
%16 = call double @llvm.fmuladd.f64(double %sub.3, double %sub.3, double %14)
%indvars.iv.next47.3 = add nuw nsw i64 %indvars.iv46, 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.body8, !llvm.loop !13
for.end16.loopexit.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%.lcssa57.ph = phi double [ undef, %for.body8.preheader ], [ %16, %for.body8 ]
%indvars.iv46.unr = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next47.3, %for.body8 ]
%hensa2.038.unr = phi double [ 0.000000e+00, %for.body8.preheader ], [ %16, %for.body8 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end16, label %for.body8.epil
for.body8.epil: ; preds = %for.end16.loopexit.unr-lcssa, %for.body8.epil
%indvars.iv46.epil = phi i64 [ %indvars.iv.next47.epil, %for.body8.epil ], [ %indvars.iv46.unr, %for.end16.loopexit.unr-lcssa ]
%hensa2.038.epil = phi double [ %18, %for.body8.epil ], [ %hensa2.038.unr, %for.end16.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body8.epil ], [ 0, %for.end16.loopexit.unr-lcssa ]
%arrayidx10.epil = getelementptr inbounds double, ptr %vla, i64 %indvars.iv46.epil
%17 = load double, ptr %arrayidx10.epil, align 8, !tbaa !9
%sub.epil = fsub double %17, %div
%18 = call double @llvm.fmuladd.f64(double %sub.epil, double %sub.epil, double %hensa2.038.epil)
%indvars.iv.next47.epil = add nuw nsw i64 %indvars.iv46.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.body8.epil, !llvm.loop !14
for.end16: ; preds = %for.end16.loopexit.unr-lcssa, %for.body8.epil, %for.end.thread, %for.end
%conv54 = phi double [ %conv, %for.end ], [ %conv51, %for.end.thread ], [ %conv, %for.body8.epil ], [ %conv, %for.end16.loopexit.unr-lcssa ]
%hensa2.0.lcssa = phi double [ 0.000000e+00, %for.end ], [ 0.000000e+00, %for.end.thread ], [ %.lcssa57.ph, %for.end16.loopexit.unr-lcssa ], [ %18, %for.body8.epil ]
%div18 = fdiv double %hensa2.0.lcssa, %conv54
%call19 = call double @sqrt(double noundef %div18) #6
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %call19)
call void @llvm.stackrestore.p0(ptr %3)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%19 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %19, 0
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %for.end16, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind 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 #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { 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 = { 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 <math.h>
int main(void)
{
int i,n;
double x,mean,poi[1010]={0};
while(scanf("%d",&n)){
x=0;
if(n!=0){
for(i=0;i<n;i++){
scanf("%lf",&poi[i]);
x+=poi[i];
}
mean=x/n;
x=0;
for(i=0;i<n;i++){
x+=pow(poi[i]-mean,2);
}
mean=sqrt(x/n);
printf("%f\n",mean);
}else break;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174791/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174791/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"%lf\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
%poi = alloca [1010 x double], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 8080, ptr nonnull %poi) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8080) %poi, i8 0, i64 8080, i1 false)
%call39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool.not40 = icmp eq i32 %call39, 0
%0 = load i32, ptr %n, align 4
%cmp.not41 = icmp eq i32 %0, 0
%or.cond42 = select i1 %tobool.not40, i1 true, i1 %cmp.not41
br i1 %or.cond42, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end15
%1 = phi i32 [ %11, %for.end15 ], [ %0, %entry ]
%cmp131 = icmp sgt i32 %1, 0
br i1 %cmp131, label %for.body, label %for.end.thread
for.end.thread: ; preds = %for.cond.preheader
%conv50 = sitofp i32 %1 to double
br label %for.end15
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%x.033 = phi double [ %add, %for.body ], [ 0.000000e+00, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [1010 x double], ptr %poi, 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 !5
%add = fadd double %x.033, %2
%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
%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
%conv = sitofp i32 %3 to double
%div = fdiv double %add, %conv
%cmp635 = icmp sgt i32 %3, 0
br i1 %cmp635, label %for.body8.preheader, label %for.end15
for.body8.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.end15.loopexit.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body8
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%indvars.iv45 = phi i64 [ 0, %for.body8.preheader.new ], [ %indvars.iv.next46.3, %for.body8 ]
%x.137 = phi double [ 0.000000e+00, %for.body8.preheader.new ], [ %add12.3, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.3, %for.body8 ]
%arrayidx10 = getelementptr inbounds [1010 x double], ptr %poi, i64 0, i64 %indvars.iv45
%6 = load double, ptr %arrayidx10, align 16, !tbaa !5
%sub = fsub double %6, %div
%square = fmul double %sub, %sub
%add12 = fadd double %x.137, %square
%indvars.iv.next46 = or i64 %indvars.iv45, 1
%arrayidx10.1 = getelementptr inbounds [1010 x double], ptr %poi, i64 0, i64 %indvars.iv.next46
%7 = load double, ptr %arrayidx10.1, align 8, !tbaa !5
%sub.1 = fsub double %7, %div
%square.1 = fmul double %sub.1, %sub.1
%add12.1 = fadd double %add12, %square.1
%indvars.iv.next46.1 = or i64 %indvars.iv45, 2
%arrayidx10.2 = getelementptr inbounds [1010 x double], ptr %poi, i64 0, i64 %indvars.iv.next46.1
%8 = load double, ptr %arrayidx10.2, align 16, !tbaa !5
%sub.2 = fsub double %8, %div
%square.2 = fmul double %sub.2, %sub.2
%add12.2 = fadd double %add12.1, %square.2
%indvars.iv.next46.2 = or i64 %indvars.iv45, 3
%arrayidx10.3 = getelementptr inbounds [1010 x double], ptr %poi, i64 0, i64 %indvars.iv.next46.2
%9 = load double, ptr %arrayidx10.3, align 8, !tbaa !5
%sub.3 = fsub double %9, %div
%square.3 = fmul double %sub.3, %sub.3
%add12.3 = fadd double %add12.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.end15.loopexit.unr-lcssa, label %for.body8, !llvm.loop !13
for.end15.loopexit.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%add12.lcssa.ph = phi double [ undef, %for.body8.preheader ], [ %add12.3, %for.body8 ]
%indvars.iv45.unr = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next46.3, %for.body8 ]
%x.137.unr = phi double [ 0.000000e+00, %for.body8.preheader ], [ %add12.3, %for.body8 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end15, label %for.body8.epil
for.body8.epil: ; preds = %for.end15.loopexit.unr-lcssa, %for.body8.epil
%indvars.iv45.epil = phi i64 [ %indvars.iv.next46.epil, %for.body8.epil ], [ %indvars.iv45.unr, %for.end15.loopexit.unr-lcssa ]
%x.137.epil = phi double [ %add12.epil, %for.body8.epil ], [ %x.137.unr, %for.end15.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body8.epil ], [ 0, %for.end15.loopexit.unr-lcssa ]
%arrayidx10.epil = getelementptr inbounds [1010 x double], ptr %poi, i64 0, i64 %indvars.iv45.epil
%10 = load double, ptr %arrayidx10.epil, align 8, !tbaa !5
%sub.epil = fsub double %10, %div
%square.epil = fmul double %sub.epil, %sub.epil
%add12.epil = fadd double %x.137.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.end15, label %for.body8.epil, !llvm.loop !14
for.end15: ; preds = %for.end15.loopexit.unr-lcssa, %for.body8.epil, %for.end.thread, %for.end
%conv53 = phi double [ %conv, %for.end ], [ %conv50, %for.end.thread ], [ %conv, %for.body8.epil ], [ %conv, %for.end15.loopexit.unr-lcssa ]
%x.1.lcssa = phi double [ 0.000000e+00, %for.end ], [ 0.000000e+00, %for.end.thread ], [ %add12.lcssa.ph, %for.end15.loopexit.unr-lcssa ], [ %add12.epil, %for.body8.epil ]
%div17 = fdiv double %x.1.lcssa, %conv53
%call18 = call double @sqrt(double noundef %div17) #5
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %call18)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool.not = icmp eq i32 %call, 0
%11 = load i32, ptr %n, align 4
%cmp.not = icmp eq i32 %11, 0
%or.cond = select i1 %tobool.not, i1 true, i1 %cmp.not
br i1 %or.cond, label %while.end, label %for.cond.preheader, !llvm.loop !16
while.end: ; preds = %for.end15, %entry
call void @llvm.lifetime.end.p0(i64 8080, ptr nonnull %poi) #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(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 #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(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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !12}
|
#include<stdio.h>
#include<math.h>
int main(){
while(1){
int n,i;
double s[1001]={},m=0.0,a=0.0;
scanf("%d",&n);
if(n==0) break;
for(i=0;i<n;i++){
scanf("%lf",&s[i]);
m +=s[i];
}
m /=n;
for(i=0;i<n;i++){
a += pow(s[i]-m,2);
}
a = sqrt( a/(1.0*n));
printf("%f\n",a);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174841/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174841/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"%lf\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
%s = alloca [1001 x double], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 8008, ptr nonnull %s) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8008) %s, i8 0, i64 8008, i1 false)
%call45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp46 = icmp eq i32 %0, 0
br i1 %cmp46, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %cleanup
%1 = phi i32 [ %11, %cleanup ], [ %0, %entry ]
%cmp137 = icmp sgt i32 %1, 0
br i1 %cmp137, label %for.body, label %for.end.thread
for.end.thread: ; preds = %for.cond.preheader
%conv54 = sitofp i32 %1 to double
br label %cleanup
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%m.039 = phi double [ %add, %for.body ], [ 0.000000e+00, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [1001 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 %m.039, %2
%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 !11
for.end: ; preds = %for.body
%conv = sitofp i32 %3 to double
%div = fdiv double %add, %conv
%cmp641 = icmp sgt i32 %3, 0
br i1 %cmp641, label %for.body8.preheader, label %cleanup
for.body8.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 %cleanup.loopexit.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body8
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%indvars.iv49 = phi i64 [ 0, %for.body8.preheader.new ], [ %indvars.iv.next50.3, %for.body8 ]
%a.043 = phi double [ 0.000000e+00, %for.body8.preheader.new ], [ %add12.3, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.3, %for.body8 ]
%arrayidx10 = getelementptr inbounds [1001 x double], ptr %s, i64 0, i64 %indvars.iv49
%6 = load double, ptr %arrayidx10, align 16, !tbaa !9
%sub = fsub double %6, %div
%square = fmul double %sub, %sub
%add12 = fadd double %a.043, %square
%indvars.iv.next50 = or i64 %indvars.iv49, 1
%arrayidx10.1 = getelementptr inbounds [1001 x double], ptr %s, i64 0, i64 %indvars.iv.next50
%7 = load double, ptr %arrayidx10.1, align 8, !tbaa !9
%sub.1 = fsub double %7, %div
%square.1 = fmul double %sub.1, %sub.1
%add12.1 = fadd double %add12, %square.1
%indvars.iv.next50.1 = or i64 %indvars.iv49, 2
%arrayidx10.2 = getelementptr inbounds [1001 x double], ptr %s, i64 0, i64 %indvars.iv.next50.1
%8 = load double, ptr %arrayidx10.2, align 16, !tbaa !9
%sub.2 = fsub double %8, %div
%square.2 = fmul double %sub.2, %sub.2
%add12.2 = fadd double %add12.1, %square.2
%indvars.iv.next50.2 = or i64 %indvars.iv49, 3
%arrayidx10.3 = getelementptr inbounds [1001 x double], ptr %s, i64 0, i64 %indvars.iv.next50.2
%9 = load double, ptr %arrayidx10.3, align 8, !tbaa !9
%sub.3 = fsub double %9, %div
%square.3 = fmul double %sub.3, %sub.3
%add12.3 = fadd double %add12.2, %square.3
%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 %cleanup.loopexit.unr-lcssa, label %for.body8, !llvm.loop !13
cleanup.loopexit.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%add12.lcssa.ph = phi double [ undef, %for.body8.preheader ], [ %add12.3, %for.body8 ]
%indvars.iv49.unr = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next50.3, %for.body8 ]
%a.043.unr = phi double [ 0.000000e+00, %for.body8.preheader ], [ %add12.3, %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, %for.body8.epil
%indvars.iv49.epil = phi i64 [ %indvars.iv.next50.epil, %for.body8.epil ], [ %indvars.iv49.unr, %cleanup.loopexit.unr-lcssa ]
%a.043.epil = phi double [ %add12.epil, %for.body8.epil ], [ %a.043.unr, %cleanup.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body8.epil ], [ 0, %cleanup.loopexit.unr-lcssa ]
%arrayidx10.epil = getelementptr inbounds [1001 x double], ptr %s, i64 0, i64 %indvars.iv49.epil
%10 = load double, ptr %arrayidx10.epil, align 8, !tbaa !9
%sub.epil = fsub double %10, %div
%square.epil = fmul double %sub.epil, %sub.epil
%add12.epil = fadd double %a.043.epil, %square.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 %cleanup, label %for.body8.epil, !llvm.loop !14
cleanup: ; preds = %cleanup.loopexit.unr-lcssa, %for.body8.epil, %for.end.thread, %for.end
%conv57 = phi double [ %conv, %for.end ], [ %conv54, %for.end.thread ], [ %conv, %for.body8.epil ], [ %conv, %cleanup.loopexit.unr-lcssa ]
%a.0.lcssa = phi double [ 0.000000e+00, %for.end ], [ 0.000000e+00, %for.end.thread ], [ %add12.lcssa.ph, %cleanup.loopexit.unr-lcssa ], [ %add12.epil, %for.body8.epil ]
%div17 = fdiv double %a.0.lcssa, %conv57
%call18 = call double @sqrt(double noundef %div17) #5
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %call18)
call void @llvm.lifetime.end.p0(i64 8008, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 8008, ptr nonnull %s) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8008) %s, i8 0, i64 8008, i1 false)
%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 = %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 8008, 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: 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(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 #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(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 <math.h>
#include <stdio.h>
int main(void){
int n,i;
int s[1001]={0};
double ave,sum;
double var,dev;
do{
sum=var=dev=0;
scanf("%d",&n);
if(n==0)break;
for(i=1; i<=n; i++){
scanf("%d",&s[i]);
sum+=s[i];
}
ave=sum/n;
for(i=1; i<=n; i++){
var+=(double)(s[i]-ave)*(s[i]-ave)/n;
}
dev=sqrt(var);
printf("%lf\n",dev);
}while(1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174892/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174892/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:
%n = alloca i32, align 4
%s = alloca [1001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %s) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4004) %s, i8 0, i64 4004, i1 false)
%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 %do.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end22
%1 = phi i32 [ %10, %for.end22 ], [ %0, %entry ]
%cmp1.not36 = icmp slt i32 %1, 1
br i1 %cmp1.not36, label %for.end22, label %for.body
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %for.cond.preheader ]
%sum.038 = phi double [ %add, %for.body ], [ 0.000000e+00, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [1001 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 %sum.038, %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.not.not = icmp slt i64 %indvars.iv, %4
br i1 %cmp1.not.not, 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
%cmp7.not40 = icmp slt i32 %3, 1
br i1 %cmp7.not40, label %for.end22, label %for.body9.preheader
for.body9.preheader: ; preds = %for.end
%5 = zext i32 %3 to i64
%xtraiter = and i64 %5, 1
%6 = icmp eq i32 %3, 1
br i1 %6, label %for.end22.loopexit.unr-lcssa, label %for.body9.preheader.new
for.body9.preheader.new: ; preds = %for.body9.preheader
%unroll_iter = and i64 %5, 4294967294
br label %for.body9
for.body9: ; preds = %for.body9, %for.body9.preheader.new
%indvars.iv48 = phi i64 [ 1, %for.body9.preheader.new ], [ %indvars.iv.next49.1, %for.body9 ]
%var.042 = phi double [ 0.000000e+00, %for.body9.preheader.new ], [ %add19.1, %for.body9 ]
%niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.1, %for.body9 ]
%arrayidx11 = getelementptr inbounds [1001 x i32], ptr %s, i64 0, i64 %indvars.iv48
%7 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%conv12 = sitofp i32 %7 to double
%sub = fsub double %conv12, %div
%mul = fmul double %sub, %sub
%div18 = fdiv double %mul, %conv5
%add19 = fadd double %var.042, %div18
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%arrayidx11.1 = getelementptr inbounds [1001 x i32], ptr %s, i64 0, i64 %indvars.iv.next49
%8 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5
%conv12.1 = sitofp i32 %8 to double
%sub.1 = fsub double %conv12.1, %div
%mul.1 = fmul double %sub.1, %sub.1
%div18.1 = fdiv double %mul.1, %conv5
%add19.1 = fadd double %add19, %div18.1
%indvars.iv.next49.1 = add nuw nsw i64 %indvars.iv48, 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.end22.loopexit.unr-lcssa, label %for.body9, !llvm.loop !11
for.end22.loopexit.unr-lcssa: ; preds = %for.body9, %for.body9.preheader
%add19.lcssa.ph = phi double [ undef, %for.body9.preheader ], [ %add19.1, %for.body9 ]
%indvars.iv48.unr = phi i64 [ 1, %for.body9.preheader ], [ %indvars.iv.next49.1, %for.body9 ]
%var.042.unr = phi double [ 0.000000e+00, %for.body9.preheader ], [ %add19.1, %for.body9 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end22, label %for.body9.epil
for.body9.epil: ; preds = %for.end22.loopexit.unr-lcssa
%arrayidx11.epil = getelementptr inbounds [1001 x i32], ptr %s, i64 0, i64 %indvars.iv48.unr
%9 = load i32, ptr %arrayidx11.epil, align 4, !tbaa !5
%conv12.epil = sitofp i32 %9 to double
%sub.epil = fsub double %conv12.epil, %div
%mul.epil = fmul double %sub.epil, %sub.epil
%div18.epil = fdiv double %mul.epil, %conv5
%add19.epil = fadd double %var.042.unr, %div18.epil
br label %for.end22
for.end22: ; preds = %for.body9.epil, %for.end22.loopexit.unr-lcssa, %for.cond.preheader, %for.end
%var.0.lcssa = phi double [ 0.000000e+00, %for.end ], [ 0.000000e+00, %for.cond.preheader ], [ %add19.lcssa.ph, %for.end22.loopexit.unr-lcssa ], [ %add19.epil, %for.body9.epil ]
%call23 = call double @sqrt(double noundef %var.0.lcssa) #5
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call23)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%10 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %10, 0
br i1 %cmp, label %do.end, label %for.cond.preheader
do.end: ; preds = %for.end22, %entry
call void @llvm.lifetime.end.p0(i64 4004, 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: 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(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 #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(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}
|
#include<stdio.h>
#include<math.h>
int main(){
int i, n;
double ave, date[1001] = {}, sum, r;
for(;scanf("%d", &n),n != 0; sum = 0, ave = 0, r = 0){
for( i = 0; i < n; i++ ){
scanf("%lf", &date[i]);
sum += date[i];
}
ave = sum / n;
for( i = 0, sum = 0; i < n; i++ ){
sum += ( date[i] - ave ) * ( date[i] - ave );
}
r = sqrt( sum / n );
printf("%f\n", r);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174935/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174935/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"%lf\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
%date = alloca [1001 x double], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 8008, ptr nonnull %date) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8008) %date, i8 0, i64 8008, i1 false)
%call45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not46 = icmp eq i32 %0, 0
br i1 %cmp.not46, label %for.end24, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.end18
%1 = phi i32 [ %16, %for.end18 ], [ %0, %entry ]
%cmp237 = icmp sgt i32 %1, 0
br i1 %cmp237, label %for.body3, label %for.end.thread
for.end.thread: ; preds = %for.cond1.preheader
%conv55 = sitofp i32 %1 to double
br label %for.end18
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 0, %for.cond1.preheader ]
%sum.138 = phi double [ %add, %for.body3 ], [ 0.000000e+00, %for.cond1.preheader ]
%arrayidx = getelementptr inbounds [1001 x double], ptr %date, i64 0, i64 %indvars.iv
%call4 = 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 %sum.138, %2
%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.body3, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body3
%conv = sitofp i32 %3 to double
%div = fdiv double %add, %conv
%cmp841 = icmp sgt i32 %3, 0
br i1 %cmp841, label %for.body10.preheader, label %for.end18
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.end18.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.iv50 = phi i64 [ 0, %for.body10.preheader.new ], [ %indvars.iv.next51.3, %for.body10 ]
%sum.242 = 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 [1001 x double], ptr %date, i64 0, i64 %indvars.iv50
%6 = load double, ptr %arrayidx12, align 16, !tbaa !9
%sub = fsub double %6, %div
%7 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %sum.242)
%indvars.iv.next51 = or i64 %indvars.iv50, 1
%arrayidx12.1 = getelementptr inbounds [1001 x double], ptr %date, i64 0, i64 %indvars.iv.next51
%8 = load double, ptr %arrayidx12.1, align 8, !tbaa !9
%sub.1 = fsub double %8, %div
%9 = call double @llvm.fmuladd.f64(double %sub.1, double %sub.1, double %7)
%indvars.iv.next51.1 = or i64 %indvars.iv50, 2
%arrayidx12.2 = getelementptr inbounds [1001 x double], ptr %date, i64 0, i64 %indvars.iv.next51.1
%10 = load double, ptr %arrayidx12.2, align 16, !tbaa !9
%sub.2 = fsub double %10, %div
%11 = call double @llvm.fmuladd.f64(double %sub.2, double %sub.2, double %9)
%indvars.iv.next51.2 = or i64 %indvars.iv50, 3
%arrayidx12.3 = getelementptr inbounds [1001 x double], ptr %date, i64 0, i64 %indvars.iv.next51.2
%12 = load double, ptr %arrayidx12.3, align 8, !tbaa !9
%sub.3 = fsub double %12, %div
%13 = call double @llvm.fmuladd.f64(double %sub.3, double %sub.3, double %11)
%indvars.iv.next51.3 = add nuw nsw i64 %indvars.iv50, 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.end18.loopexit.unr-lcssa, label %for.body10, !llvm.loop !13
for.end18.loopexit.unr-lcssa: ; preds = %for.body10, %for.body10.preheader
%.lcssa61.ph = phi double [ undef, %for.body10.preheader ], [ %13, %for.body10 ]
%indvars.iv50.unr = phi i64 [ 0, %for.body10.preheader ], [ %indvars.iv.next51.3, %for.body10 ]
%sum.242.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.end18, label %for.body10.epil
for.body10.epil: ; preds = %for.end18.loopexit.unr-lcssa, %for.body10.epil
%indvars.iv50.epil = phi i64 [ %indvars.iv.next51.epil, %for.body10.epil ], [ %indvars.iv50.unr, %for.end18.loopexit.unr-lcssa ]
%sum.242.epil = phi double [ %15, %for.body10.epil ], [ %sum.242.unr, %for.end18.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body10.epil ], [ 0, %for.end18.loopexit.unr-lcssa ]
%arrayidx12.epil = getelementptr inbounds [1001 x double], ptr %date, i64 0, i64 %indvars.iv50.epil
%14 = load double, ptr %arrayidx12.epil, align 8, !tbaa !9
%sub.epil = fsub double %14, %div
%15 = call double @llvm.fmuladd.f64(double %sub.epil, double %sub.epil, double %sum.242.epil)
%indvars.iv.next51.epil = add nuw nsw i64 %indvars.iv50.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.end18, label %for.body10.epil, !llvm.loop !14
for.end18: ; preds = %for.end18.loopexit.unr-lcssa, %for.body10.epil, %for.end.thread, %for.end
%conv58 = phi double [ %conv, %for.end ], [ %conv55, %for.end.thread ], [ %conv, %for.body10.epil ], [ %conv, %for.end18.loopexit.unr-lcssa ]
%sum.2.lcssa = phi double [ 0.000000e+00, %for.end ], [ 0.000000e+00, %for.end.thread ], [ %.lcssa61.ph, %for.end18.loopexit.unr-lcssa ], [ %15, %for.body10.epil ]
%div20 = fdiv double %sum.2.lcssa, %conv58
%call21 = call double @sqrt(double noundef %div20) #6
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %call21)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%16 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not = icmp eq i32 %16, 0
br i1 %cmp.not, label %for.end24, label %for.cond1.preheader, !llvm.loop !16
for.end24: ; preds = %for.end18, %entry
call void @llvm.lifetime.end.p0(i64 8008, ptr nonnull %date) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare 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 #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 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 = { 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"}
!16 = distinct !{!16, !12}
|
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
double stdev(int *scores, int n)
{
double mean = 0;
int i;
for (i = 0; i < n; i++)
mean += scores[i];
mean /= n;
double variance = 0;
for (i = 0; i < n; i++)
variance += pow(scores[i] - mean, 2);
variance /= n;
return sqrt(variance);
}
int main(void)
{
int n, i;
while (1)
{
scanf(" %d", &n);
if (!n)
return 0;
int *scores = (int *) malloc(sizeof(int[n]));
for (i = 0; i < n; i++)
scanf(" %d", scores + i);
printf("%lf\n", stdev(scores, n));
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_174979/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_174979/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 [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind memory(write, argmem: readwrite) uwtable
define dso_local double @stdev(ptr nocapture noundef readonly %scores, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp29 = icmp sgt i32 %n, 0
br i1 %cmp29, label %for.body.preheader, label %for.end.thread
for.end.thread: ; preds = %entry
%conv143 = sitofp i32 %n to double
br label %for.end12
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%xtraiter = and i64 %wide.trip.count, 3
%0 = icmp ult i32 %n, 4
br i1 %0, label %for.end.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%mean.030 = phi double [ 0.000000e+00, %for.body.preheader.new ], [ %add.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %scores, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%conv = sitofp i32 %1 to double
%add = fadd double %mean.030, %conv
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %scores, i64 %indvars.iv.next
%2 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%conv.1 = sitofp i32 %2 to double
%add.1 = fadd double %add, %conv.1
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds i32, ptr %scores, i64 %indvars.iv.next.1
%3 = load i32, ptr %arrayidx.2, align 4, !tbaa !5
%conv.2 = sitofp i32 %3 to double
%add.2 = fadd double %add.1, %conv.2
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds i32, ptr %scores, i64 %indvars.iv.next.2
%4 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%conv.3 = sitofp i32 %4 to double
%add.3 = fadd double %add.2, %conv.3
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.end.unr-lcssa, label %for.body, !llvm.loop !9
for.end.unr-lcssa: ; preds = %for.body, %for.body.preheader
%add.lcssa.ph = phi double [ undef, %for.body.preheader ], [ %add.3, %for.body ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%mean.030.unr = phi double [ 0.000000e+00, %for.body.preheader ], [ %add.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.end.unr-lcssa ]
%mean.030.epil = phi double [ %add.epil, %for.body.epil ], [ %mean.030.unr, %for.end.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds i32, ptr %scores, i64 %indvars.iv.epil
%5 = load i32, ptr %arrayidx.epil, align 4, !tbaa !5
%conv.epil = sitofp i32 %5 to double
%add.epil = fadd double %mean.030.epil, %conv.epil
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !11
for.end: ; preds = %for.body.epil, %for.end.unr-lcssa
%add.lcssa = phi double [ %add.lcssa.ph, %for.end.unr-lcssa ], [ %add.epil, %for.body.epil ]
%conv1 = sitofp i32 %n to double
%div = fdiv double %add.lcssa, %conv1
br i1 %cmp29, label %for.body5.preheader, label %for.end12
for.body5.preheader: ; preds = %for.end
%xtraiter47 = and i64 %wide.trip.count, 3
%6 = icmp ult i32 %n, 4
br i1 %6, label %for.end12.loopexit.unr-lcssa, label %for.body5.preheader.new
for.body5.preheader.new: ; preds = %for.body5.preheader
%unroll_iter51 = and i64 %wide.trip.count, 4294967292
br label %for.body5
for.body5: ; preds = %for.body5, %for.body5.preheader.new
%indvars.iv37 = phi i64 [ 0, %for.body5.preheader.new ], [ %indvars.iv.next38.3, %for.body5 ]
%variance.034 = phi double [ 0.000000e+00, %for.body5.preheader.new ], [ %add9.3, %for.body5 ]
%niter52 = phi i64 [ 0, %for.body5.preheader.new ], [ %niter52.next.3, %for.body5 ]
%arrayidx7 = getelementptr inbounds i32, ptr %scores, i64 %indvars.iv37
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%conv8 = sitofp i32 %7 to double
%sub = fsub double %conv8, %div
%square = fmul double %sub, %sub
%add9 = fadd double %variance.034, %square
%indvars.iv.next38 = or i64 %indvars.iv37, 1
%arrayidx7.1 = getelementptr inbounds i32, ptr %scores, i64 %indvars.iv.next38
%8 = load i32, ptr %arrayidx7.1, align 4, !tbaa !5
%conv8.1 = sitofp i32 %8 to double
%sub.1 = fsub double %conv8.1, %div
%square.1 = fmul double %sub.1, %sub.1
%add9.1 = fadd double %add9, %square.1
%indvars.iv.next38.1 = or i64 %indvars.iv37, 2
%arrayidx7.2 = getelementptr inbounds i32, ptr %scores, i64 %indvars.iv.next38.1
%9 = load i32, ptr %arrayidx7.2, align 4, !tbaa !5
%conv8.2 = sitofp i32 %9 to double
%sub.2 = fsub double %conv8.2, %div
%square.2 = fmul double %sub.2, %sub.2
%add9.2 = fadd double %add9.1, %square.2
%indvars.iv.next38.2 = or i64 %indvars.iv37, 3
%arrayidx7.3 = getelementptr inbounds i32, ptr %scores, i64 %indvars.iv.next38.2
%10 = load i32, ptr %arrayidx7.3, align 4, !tbaa !5
%conv8.3 = sitofp i32 %10 to double
%sub.3 = fsub double %conv8.3, %div
%square.3 = fmul double %sub.3, %sub.3
%add9.3 = fadd double %add9.2, %square.3
%indvars.iv.next38.3 = add nuw nsw i64 %indvars.iv37, 4
%niter52.next.3 = add i64 %niter52, 4
%niter52.ncmp.3 = icmp eq i64 %niter52.next.3, %unroll_iter51
br i1 %niter52.ncmp.3, label %for.end12.loopexit.unr-lcssa, label %for.body5, !llvm.loop !13
for.end12.loopexit.unr-lcssa: ; preds = %for.body5, %for.body5.preheader
%add9.lcssa.ph = phi double [ undef, %for.body5.preheader ], [ %add9.3, %for.body5 ]
%indvars.iv37.unr = phi i64 [ 0, %for.body5.preheader ], [ %indvars.iv.next38.3, %for.body5 ]
%variance.034.unr = phi double [ 0.000000e+00, %for.body5.preheader ], [ %add9.3, %for.body5 ]
%lcmp.mod49.not = icmp eq i64 %xtraiter47, 0
br i1 %lcmp.mod49.not, label %for.end12, label %for.body5.epil
for.body5.epil: ; preds = %for.end12.loopexit.unr-lcssa, %for.body5.epil
%indvars.iv37.epil = phi i64 [ %indvars.iv.next38.epil, %for.body5.epil ], [ %indvars.iv37.unr, %for.end12.loopexit.unr-lcssa ]
%variance.034.epil = phi double [ %add9.epil, %for.body5.epil ], [ %variance.034.unr, %for.end12.loopexit.unr-lcssa ]
%epil.iter48 = phi i64 [ %epil.iter48.next, %for.body5.epil ], [ 0, %for.end12.loopexit.unr-lcssa ]
%arrayidx7.epil = getelementptr inbounds i32, ptr %scores, i64 %indvars.iv37.epil
%11 = load i32, ptr %arrayidx7.epil, align 4, !tbaa !5
%conv8.epil = sitofp i32 %11 to double
%sub.epil = fsub double %conv8.epil, %div
%square.epil = fmul double %sub.epil, %sub.epil
%add9.epil = fadd double %variance.034.epil, %square.epil
%indvars.iv.next38.epil = add nuw nsw i64 %indvars.iv37.epil, 1
%epil.iter48.next = add i64 %epil.iter48, 1
%epil.iter48.cmp.not = icmp eq i64 %epil.iter48.next, %xtraiter47
br i1 %epil.iter48.cmp.not, label %for.end12, label %for.body5.epil, !llvm.loop !14
for.end12: ; preds = %for.end12.loopexit.unr-lcssa, %for.body5.epil, %for.end.thread, %for.end
%conv145 = phi double [ %conv1, %for.end ], [ %conv143, %for.end.thread ], [ %conv1, %for.body5.epil ], [ %conv1, %for.end12.loopexit.unr-lcssa ]
%variance.0.lcssa = phi double [ 0.000000e+00, %for.end ], [ 0.000000e+00, %for.end.thread ], [ %add9.lcssa.ph, %for.end12.loopexit.unr-lcssa ], [ %add9.epil, %for.body5.epil ]
%div14 = fdiv double %variance.0.lcssa, %conv145
%call15 = tail call double @sqrt(double noundef %div14) #6
ret double %call15
}
; 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(write)
declare double @sqrt(double 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:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not12 = icmp eq i32 %0, 0
br i1 %tobool.not12, label %if.then, label %if.end
if.then: ; preds = %stdev.exit, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
if.end: ; preds = %entry, %stdev.exit
%1 = phi i32 [ %18, %stdev.exit ], [ %0, %entry ]
%2 = zext i32 %1 to i64
%3 = shl nuw nsw i64 %2, 2
%call1 = call noalias ptr @malloc(i64 noundef %3) #7
%cmp9 = icmp sgt i32 %1, 0
br i1 %cmp9, label %for.body, label %for.end.thread.i
for.body: ; preds = %if.end, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %if.end ]
%add.ptr = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %add.ptr)
%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 !15
for.end: ; preds = %for.body
%cmp29.i = icmp sgt i32 %4, 0
br i1 %cmp29.i, label %for.body.preheader.i, label %for.end.thread.i
for.end.thread.i: ; preds = %if.end, %for.end
%.lcssa17 = phi i32 [ %4, %for.end ], [ %1, %if.end ]
%conv143.i = sitofp i32 %.lcssa17 to double
br label %stdev.exit
for.body.preheader.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count.i, 3
%6 = icmp ult i32 %4, 4
br i1 %6, label %for.body5.preheader.i.unr-lcssa, label %for.body.preheader.i.new
for.body.preheader.i.new: ; preds = %for.body.preheader.i
%unroll_iter = and i64 %wide.trip.count.i, 4294967292
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i.new ], [ %indvars.iv.next.i.3, %for.body.i ]
%mean.030.i = phi double [ 0.000000e+00, %for.body.preheader.i.new ], [ %add.i.3, %for.body.i ]
%niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.3, %for.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.i
%7 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%conv.i = sitofp i32 %7 to double
%add.i = fadd double %mean.030.i, %conv.i
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next.i
%8 = load i32, ptr %arrayidx.i.1, align 4, !tbaa !5
%conv.i.1 = sitofp i32 %8 to double
%add.i.1 = fadd double %add.i, %conv.i.1
%indvars.iv.next.i.1 = or i64 %indvars.iv.i, 2
%arrayidx.i.2 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next.i.1
%9 = load i32, ptr %arrayidx.i.2, align 4, !tbaa !5
%conv.i.2 = sitofp i32 %9 to double
%add.i.2 = fadd double %add.i.1, %conv.i.2
%indvars.iv.next.i.2 = or i64 %indvars.iv.i, 3
%arrayidx.i.3 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next.i.2
%10 = load i32, ptr %arrayidx.i.3, align 4, !tbaa !5
%conv.i.3 = sitofp i32 %10 to double
%add.i.3 = fadd double %add.i.2, %conv.i.3
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 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.body5.preheader.i.unr-lcssa, label %for.body.i, !llvm.loop !9
for.body5.preheader.i.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i
%add.i.lcssa.ph = phi double [ undef, %for.body.preheader.i ], [ %add.i.3, %for.body.i ]
%indvars.iv.i.unr = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i.3, %for.body.i ]
%mean.030.i.unr = phi double [ 0.000000e+00, %for.body.preheader.i ], [ %add.i.3, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body5.preheader.i, label %for.body.i.epil
for.body.i.epil: ; preds = %for.body5.preheader.i.unr-lcssa, %for.body.i.epil
%indvars.iv.i.epil = phi i64 [ %indvars.iv.next.i.epil, %for.body.i.epil ], [ %indvars.iv.i.unr, %for.body5.preheader.i.unr-lcssa ]
%mean.030.i.epil = phi double [ %add.i.epil, %for.body.i.epil ], [ %mean.030.i.unr, %for.body5.preheader.i.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i.epil ], [ 0, %for.body5.preheader.i.unr-lcssa ]
%arrayidx.i.epil = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.i.epil
%11 = load i32, ptr %arrayidx.i.epil, align 4, !tbaa !5
%conv.i.epil = sitofp i32 %11 to double
%add.i.epil = fadd double %mean.030.i.epil, %conv.i.epil
%indvars.iv.next.i.epil = add nuw nsw i64 %indvars.iv.i.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.body5.preheader.i, label %for.body.i.epil, !llvm.loop !16
for.body5.preheader.i: ; preds = %for.body.i.epil, %for.body5.preheader.i.unr-lcssa
%add.i.lcssa = phi double [ %add.i.lcssa.ph, %for.body5.preheader.i.unr-lcssa ], [ %add.i.epil, %for.body.i.epil ]
%conv1.i = sitofp i32 %4 to double
%div.i = fdiv double %add.i.lcssa, %conv1.i
%xtraiter19 = and i64 %wide.trip.count.i, 3
%12 = icmp ult i32 %4, 4
br i1 %12, label %stdev.exit.loopexit.unr-lcssa, label %for.body5.preheader.i.new
for.body5.preheader.i.new: ; preds = %for.body5.preheader.i
%unroll_iter23 = and i64 %wide.trip.count.i, 4294967292
br label %for.body5.i
for.body5.i: ; preds = %for.body5.i, %for.body5.preheader.i.new
%indvars.iv37.i = phi i64 [ 0, %for.body5.preheader.i.new ], [ %indvars.iv.next38.i.3, %for.body5.i ]
%variance.034.i = phi double [ 0.000000e+00, %for.body5.preheader.i.new ], [ %add9.i.3, %for.body5.i ]
%niter24 = phi i64 [ 0, %for.body5.preheader.i.new ], [ %niter24.next.3, %for.body5.i ]
%arrayidx7.i = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv37.i
%13 = load i32, ptr %arrayidx7.i, align 4, !tbaa !5
%conv8.i = sitofp i32 %13 to double
%sub.i = fsub double %conv8.i, %div.i
%square.i = fmul double %sub.i, %sub.i
%add9.i = fadd double %variance.034.i, %square.i
%indvars.iv.next38.i = or i64 %indvars.iv37.i, 1
%arrayidx7.i.1 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next38.i
%14 = load i32, ptr %arrayidx7.i.1, align 4, !tbaa !5
%conv8.i.1 = sitofp i32 %14 to double
%sub.i.1 = fsub double %conv8.i.1, %div.i
%square.i.1 = fmul double %sub.i.1, %sub.i.1
%add9.i.1 = fadd double %add9.i, %square.i.1
%indvars.iv.next38.i.1 = or i64 %indvars.iv37.i, 2
%arrayidx7.i.2 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next38.i.1
%15 = load i32, ptr %arrayidx7.i.2, align 4, !tbaa !5
%conv8.i.2 = sitofp i32 %15 to double
%sub.i.2 = fsub double %conv8.i.2, %div.i
%square.i.2 = fmul double %sub.i.2, %sub.i.2
%add9.i.2 = fadd double %add9.i.1, %square.i.2
%indvars.iv.next38.i.2 = or i64 %indvars.iv37.i, 3
%arrayidx7.i.3 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next38.i.2
%16 = load i32, ptr %arrayidx7.i.3, align 4, !tbaa !5
%conv8.i.3 = sitofp i32 %16 to double
%sub.i.3 = fsub double %conv8.i.3, %div.i
%square.i.3 = fmul double %sub.i.3, %sub.i.3
%add9.i.3 = fadd double %add9.i.2, %square.i.3
%indvars.iv.next38.i.3 = add nuw nsw i64 %indvars.iv37.i, 4
%niter24.next.3 = add i64 %niter24, 4
%niter24.ncmp.3 = icmp eq i64 %niter24.next.3, %unroll_iter23
br i1 %niter24.ncmp.3, label %stdev.exit.loopexit.unr-lcssa, label %for.body5.i, !llvm.loop !13
stdev.exit.loopexit.unr-lcssa: ; preds = %for.body5.i, %for.body5.preheader.i
%add9.i.lcssa.ph = phi double [ undef, %for.body5.preheader.i ], [ %add9.i.3, %for.body5.i ]
%indvars.iv37.i.unr = phi i64 [ 0, %for.body5.preheader.i ], [ %indvars.iv.next38.i.3, %for.body5.i ]
%variance.034.i.unr = phi double [ 0.000000e+00, %for.body5.preheader.i ], [ %add9.i.3, %for.body5.i ]
%lcmp.mod21.not = icmp eq i64 %xtraiter19, 0
br i1 %lcmp.mod21.not, label %stdev.exit, label %for.body5.i.epil
for.body5.i.epil: ; preds = %stdev.exit.loopexit.unr-lcssa, %for.body5.i.epil
%indvars.iv37.i.epil = phi i64 [ %indvars.iv.next38.i.epil, %for.body5.i.epil ], [ %indvars.iv37.i.unr, %stdev.exit.loopexit.unr-lcssa ]
%variance.034.i.epil = phi double [ %add9.i.epil, %for.body5.i.epil ], [ %variance.034.i.unr, %stdev.exit.loopexit.unr-lcssa ]
%epil.iter20 = phi i64 [ %epil.iter20.next, %for.body5.i.epil ], [ 0, %stdev.exit.loopexit.unr-lcssa ]
%arrayidx7.i.epil = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv37.i.epil
%17 = load i32, ptr %arrayidx7.i.epil, align 4, !tbaa !5
%conv8.i.epil = sitofp i32 %17 to double
%sub.i.epil = fsub double %conv8.i.epil, %div.i
%square.i.epil = fmul double %sub.i.epil, %sub.i.epil
%add9.i.epil = fadd double %variance.034.i.epil, %square.i.epil
%indvars.iv.next38.i.epil = add nuw nsw i64 %indvars.iv37.i.epil, 1
%epil.iter20.next = add i64 %epil.iter20, 1
%epil.iter20.cmp.not = icmp eq i64 %epil.iter20.next, %xtraiter19
br i1 %epil.iter20.cmp.not, label %stdev.exit, label %for.body5.i.epil, !llvm.loop !17
stdev.exit: ; preds = %stdev.exit.loopexit.unr-lcssa, %for.body5.i.epil, %for.end.thread.i
%conv145.i = phi double [ %conv143.i, %for.end.thread.i ], [ %conv1.i, %for.body5.i.epil ], [ %conv1.i, %stdev.exit.loopexit.unr-lcssa ]
%variance.0.lcssa.i = phi double [ 0.000000e+00, %for.end.thread.i ], [ %add9.i.lcssa.ph, %stdev.exit.loopexit.unr-lcssa ], [ %add9.i.epil, %for.body5.i.epil ]
%div14.i = fdiv double %variance.0.lcssa.i, %conv145.i
%call15.i = call double @sqrt(double noundef %div14.i) #6
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call15.i)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%18 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %18, 0
br i1 %tobool.not, label %if.then, label %if.end
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree nounwind memory(write, 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(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 #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 = { 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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
|
#include <stdio.h>
#include <math.h>
int main(void)
{
int i, n, s[1000];
double sum, ave, squ, sig, bun;
while(1) {
scanf("%d", &n);
if (n == 0)
break;
sum = 0, ave = 0, squ = 0, sig = 0, bun = 0;
for (i = 0; i < n; i++) {
scanf("%d", &s[i]);
sum += s[i];
}
ave = sum / n;
for (i = 0; i < n; i++) {
squ = (s[i] - ave) * (s[i] - ave);
sig += squ;
}
bun = sig / n;
printf("%f\n", sqrt(bun));
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175028/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175028/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
%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.end20
%1 = phi i32 [ %11, %for.end20 ], [ %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
%conv553 = sitofp i32 %1 to double
br label %for.end20
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%sum.038 = 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 %sum.038, %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.end20
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.end20.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.iv48 = phi i64 [ 0, %for.body9.preheader.new ], [ %indvars.iv.next49.3, %for.body9 ]
%sig.042 = phi double [ 0.000000e+00, %for.body9.preheader.new ], [ %add17.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.iv48
%6 = load i32, ptr %arrayidx11, align 16, !tbaa !5
%conv12 = sitofp i32 %6 to double
%sub = fsub double %conv12, %div
%mul = fmul double %sub, %sub
%add17 = fadd double %sig.042, %mul
%indvars.iv.next49 = or i64 %indvars.iv48, 1
%arrayidx11.1 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next49
%7 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5
%conv12.1 = sitofp i32 %7 to double
%sub.1 = fsub double %conv12.1, %div
%mul.1 = fmul double %sub.1, %sub.1
%add17.1 = fadd double %add17, %mul.1
%indvars.iv.next49.1 = or i64 %indvars.iv48, 2
%arrayidx11.2 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next49.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
%mul.2 = fmul double %sub.2, %sub.2
%add17.2 = fadd double %add17.1, %mul.2
%indvars.iv.next49.2 = or i64 %indvars.iv48, 3
%arrayidx11.3 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next49.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
%mul.3 = fmul double %sub.3, %sub.3
%add17.3 = fadd double %add17.2, %mul.3
%indvars.iv.next49.3 = add nuw nsw i64 %indvars.iv48, 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.end20.loopexit.unr-lcssa, label %for.body9, !llvm.loop !11
for.end20.loopexit.unr-lcssa: ; preds = %for.body9, %for.body9.preheader
%add17.lcssa.ph = phi double [ undef, %for.body9.preheader ], [ %add17.3, %for.body9 ]
%indvars.iv48.unr = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next49.3, %for.body9 ]
%sig.042.unr = phi double [ 0.000000e+00, %for.body9.preheader ], [ %add17.3, %for.body9 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end20, label %for.body9.epil
for.body9.epil: ; preds = %for.end20.loopexit.unr-lcssa, %for.body9.epil
%indvars.iv48.epil = phi i64 [ %indvars.iv.next49.epil, %for.body9.epil ], [ %indvars.iv48.unr, %for.end20.loopexit.unr-lcssa ]
%sig.042.epil = phi double [ %add17.epil, %for.body9.epil ], [ %sig.042.unr, %for.end20.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body9.epil ], [ 0, %for.end20.loopexit.unr-lcssa ]
%arrayidx11.epil = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv48.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
%mul.epil = fmul double %sub.epil, %sub.epil
%add17.epil = fadd double %sig.042.epil, %mul.epil
%indvars.iv.next49.epil = add nuw nsw i64 %indvars.iv48.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.end20, label %for.body9.epil, !llvm.loop !12
for.end20: ; preds = %for.end20.loopexit.unr-lcssa, %for.body9.epil, %for.end.thread, %for.end
%conv556 = phi double [ %conv5, %for.end ], [ %conv553, %for.end.thread ], [ %conv5, %for.body9.epil ], [ %conv5, %for.end20.loopexit.unr-lcssa ]
%sig.0.lcssa = phi double [ 0.000000e+00, %for.end ], [ 0.000000e+00, %for.end.thread ], [ %add17.lcssa.ph, %for.end20.loopexit.unr-lcssa ], [ %add17.epil, %for.body9.epil ]
%div22 = fdiv double %sig.0.lcssa, %conv556
%call23 = call double @sqrt(double noundef %div22) #4
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call23)
%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.end20, %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: 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 = { 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"}
|
/*氏名:保坂優介, 学籍番号:200441141
概要:*/
#include<stdio.h>
#include<math.h>
int main(void)
{
int i, j, k, n, s[1000];
scanf("%d", &n);
while (n != 0)
{
double m = 0, a = 0;
for (i = 0; i < n; i++)
{
scanf("%d", &s[i]);
m = m + (double)s[i];
}
m = m / (double)n;
for (i = 0; i < n; i++)
{
a = a + pow(((double)s[i] - m), 2);
}
a = sqrt(a / (double)n);
printf("%lf\n", a);
scanf("%d", &n);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175071/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175071/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:
%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
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not42 = icmp eq i32 %0, 0
br i1 %cmp.not42, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end17
%1 = phi i32 [ %11, %for.end17 ], [ %0, %entry ]
%cmp134 = icmp sgt i32 %1, 0
br i1 %cmp134, 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.036 = 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.036, %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
%cmp738 = icmp sgt i32 %3, 0
br i1 %cmp738, 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 ]
%a.040 = 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 %a.040, %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 ]
%a.040.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 ]
%a.040.epil = phi double [ %add14.epil, %for.body9.epil ], [ %a.040.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 %a.040.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 ]
%a.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 %a.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)
%call22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%11 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not = icmp eq i32 %11, 0
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !14
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"}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#include<math.h>
int main()
{
int i,n,x[1001],sum;
double sd,v,m;
while(1)
{
scanf("%d",&n);
if(n==0)
break;
sd=0;
sum=0;
v=0;
for(i=0; i<n; i++)
{
scanf("%d",&x[i]);
sum+=x[i];
}
m=(double)sum/n;
for(i=0; i<n; i++)
{
v+=((x[i]-m)*(x[i]-m));
}
sd=sqrt(v/n);
printf("%.8lf\n",sd);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175114/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175114/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
%x = alloca [1001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %x) #5
%call43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp44 = icmp eq i32 %0, 0
br i1 %cmp44, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end19
%1 = phi i32 [ %16, %for.end19 ], [ %0, %entry ]
%cmp135 = icmp sgt i32 %1, 0
br i1 %cmp135, 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.036 = phi i32 [ %add, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [1001 x i32], ptr %x, 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
%add = add nsw i32 %2, %sum.036
%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
%conv = sitofp i32 %add to double
%conv5 = sitofp i32 %3 to double
%div = fdiv double %conv, %conv5
%cmp739 = icmp sgt i32 %3, 0
br i1 %cmp739, 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.iv48 = phi i64 [ 0, %for.body9.preheader.new ], [ %indvars.iv.next49.3, %for.body9 ]
%v.040 = 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 [1001 x i32], ptr %x, i64 0, i64 %indvars.iv48
%6 = load i32, ptr %arrayidx11, align 16, !tbaa !5
%conv12 = sitofp i32 %6 to double
%sub = fsub double %conv12, %div
%7 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %v.040)
%indvars.iv.next49 = or i64 %indvars.iv48, 1
%arrayidx11.1 = getelementptr inbounds [1001 x i32], ptr %x, i64 0, i64 %indvars.iv.next49
%8 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5
%conv12.1 = sitofp i32 %8 to double
%sub.1 = fsub double %conv12.1, %div
%9 = call double @llvm.fmuladd.f64(double %sub.1, double %sub.1, double %7)
%indvars.iv.next49.1 = or i64 %indvars.iv48, 2
%arrayidx11.2 = getelementptr inbounds [1001 x i32], ptr %x, i64 0, i64 %indvars.iv.next49.1
%10 = load i32, ptr %arrayidx11.2, align 8, !tbaa !5
%conv12.2 = sitofp i32 %10 to double
%sub.2 = fsub double %conv12.2, %div
%11 = call double @llvm.fmuladd.f64(double %sub.2, double %sub.2, double %9)
%indvars.iv.next49.2 = or i64 %indvars.iv48, 3
%arrayidx11.3 = getelementptr inbounds [1001 x i32], ptr %x, i64 0, i64 %indvars.iv.next49.2
%12 = load i32, ptr %arrayidx11.3, align 4, !tbaa !5
%conv12.3 = sitofp i32 %12 to double
%sub.3 = fsub double %conv12.3, %div
%13 = call double @llvm.fmuladd.f64(double %sub.3, double %sub.3, double %11)
%indvars.iv.next49.3 = add nuw nsw i64 %indvars.iv48, 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.iv48.unr = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next49.3, %for.body9 ]
%v.040.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.iv48.epil = phi i64 [ %indvars.iv.next49.epil, %for.body9.epil ], [ %indvars.iv48.unr, %for.end19.loopexit.unr-lcssa ]
%v.040.epil = phi double [ %15, %for.body9.epil ], [ %v.040.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 [1001 x i32], ptr %x, i64 0, i64 %indvars.iv48.epil
%14 = load i32, ptr %arrayidx11.epil, align 4, !tbaa !5
%conv12.epil = sitofp i32 %14 to double
%sub.epil = fsub double %conv12.epil, %div
%15 = call double @llvm.fmuladd.f64(double %sub.epil, double %sub.epil, double %v.040.epil)
%indvars.iv.next49.epil = add nuw nsw i64 %indvars.iv48.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 ]
%v.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 %v.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 4004, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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"}
|
#include <stdio.h>
#include <math.h>
int main(void)
{
double s[1000],t1,t2;
int n,i;
while(1){
scanf("%d",&n);
if(n==0)break;
t1=0;
for(i=0;i<n;i++){
scanf("%lf",&s[i]);
t1+=s[i];
}
t1/=n;
t2=0;
for(i=0;i<n;i++)t2+=pow(s[i]-t1,2);
printf("%.5f\n",sqrt(t2/n));
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175158/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175158/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"%lf\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%.5f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [1000 x double], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 8000, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp39 = icmp eq i32 %0, 0
br i1 %cmp39, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end15
%1 = phi i32 [ %11, %for.end15 ], [ %0, %entry ]
%cmp130 = icmp sgt i32 %1, 0
br i1 %cmp130, label %for.body, label %for.end.thread
for.end.thread: ; preds = %for.cond.preheader
%conv47 = sitofp i32 %1 to double
br label %for.end15
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%t1.031 = phi double [ %add, %for.body ], [ 0.000000e+00, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [1000 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 %t1.031, %2
%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 !11
for.end: ; preds = %for.body
%conv = sitofp i32 %3 to double
%div = fdiv double %add, %conv
%cmp634 = icmp sgt i32 %3, 0
br i1 %cmp634, label %for.body8.preheader, label %for.end15
for.body8.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.end15.loopexit.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body8
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%indvars.iv42 = phi i64 [ 0, %for.body8.preheader.new ], [ %indvars.iv.next43.3, %for.body8 ]
%t2.035 = phi double [ 0.000000e+00, %for.body8.preheader.new ], [ %add12.3, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.3, %for.body8 ]
%arrayidx10 = getelementptr inbounds [1000 x double], ptr %s, i64 0, i64 %indvars.iv42
%6 = load double, ptr %arrayidx10, align 16, !tbaa !9
%sub = fsub double %6, %div
%square = fmul double %sub, %sub
%add12 = fadd double %t2.035, %square
%indvars.iv.next43 = or i64 %indvars.iv42, 1
%arrayidx10.1 = getelementptr inbounds [1000 x double], ptr %s, i64 0, i64 %indvars.iv.next43
%7 = load double, ptr %arrayidx10.1, align 8, !tbaa !9
%sub.1 = fsub double %7, %div
%square.1 = fmul double %sub.1, %sub.1
%add12.1 = fadd double %add12, %square.1
%indvars.iv.next43.1 = or i64 %indvars.iv42, 2
%arrayidx10.2 = getelementptr inbounds [1000 x double], ptr %s, i64 0, i64 %indvars.iv.next43.1
%8 = load double, ptr %arrayidx10.2, align 16, !tbaa !9
%sub.2 = fsub double %8, %div
%square.2 = fmul double %sub.2, %sub.2
%add12.2 = fadd double %add12.1, %square.2
%indvars.iv.next43.2 = or i64 %indvars.iv42, 3
%arrayidx10.3 = getelementptr inbounds [1000 x double], ptr %s, i64 0, i64 %indvars.iv.next43.2
%9 = load double, ptr %arrayidx10.3, align 8, !tbaa !9
%sub.3 = fsub double %9, %div
%square.3 = fmul double %sub.3, %sub.3
%add12.3 = fadd double %add12.2, %square.3
%indvars.iv.next43.3 = add nuw nsw i64 %indvars.iv42, 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.end15.loopexit.unr-lcssa, label %for.body8, !llvm.loop !13
for.end15.loopexit.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%add12.lcssa.ph = phi double [ undef, %for.body8.preheader ], [ %add12.3, %for.body8 ]
%indvars.iv42.unr = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next43.3, %for.body8 ]
%t2.035.unr = phi double [ 0.000000e+00, %for.body8.preheader ], [ %add12.3, %for.body8 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end15, label %for.body8.epil
for.body8.epil: ; preds = %for.end15.loopexit.unr-lcssa, %for.body8.epil
%indvars.iv42.epil = phi i64 [ %indvars.iv.next43.epil, %for.body8.epil ], [ %indvars.iv42.unr, %for.end15.loopexit.unr-lcssa ]
%t2.035.epil = phi double [ %add12.epil, %for.body8.epil ], [ %t2.035.unr, %for.end15.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body8.epil ], [ 0, %for.end15.loopexit.unr-lcssa ]
%arrayidx10.epil = getelementptr inbounds [1000 x double], ptr %s, i64 0, i64 %indvars.iv42.epil
%10 = load double, ptr %arrayidx10.epil, align 8, !tbaa !9
%sub.epil = fsub double %10, %div
%square.epil = fmul double %sub.epil, %sub.epil
%add12.epil = fadd double %t2.035.epil, %square.epil
%indvars.iv.next43.epil = add nuw nsw i64 %indvars.iv42.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.end15, label %for.body8.epil, !llvm.loop !14
for.end15: ; preds = %for.end15.loopexit.unr-lcssa, %for.body8.epil, %for.end.thread, %for.end
%conv50 = phi double [ %conv, %for.end ], [ %conv47, %for.end.thread ], [ %conv, %for.body8.epil ], [ %conv, %for.end15.loopexit.unr-lcssa ]
%t2.0.lcssa = phi double [ 0.000000e+00, %for.end ], [ 0.000000e+00, %for.end.thread ], [ %add12.lcssa.ph, %for.end15.loopexit.unr-lcssa ], [ %add12.epil, %for.body8.epil ]
%div17 = fdiv double %t2.0.lcssa, %conv50
%call18 = call double @sqrt(double noundef %div17) #4
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %call18)
%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.end15, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 8000, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree 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 = { 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 <math.h>
//問題文より、入力されるデータの最大個数
#define MAXSTUDENT 1000
int main(void)
{
//student_numは生徒数を、ansは標準偏差を、avgは得点の平均値を、scoreには試験の得点を格納
int i, student_num;
double ans, avg;
double score[MAXSTUDENT];
//生徒数を入力
scanf("%d", &student_num);
//生徒数が0なら終了
while(student_num != 0){
ans = 0;
avg = 0;
//生徒数分の得点を入力し、平均値を求める
for(i = 0; i < student_num; i++){
scanf("%lf", &score[i]);
avg += score[i];
}
avg /= (double)student_num;
/*
分散 = (Σ[i = 0 → student_num] (score[i] - avg)^2) / student_num
標準偏差 = sqrt(分散)
*/
for(i = 0; i < student_num; i++){
ans += pow((score[i] - avg), 2.0);
}
ans /= (double)student_num;
ans = sqrt(ans);
//結果を出力
printf("%lf\n", ans);
//生徒数を入力
scanf("%d", &student_num);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175208/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175208/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"%lf\00", align 1
@.str.2 = 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:
%student_num = alloca i32, align 4
%score = alloca [1000 x double], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %student_num) #4
call void @llvm.lifetime.start.p0(i64 8000, ptr nonnull %score) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %student_num)
%0 = load i32, ptr %student_num, align 4, !tbaa !5
%cmp.not41 = icmp eq i32 %0, 0
br i1 %cmp.not41, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end15
%1 = phi i32 [ %11, %for.end15 ], [ %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
%conv49 = sitofp i32 %1 to double
br label %for.end15
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%avg.035 = phi double [ %add, %for.body ], [ 0.000000e+00, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [1000 x double], ptr %score, 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 %avg.035, %2
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %student_num, 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 !11
for.end: ; preds = %for.body
%conv = sitofp i32 %3 to double
%div = fdiv double %add, %conv
%cmp637 = icmp sgt i32 %3, 0
br i1 %cmp637, label %for.body8.preheader, label %for.end15
for.body8.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.end15.loopexit.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body8
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%indvars.iv44 = phi i64 [ 0, %for.body8.preheader.new ], [ %indvars.iv.next45.3, %for.body8 ]
%ans.039 = phi double [ 0.000000e+00, %for.body8.preheader.new ], [ %add12.3, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.3, %for.body8 ]
%arrayidx10 = getelementptr inbounds [1000 x double], ptr %score, i64 0, i64 %indvars.iv44
%6 = load double, ptr %arrayidx10, align 16, !tbaa !9
%sub = fsub double %6, %div
%square = fmul double %sub, %sub
%add12 = fadd double %ans.039, %square
%indvars.iv.next45 = or i64 %indvars.iv44, 1
%arrayidx10.1 = getelementptr inbounds [1000 x double], ptr %score, i64 0, i64 %indvars.iv.next45
%7 = load double, ptr %arrayidx10.1, align 8, !tbaa !9
%sub.1 = fsub double %7, %div
%square.1 = fmul double %sub.1, %sub.1
%add12.1 = fadd double %add12, %square.1
%indvars.iv.next45.1 = or i64 %indvars.iv44, 2
%arrayidx10.2 = getelementptr inbounds [1000 x double], ptr %score, i64 0, i64 %indvars.iv.next45.1
%8 = load double, ptr %arrayidx10.2, align 16, !tbaa !9
%sub.2 = fsub double %8, %div
%square.2 = fmul double %sub.2, %sub.2
%add12.2 = fadd double %add12.1, %square.2
%indvars.iv.next45.2 = or i64 %indvars.iv44, 3
%arrayidx10.3 = getelementptr inbounds [1000 x double], ptr %score, i64 0, i64 %indvars.iv.next45.2
%9 = load double, ptr %arrayidx10.3, align 8, !tbaa !9
%sub.3 = fsub double %9, %div
%square.3 = fmul double %sub.3, %sub.3
%add12.3 = fadd double %add12.2, %square.3
%indvars.iv.next45.3 = add nuw nsw i64 %indvars.iv44, 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.end15.loopexit.unr-lcssa, label %for.body8, !llvm.loop !13
for.end15.loopexit.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%add12.lcssa.ph = phi double [ undef, %for.body8.preheader ], [ %add12.3, %for.body8 ]
%indvars.iv44.unr = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next45.3, %for.body8 ]
%ans.039.unr = phi double [ 0.000000e+00, %for.body8.preheader ], [ %add12.3, %for.body8 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end15, label %for.body8.epil
for.body8.epil: ; preds = %for.end15.loopexit.unr-lcssa, %for.body8.epil
%indvars.iv44.epil = phi i64 [ %indvars.iv.next45.epil, %for.body8.epil ], [ %indvars.iv44.unr, %for.end15.loopexit.unr-lcssa ]
%ans.039.epil = phi double [ %add12.epil, %for.body8.epil ], [ %ans.039.unr, %for.end15.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body8.epil ], [ 0, %for.end15.loopexit.unr-lcssa ]
%arrayidx10.epil = getelementptr inbounds [1000 x double], ptr %score, i64 0, i64 %indvars.iv44.epil
%10 = load double, ptr %arrayidx10.epil, align 8, !tbaa !9
%sub.epil = fsub double %10, %div
%square.epil = fmul double %sub.epil, %sub.epil
%add12.epil = fadd double %ans.039.epil, %square.epil
%indvars.iv.next45.epil = add nuw nsw i64 %indvars.iv44.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.end15, label %for.body8.epil, !llvm.loop !14
for.end15: ; preds = %for.end15.loopexit.unr-lcssa, %for.body8.epil, %for.end.thread, %for.end
%conv52 = phi double [ %conv, %for.end ], [ %conv49, %for.end.thread ], [ %conv, %for.body8.epil ], [ %conv, %for.end15.loopexit.unr-lcssa ]
%ans.0.lcssa = phi double [ 0.000000e+00, %for.end ], [ 0.000000e+00, %for.end.thread ], [ %add12.lcssa.ph, %for.end15.loopexit.unr-lcssa ], [ %add12.epil, %for.body8.epil ]
%div17 = fdiv double %ans.0.lcssa, %conv52
%call18 = call double @sqrt(double noundef %div17) #4
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %call18)
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %student_num)
%11 = load i32, ptr %student_num, align 4, !tbaa !5
%cmp.not = icmp eq i32 %11, 0
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !16
while.end: ; preds = %for.end15, %entry
call void @llvm.lifetime.end.p0(i64 8000, ptr nonnull %score) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %student_num) #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 = !{!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"}
!16 = distinct !{!16, !12}
|
#include <stdio.h>
#include <math.h>
int main(void)
{
int i,n,s[1000];
double a,m;
while(1){
scanf("%d",&n);
if(!n) break;
m=0;
a=0;
for(i=0;i<n;i++){
scanf("%d",&s[i]);
m=m+s[i];
}
m=m/n;
for(i=0;i<n;i++){
a=a+pow(s[i]-m,2.0);
}
a=a/n;
printf("%lf\n",pow(a,1.0/2.0));
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175251/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175251/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:
%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
%call40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not41 = icmp eq i32 %0, 0
br i1 %tobool.not41, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end16
%1 = phi i32 [ %11, %for.end16 ], [ %0, %entry ]
%cmp32 = icmp sgt i32 %1, 0
br i1 %cmp32, label %for.body, label %for.end.thread
for.end.thread: ; preds = %for.cond.preheader
%conv449 = sitofp i32 %1 to double
br label %for.end16
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
%call1 = 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
%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
%conv4 = sitofp i32 %3 to double
%div = fdiv double %add, %conv4
%cmp636 = icmp sgt i32 %3, 0
br i1 %cmp636, label %for.body8.preheader, label %for.end16
for.body8.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.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body8
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%indvars.iv44 = phi i64 [ 0, %for.body8.preheader.new ], [ %indvars.iv.next45.3, %for.body8 ]
%a.038 = phi double [ 0.000000e+00, %for.body8.preheader.new ], [ %add13.3, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.3, %for.body8 ]
%arrayidx10 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv44
%6 = load i32, ptr %arrayidx10, align 16, !tbaa !5
%conv11 = sitofp i32 %6 to double
%sub = fsub double %conv11, %div
%square = fmul double %sub, %sub
%add13 = fadd double %a.038, %square
%indvars.iv.next45 = or i64 %indvars.iv44, 1
%arrayidx10.1 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next45
%7 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%conv11.1 = sitofp i32 %7 to double
%sub.1 = fsub double %conv11.1, %div
%square.1 = fmul double %sub.1, %sub.1
%add13.1 = fadd double %add13, %square.1
%indvars.iv.next45.1 = or i64 %indvars.iv44, 2
%arrayidx10.2 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next45.1
%8 = load i32, ptr %arrayidx10.2, align 8, !tbaa !5
%conv11.2 = sitofp i32 %8 to double
%sub.2 = fsub double %conv11.2, %div
%square.2 = fmul double %sub.2, %sub.2
%add13.2 = fadd double %add13.1, %square.2
%indvars.iv.next45.2 = or i64 %indvars.iv44, 3
%arrayidx10.3 = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv.next45.2
%9 = load i32, ptr %arrayidx10.3, align 4, !tbaa !5
%conv11.3 = sitofp i32 %9 to double
%sub.3 = fsub double %conv11.3, %div
%square.3 = fmul double %sub.3, %sub.3
%add13.3 = fadd double %add13.2, %square.3
%indvars.iv.next45.3 = add nuw nsw i64 %indvars.iv44, 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.body8, !llvm.loop !11
for.end16.loopexit.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%add13.lcssa.ph = phi double [ undef, %for.body8.preheader ], [ %add13.3, %for.body8 ]
%indvars.iv44.unr = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next45.3, %for.body8 ]
%a.038.unr = phi double [ 0.000000e+00, %for.body8.preheader ], [ %add13.3, %for.body8 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end16, label %for.body8.epil
for.body8.epil: ; preds = %for.end16.loopexit.unr-lcssa, %for.body8.epil
%indvars.iv44.epil = phi i64 [ %indvars.iv.next45.epil, %for.body8.epil ], [ %indvars.iv44.unr, %for.end16.loopexit.unr-lcssa ]
%a.038.epil = phi double [ %add13.epil, %for.body8.epil ], [ %a.038.unr, %for.end16.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body8.epil ], [ 0, %for.end16.loopexit.unr-lcssa ]
%arrayidx10.epil = getelementptr inbounds [1000 x i32], ptr %s, i64 0, i64 %indvars.iv44.epil
%10 = load i32, ptr %arrayidx10.epil, align 4, !tbaa !5
%conv11.epil = sitofp i32 %10 to double
%sub.epil = fsub double %conv11.epil, %div
%square.epil = fmul double %sub.epil, %sub.epil
%add13.epil = fadd double %a.038.epil, %square.epil
%indvars.iv.next45.epil = add nuw nsw i64 %indvars.iv44.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.body8.epil, !llvm.loop !12
for.end16: ; preds = %for.end16.loopexit.unr-lcssa, %for.body8.epil, %for.end.thread, %for.end
%conv452 = phi double [ %conv4, %for.end ], [ %conv449, %for.end.thread ], [ %conv4, %for.body8.epil ], [ %conv4, %for.end16.loopexit.unr-lcssa ]
%a.0.lcssa = phi double [ 0.000000e+00, %for.end ], [ 0.000000e+00, %for.end.thread ], [ %add13.lcssa.ph, %for.end16.loopexit.unr-lcssa ], [ %add13.epil, %for.body8.epil ]
%div18 = fdiv double %a.0.lcssa, %conv452
%call19 = call double @pow(double noundef %div18, double noundef 5.000000e-01) #4
%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)
%11 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %11, 0
br i1 %tobool.not, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end16, %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 @pow(double noundef, 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<stdlib.h>
int main(){
long x = 0;
long i = 0;
scanf("%ld",&x);
for(i=0;i<1000000000+1;i++){
if(x <= i*(i+1)/2){
break;
}
}
printf("%ld",i);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175295/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175295/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
; 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
store i64 0, ptr %x, align 8, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i64, ptr %x, align 8
br label %for.cond
for.cond: ; preds = %for.body.2, %entry
%i.0 = phi i64 [ 0, %entry ], [ %add.2, %for.body.2 ]
%add = add nuw nsw i64 %i.0, 1
%mul = mul nuw nsw i64 %add, %i.0
%div7 = lshr i64 %mul, 1
%cmp1.not = icmp sgt i64 %0, %div7
br i1 %cmp1.not, label %for.body.1, label %for.end, !llvm.loop !9
for.body.1: ; preds = %for.cond
%add.1 = add nuw nsw i64 %i.0, 2
%mul.1 = mul nuw nsw i64 %add.1, %add
%div7.1 = lshr i64 %mul.1, 1
%cmp1.not.1 = icmp sgt i64 %0, %div7.1
br i1 %cmp1.not.1, label %for.cond.2, label %for.end, !llvm.loop !9
for.cond.2: ; preds = %for.body.1
%exitcond.not.2 = icmp eq i64 %add.1, 1000000001
br i1 %exitcond.not.2, label %for.end, label %for.body.2
for.body.2: ; preds = %for.cond.2
%add.2 = add nuw nsw i64 %i.0, 3
%mul.2 = mul nuw nsw i64 %add.2, %add.1
%div7.2 = lshr i64 %mul.2, 1
%cmp1.not.2 = icmp sgt i64 %0, %div7.2
br i1 %cmp1.not.2, label %for.cond, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body.2, %for.cond.2, %for.body.1, %for.cond
%i.0.lcssa = phi i64 [ %i.0, %for.cond ], [ %add, %for.body.1 ], [ %add.1, %for.cond.2 ], [ %add.1, %for.body.2 ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %i.0.lcssa)
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", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include<string.h>
int main(void){
int i=1,x,sum=0;
scanf("%d",&x);
while(sum<x){
sum+=i;
i++;
}
printf("%d\n",i-1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175345/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175345/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:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%sum.07 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%i.06 = phi i32 [ %inc, %while.body ], [ 1, %entry ]
%add = add nuw nsw i32 %sum.07, %i.06
%inc = add nuw nsw i32 %i.06, 1
%cmp = icmp slt i32 %add, %0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%i.0.lcssa = phi i32 [ 0, %entry ], [ %i.06, %while.body ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
typedef struct {
int start,end;
int next;
} card_t;
int card_num;
card_t cards[10010];
int main(void) {
int n,m;
int p,q,r;
int x,y;
int i,j,rest,status;
int cut1,cut2,cut3,temp;
int start,end,count;
while(1) {
scanf("%d",&n);
if(n==0)break;
scanf("%d",&m);
scanf("%d%d%d",&p,&q,&r);
cards[0].start=0;
cards[0].end=-1;
cards[0].next=1;
cards[1].start=1;
cards[1].end=n;
cards[1].next=0;
card_num=2;
for(i=0;i<m;i++) {
scanf("%d%d",&x,&y);
for(j=cards[0].next,rest=x;j>0;j=cards[j].next) {
rest-=cards[j].end-cards[j].start+1;
if(rest==0) {
cut1=j;
break;
} else if(rest<0) {
cards[card_num].start=cards[j].end+rest+1;
cards[card_num].end=cards[j].end;
cards[card_num].next=cards[j].next;
cards[j].end=cards[j].end+rest;
cards[j].next=card_num;
card_num++;
cut1=j;
break;
}
}
if(j<=0)return 1;/* bug */
for(j=cards[j].next,rest=y-x;j>0;j=cards[j].next) {
rest-=cards[j].end-cards[j].start+1;
if(rest==0) {
cut2=j;
break;
} else if(rest<0) {
cards[card_num].start=cards[j].end+rest+1;
cards[card_num].end=cards[j].end;
cards[card_num].next=cards[j].next;
cards[j].end=cards[j].end+rest;
cards[j].next=card_num;
card_num++;
cut2=j;
break;
}
}
if(j<=0)return 1;/* bug */
for(j=cards[j].next;j>0;j=cards[j].next) {
if(cards[j].next==0)cut3=j;
}
temp=cards[0].next;
cards[0].next=cards[cut2].next;
cards[cut3].next=cards[cut1].next;
cards[cut2].next=temp;
cards[cut1].next=0;
}
status=0;rest=p;count=0;
for(j=cards[0].next;j>0;j=cards[j].next) {
rest-=cards[j].end-cards[j].start+1;
if(status==0) {
if(rest==0) {
status=1;
if(cards[j].end<=r)count++;
rest=q-p;
} else if(rest<0) {
status=1;
start=cards[j].end+rest;
end=cards[j].end;
if(end>r)end=r;
if(start<=end)count+=end-start+1;
rest+=q-p;
}
} else if(status==1) {
if(rest<=0) {
status=2;
start=cards[j].start;
end=cards[j].end+rest;
if(end>r)end=r;
if(start<=end)count+=end-start+1;
} else {
start=cards[j].start;
end=cards[j].end;
if(end>r)end=r;
if(start<=end)count+=end-start+1;
}
}
}
printf("%d\n",count);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175396/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175396/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.card_t = type { i32, i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@cards = dso_local local_unnamed_addr global [10010 x %struct.card_t] zeroinitializer, align 16
@card_num = dso_local local_unnamed_addr global i32 0, align 4
@.str.2 = private unnamed_addr constant [5 x i8] c"%d%d\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
%p = alloca i32, align 4
%q = alloca i32, align 4
%r = alloca i32, align 4
%x = alloca i32, align 4
%y = 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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
%call392 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp393 = icmp eq i32 %0, 0
br i1 %cmp393, label %cleanup, label %if.end
if.end: ; preds = %entry, %for.end242
%cut3.0394 = phi i32 [ %cut3.1.lcssa431, %for.end242 ], [ undef, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %p, ptr noundef nonnull %q, ptr noundef nonnull %r)
store <4 x i32> <i32 0, i32 -1, i32 1, i32 1>, ptr @cards, align 16, !tbaa !5
%1 = load i32, ptr %n, align 4, !tbaa !5
store i32 %1, ptr getelementptr inbounds ([10010 x %struct.card_t], ptr @cards, i64 0, i64 1, i32 1), align 16, !tbaa !9
store i32 0, ptr getelementptr inbounds ([10010 x %struct.card_t], ptr @cards, i64 0, i64 1, i32 2), align 4, !tbaa !11
store i32 2, ptr @card_num, align 4, !tbaa !5
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp3381 = icmp sgt i32 %2, 0
br i1 %cmp3381, label %for.body, label %for.body153.lr.ph
for.body: ; preds = %if.end, %for.end132
%cut3.1383 = phi i32 [ %cut3.2.lcssa, %for.end132 ], [ %cut3.0394, %if.end ]
%i.0382 = phi i32 [ %inc149, %for.end132 ], [ 0, %if.end ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %x, ptr noundef nonnull %y)
%3 = load i32, ptr %x, align 4, !tbaa !5
%j.0374 = load i32, ptr getelementptr inbounds ([10010 x %struct.card_t], ptr @cards, i64 0, i64 0, i32 2), align 8, !tbaa !11
%cmp6375 = icmp sgt i32 %j.0374, 0
br i1 %cmp6375, label %for.body7, label %cleanup
for.body7: ; preds = %for.body, %for.inc
%j.0377 = phi i32 [ %j.0, %for.inc ], [ %j.0374, %for.body ]
%rest.0376 = phi i32 [ %sub12, %for.inc ], [ %3, %for.body ]
%idxprom = zext i32 %j.0377 to i64
%arrayidx = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom
%end8 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom, i32 1
%4 = load i32, ptr %end8, align 4, !tbaa !9
%5 = load i32, ptr %arrayidx, align 4, !tbaa !12
%6 = xor i32 %4, -1
%add.neg = add i32 %rest.0376, %6
%sub12 = add i32 %add.neg, %5
%cmp13 = icmp eq i32 %sub12, 0
br i1 %cmp13, label %if.end53, label %if.else
if.else: ; preds = %for.body7
%cmp15 = icmp slt i32 %sub12, 0
br i1 %cmp15, label %if.then16, label %for.inc
if.then16: ; preds = %if.else
%add21 = add i32 %rest.0376, %5
%7 = load i32, ptr @card_num, align 4, !tbaa !5
%idxprom22 = sext i32 %7 to i64
%arrayidx23 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom22
store i32 %add21, ptr %arrayidx23, align 4, !tbaa !12
%end30 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom22, i32 1
store i32 %4, ptr %end30, align 4, !tbaa !9
%next = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom, i32 2
%8 = load i32, ptr %next, align 4, !tbaa !11
%next35 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom22, i32 2
store i32 %8, ptr %next35, align 4, !tbaa !11
%9 = load i32, ptr %end8, align 4, !tbaa !9
%add39 = add nsw i32 %9, %sub12
store i32 %add39, ptr %end8, align 4, !tbaa !9
store i32 %7, ptr %next, align 4, !tbaa !11
%inc = add nsw i32 %7, 1
store i32 %inc, ptr @card_num, align 4, !tbaa !5
br label %if.end53
for.inc: ; preds = %if.else
%next50 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom, i32 2
%j.0 = load i32, ptr %next50, align 4, !tbaa !11
%cmp6 = icmp sgt i32 %j.0, 0
br i1 %cmp6, label %for.body7, label %cleanup, !llvm.loop !13
if.end53: ; preds = %for.body7, %if.then16
%10 = load i32, ptr %y, align 4, !tbaa !5
%sub57 = sub nsw i32 %10, %3
br label %for.cond58
for.cond58: ; preds = %if.else72, %if.end53
%idxprom54.pn = phi i64 [ %idxprom, %if.end53 ], [ %idxprom61, %if.else72 ]
%rest.1 = phi i32 [ %sub57, %if.end53 ], [ %sub69, %if.else72 ]
%j.1.in = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom54.pn, i32 2
%j.1 = load i32, ptr %j.1.in, align 4, !tbaa !11
%cmp59 = icmp sgt i32 %j.1, 0
br i1 %cmp59, label %for.body60, label %cleanup
for.body60: ; preds = %for.cond58
%idxprom61 = zext i32 %j.1 to i64
%arrayidx62 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom61
%end63 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom61, i32 1
%11 = load i32, ptr %end63, align 4, !tbaa !9
%12 = load i32, ptr %arrayidx62, align 4, !tbaa !12
%13 = xor i32 %11, -1
%add68.neg = add i32 %rest.1, %13
%sub69 = add i32 %add68.neg, %12
%cmp70 = icmp eq i32 %sub69, 0
br i1 %cmp70, label %if.end115.loopexit, label %if.else72
if.else72: ; preds = %for.body60
%cmp73 = icmp slt i32 %sub69, 0
br i1 %cmp73, label %if.then74, label %for.cond58, !llvm.loop !15
if.then74: ; preds = %if.else72
%add79 = add i32 %rest.1, %12
%14 = load i32, ptr @card_num, align 4, !tbaa !5
%idxprom80 = sext i32 %14 to i64
%arrayidx81 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom80
store i32 %add79, ptr %arrayidx81, align 4, !tbaa !12
%end88 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom80, i32 1
store i32 %11, ptr %end88, align 4, !tbaa !9
%next91 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom61, i32 2
%15 = load i32, ptr %next91, align 4, !tbaa !11
%next94 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom80, i32 2
store i32 %15, ptr %next94, align 4, !tbaa !11
%16 = load i32, ptr %end63, align 4, !tbaa !9
%add98 = add nsw i32 %16, %sub69
store i32 %add98, ptr %end63, align 4, !tbaa !9
store i32 %14, ptr %next91, align 4, !tbaa !11
%inc105 = add nsw i32 %14, 1
store i32 %inc105, ptr @card_num, align 4, !tbaa !5
br label %if.end115
if.end115.loopexit: ; preds = %for.body60
%next118.phi.trans.insert = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom61, i32 2
%j.2.pr.pre = load i32, ptr %next118.phi.trans.insert, align 4, !tbaa !11
br label %if.end115
if.end115: ; preds = %if.end115.loopexit, %if.then74
%j.2.pr = phi i32 [ %j.2.pr.pre, %if.end115.loopexit ], [ %14, %if.then74 ]
%cmp120378 = icmp sgt i32 %j.2.pr, 0
br i1 %cmp120378, label %for.body121, label %for.end132
for.body121: ; preds = %if.end115, %for.body121
%cut3.2380 = phi i32 [ %spec.select, %for.body121 ], [ %cut3.1383, %if.end115 ]
%j.2379 = phi i32 [ %17, %for.body121 ], [ %j.2.pr, %if.end115 ]
%idxprom122 = zext i32 %j.2379 to i64
%next124 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom122, i32 2
%17 = load i32, ptr %next124, align 4, !tbaa !11
%cmp125 = icmp eq i32 %17, 0
%spec.select = select i1 %cmp125, i32 %j.2379, i32 %cut3.2380
%cmp120 = icmp sgt i32 %17, 0
br i1 %cmp120, label %for.body121, label %for.end132, !llvm.loop !16
for.end132: ; preds = %for.body121, %if.end115
%cut3.2.lcssa = phi i32 [ %cut3.1383, %if.end115 ], [ %spec.select, %for.body121 ]
%18 = load i32, ptr getelementptr inbounds ([10010 x %struct.card_t], ptr @cards, i64 0, i64 0, i32 2), align 8, !tbaa !11
%idxprom133 = sext i32 %j.1 to i64
%next135 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom133, i32 2
%19 = load i32, ptr %next135, align 4, !tbaa !11
store i32 %19, ptr getelementptr inbounds ([10010 x %struct.card_t], ptr @cards, i64 0, i64 0, i32 2), align 8, !tbaa !11
%next138 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom, i32 2
%20 = load i32, ptr %next138, align 4, !tbaa !11
%idxprom139 = sext i32 %cut3.2.lcssa to i64
%next141 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom139, i32 2
store i32 %20, ptr %next141, align 4, !tbaa !11
store i32 %18, ptr %next135, align 4, !tbaa !11
store i32 0, ptr %next138, align 4, !tbaa !11
%inc149 = add nuw nsw i32 %i.0382, 1
%21 = load i32, ptr %m, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc149, %21
br i1 %cmp3, label %for.body, label %for.end150, !llvm.loop !17
for.end150: ; preds = %for.end132
%j.3385.pre = load i32, ptr getelementptr inbounds ([10010 x %struct.card_t], ptr @cards, i64 0, i64 0, i32 2), align 8, !tbaa !11
%cmp152386 = icmp sgt i32 %j.3385.pre, 0
br i1 %cmp152386, label %for.body153.lr.ph, label %for.end242
for.body153.lr.ph: ; preds = %if.end, %for.end150
%cut3.1.lcssa432 = phi i32 [ %cut3.2.lcssa, %for.end150 ], [ %cut3.0394, %if.end ]
%j.3385430 = phi i32 [ %j.3385.pre, %for.end150 ], [ 1, %if.end ]
%22 = load i32, ptr %p, align 4, !tbaa !5
%23 = load i32, ptr %r, align 4
%24 = load i32, ptr %q, align 4
%sub174 = sub nsw i32 %24, %22
br label %for.body153
for.body153: ; preds = %for.body153.lr.ph, %for.inc238
%j.3390 = phi i32 [ %j.3385430, %for.body153.lr.ph ], [ %j.3, %for.inc238 ]
%count.0389 = phi i32 [ 0, %for.body153.lr.ph ], [ %count.3, %for.inc238 ]
%status.0388 = phi i32 [ 0, %for.body153.lr.ph ], [ %status.1, %for.inc238 ]
%rest.2387 = phi i32 [ %22, %for.body153.lr.ph ], [ %rest.3, %for.inc238 ]
%idxprom154 = zext i32 %j.3390 to i64
%arrayidx155 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom154
%end156 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom154, i32 1
%25 = load i32, ptr %end156, align 4, !tbaa !9
%26 = load i32, ptr %arrayidx155, align 4, !tbaa !12
%27 = xor i32 %25, -1
%add161.neg = add i32 %rest.2387, %27
%sub162 = add i32 %add161.neg, %26
switch i32 %status.0388, label %for.inc238 [
i32 0, label %if.then164
i32 1, label %if.then200
]
if.then164: ; preds = %for.body153
%cmp165 = icmp eq i32 %sub162, 0
br i1 %cmp165, label %if.then166, label %if.else175
if.then166: ; preds = %if.then164
%cmp170.not = icmp sle i32 %25, %23
%inc172 = zext i1 %cmp170.not to i32
%spec.select345 = add nsw i32 %count.0389, %inc172
br label %for.inc238
if.else175: ; preds = %if.then164
%cmp176 = icmp slt i32 %sub162, 0
br i1 %cmp176, label %if.then177, label %for.inc238
if.then177: ; preds = %if.else175
%add181 = add nsw i32 %sub162, %25
%spec.select346 = call i32 @llvm.smin.i32(i32 %25, i32 %23)
%cmp188.not = icmp slt i32 %23, %add181
%reass.sub = sub i32 %spec.select346, %add181
%add191 = add i32 %reass.sub, 1
%add192 = select i1 %cmp188.not, i32 0, i32 %add191
%count.2 = add nsw i32 %add192, %count.0389
%sub194 = sub i32 %sub162, %22
%add195 = add i32 %sub194, %24
br label %for.inc238
if.then200: ; preds = %for.body153
%cmp201 = icmp slt i32 %sub162, 1
br i1 %cmp201, label %if.then202, label %if.else219
if.then202: ; preds = %if.then200
%add209 = add nsw i32 %sub162, %25
%spec.select347 = call i32 @llvm.smin.i32(i32 %add209, i32 %23)
%cmp213.not = icmp sgt i32 %26, %spec.select347
br i1 %cmp213.not, label %for.inc238, label %if.then214
if.then214: ; preds = %if.then202
%sub215 = add i32 %count.0389, 1
%add216 = sub i32 %sub215, %26
%add217 = add i32 %add216, %spec.select347
br label %for.inc238
if.else219: ; preds = %if.then200
%spec.select348 = call i32 @llvm.smin.i32(i32 %25, i32 %23)
%cmp229.not = icmp sgt i32 %26, %spec.select348
br i1 %cmp229.not, label %for.inc238, label %if.then230
if.then230: ; preds = %if.else219
%sub231 = add i32 %count.0389, 1
%add232 = sub i32 %sub231, %26
%add233 = add i32 %add232, %spec.select348
br label %for.inc238
for.inc238: ; preds = %for.body153, %if.else175, %if.then177, %if.then166, %if.then214, %if.then202, %if.then230, %if.else219
%rest.3 = phi i32 [ %sub174, %if.then166 ], [ %add195, %if.then177 ], [ %sub162, %if.else175 ], [ %sub162, %if.then214 ], [ %sub162, %if.then202 ], [ %sub162, %if.then230 ], [ %sub162, %if.else219 ], [ %sub162, %for.body153 ]
%status.1 = phi i32 [ 1, %if.then166 ], [ 1, %if.then177 ], [ 0, %if.else175 ], [ 2, %if.then214 ], [ 2, %if.then202 ], [ 1, %if.then230 ], [ 1, %if.else219 ], [ %status.0388, %for.body153 ]
%count.3 = phi i32 [ %spec.select345, %if.then166 ], [ %count.2, %if.then177 ], [ %count.0389, %if.else175 ], [ %add217, %if.then214 ], [ %count.0389, %if.then202 ], [ %add233, %if.then230 ], [ %count.0389, %if.else219 ], [ %count.0389, %for.body153 ]
%next241 = getelementptr inbounds [10010 x %struct.card_t], ptr @cards, i64 0, i64 %idxprom154, i32 2
%j.3 = load i32, ptr %next241, align 4, !tbaa !11
%cmp152 = icmp sgt i32 %j.3, 0
br i1 %cmp152, label %for.body153, label %for.end242, !llvm.loop !18
for.end242: ; preds = %for.inc238, %for.end150
%cut3.1.lcssa431 = phi i32 [ %cut3.2.lcssa, %for.end150 ], [ %cut3.1.lcssa432, %for.inc238 ]
%count.0.lcssa = phi i32 [ 0, %for.end150 ], [ %count.3, %for.inc238 ]
%call243 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %count.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%28 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %28, 0
br i1 %cmp, label %cleanup, label %if.end
cleanup: ; preds = %for.end242, %for.body, %for.inc, %for.cond58, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %for.cond58 ], [ 1, %for.inc ], [ 1, %for.body ], [ 0, %for.end242 ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #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 %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.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 = !{!10, !6, i64 4}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
|
#include <stdio.h>
int main(void) {
int n,m,i,j;
char s[1024][2][16],t[16];
while(scanf("%d",&n) , n != 0){
for(i = 1;i <= n;i++){scanf("%s%s",s[i][0],s[i][1]);}
scanf("%d",&m);
for(i = 1;i <= m;i++){
scanf("%s",t);
for(j = 1;j <= n;j++){
if(s[j][0][0] == t[0]){printf("%c",s[j][1][0]);break;}
if(j == n){printf("%c",t[0]);}
}
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175439/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175439/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:
%n = alloca i32, align 4
%m = alloca i32, align 4
%s = alloca [1024 x [2 x [16 x i8]]], align 16
%t = alloca [16 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 32768, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %t) #4
%call62 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not63 = icmp eq i32 %0, 0
br i1 %cmp.not63, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end43
%1 = phi i32 [ %14, %for.end43 ], [ %0, %entry ]
%cmp1.not56 = icmp slt i32 %1, 1
br i1 %cmp1.not56, label %for.end, label %for.body
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [1024 x [2 x [16 x i8]]], ptr %s, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [1024 x [2 x [16 x i8]]], ptr %s, i64 0, i64 %indvars.iv, i64 1
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx5)
%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
%cmp1.not.not = icmp slt i64 %indvars.iv, %3
br i1 %cmp1.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %for.cond.preheader
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%4 = load i32, ptr %m, align 4, !tbaa !5
%cmp10.not60 = icmp slt i32 %4, 1
br i1 %cmp10.not60, label %for.end43, label %for.body11
for.body11: ; preds = %for.end, %for.inc41
%i.161 = phi i32 [ %inc42, %for.inc41 ], [ 1, %for.end ]
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t)
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp15.not58 = icmp slt i32 %5, 1
br i1 %cmp15.not58, label %for.inc41, label %for.body16
for.body16: ; preds = %for.body11, %for.inc38
%6 = phi i32 [ %11, %for.inc38 ], [ %5, %for.body11 ]
%indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.inc38 ], [ 1, %for.body11 ]
%arrayidx18 = getelementptr inbounds [1024 x [2 x [16 x i8]]], ptr %s, i64 0, i64 %indvars.iv66
%7 = load i8, ptr %arrayidx18, align 16, !tbaa !11
%8 = load i8, ptr %t, align 16, !tbaa !11
%conv22 = sext i8 %8 to i32
%cmp23 = icmp eq i8 %7, %8
br i1 %cmp23, label %if.then, label %if.end
if.then: ; preds = %for.body16
%arrayidx27 = getelementptr inbounds [1024 x [2 x [16 x i8]]], ptr %s, i64 0, i64 %indvars.iv66, i64 1
%9 = load i8, ptr %arrayidx27, align 16, !tbaa !11
%conv29 = sext i8 %9 to i32
%putchar55 = call i32 @putchar(i32 %conv29)
br label %for.inc41
if.end: ; preds = %for.body16
%10 = zext i32 %6 to i64
%cmp31 = icmp eq i64 %indvars.iv66, %10
br i1 %cmp31, label %if.then33, label %for.inc38
if.then33: ; preds = %if.end
%putchar54 = call i32 @putchar(i32 %conv22)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc38
for.inc38: ; preds = %if.end, %if.then33
%11 = phi i32 [ %6, %if.end ], [ %.pre, %if.then33 ]
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%12 = sext i32 %11 to i64
%cmp15.not.not = icmp slt i64 %indvars.iv66, %12
br i1 %cmp15.not.not, label %for.body16, label %for.inc41, !llvm.loop !12
for.inc41: ; preds = %for.inc38, %for.body11, %if.then
%inc42 = add nuw nsw i32 %i.161, 1
%13 = load i32, ptr %m, align 4, !tbaa !5
%cmp10.not.not = icmp slt i32 %i.161, %13
br i1 %cmp10.not.not, label %for.body11, label %for.end43, !llvm.loop !13
for.end43: ; preds = %for.inc41, %for.end
%putchar = call i32 @putchar(i32 10)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%14 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not = icmp eq i32 %14, 0
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !14
while.end: ; preds = %for.end43, %entry
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 32768, 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: 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main(void)
{
int n,m;
int i,j;
char data[10000][2]={{0}};
unsigned char ans[1000000];
for(;;){
scanf("%d",&n);
if(n == 0)break;
for(i = 0;i < n; i++){
scanf(" %c %c",&data[i][0],&data[i][1]);
}
scanf("%d",&m);
for(i = 0;i < m; i++){
scanf(" %c",&ans[i]);
for(j = 0;j < n; j++){
if(ans[i] == data[j][0]){
ans[i] = data[j][1];
break;
}
}
}
printf("%s\n",ans);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175518/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175518/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" %c %c\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %c\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
%data = alloca [10000 x [2 x i8]], align 16
%ans = alloca [1000000 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 %data) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(20000) %data, i8 0, i64 20000, i1 false)
call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %ans) #5
%call58 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp59 = icmp eq i32 %0, 0
br i1 %cmp59, label %for.end40, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.end38
%1 = phi i32 [ %11, %for.end38 ], [ %0, %entry ]
%cmp252 = icmp sgt i32 %1, 0
br i1 %cmp252, label %for.body, label %for.end
for.body: ; preds = %for.cond1.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond1.preheader ]
%arrayidx = getelementptr inbounds [10000 x [2 x i8]], ptr %data, i64 0, i64 %indvars.iv
%arrayidx6 = getelementptr inbounds [10000 x [2 x i8]], ptr %data, i64 0, i64 %indvars.iv, i64 1
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx6)
%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, %for.cond1.preheader
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%4 = load i32, ptr %m, align 4, !tbaa !5
%cmp1056 = icmp sgt i32 %4, 0
br i1 %cmp1056, label %for.body11, label %for.end38
for.body11: ; preds = %for.end, %for.inc36
%indvars.iv65 = phi i64 [ %indvars.iv.next66, %for.inc36 ], [ 0, %for.end ]
%arrayidx13 = getelementptr inbounds [1000000 x i8], ptr %ans, i64 0, i64 %indvars.iv65
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx13)
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp1654 = icmp sgt i32 %5, 0
br i1 %cmp1654, label %for.body17.lr.ph, label %for.inc36
for.body17.lr.ph: ; preds = %for.body11
%6 = load i8, ptr %arrayidx13, align 1, !tbaa !11
%conv = zext i8 %6 to i32
%wide.trip.count = zext i32 %5 to i64
br label %for.body17
for.cond15: ; preds = %for.body17
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%exitcond.not = icmp eq i64 %indvars.iv.next63, %wide.trip.count
br i1 %exitcond.not, label %for.inc36, label %for.body17, !llvm.loop !12
for.body17: ; preds = %for.body17.lr.ph, %for.cond15
%indvars.iv62 = phi i64 [ 0, %for.body17.lr.ph ], [ %indvars.iv.next63, %for.cond15 ]
%arrayidx21 = getelementptr inbounds [10000 x [2 x i8]], ptr %data, i64 0, i64 %indvars.iv62
%7 = load i8, ptr %arrayidx21, align 2, !tbaa !11
%conv23 = sext i8 %7 to i32
%cmp24 = icmp eq i32 %conv, %conv23
br i1 %cmp24, label %if.then26, label %for.cond15
if.then26: ; preds = %for.body17
%arrayidx29 = getelementptr inbounds [10000 x [2 x i8]], ptr %data, i64 0, i64 %indvars.iv62, i64 1
%8 = load i8, ptr %arrayidx29, align 1, !tbaa !11
store i8 %8, ptr %arrayidx13, align 1, !tbaa !11
br label %for.inc36
for.inc36: ; preds = %for.cond15, %for.body11, %if.then26
%indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
%9 = load i32, ptr %m, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp10 = icmp slt i64 %indvars.iv.next66, %10
br i1 %cmp10, label %for.body11, label %for.end38, !llvm.loop !13
for.end38: ; preds = %for.inc36, %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %ans)
%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 %for.end40, label %for.cond1.preheader
for.end40: ; preds = %for.end38, %entry
call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %ans) #5
call void @llvm.lifetime.end.p0(i64 20000, ptr nonnull %data) #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 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
// AOJ 2751 Baseball
// 2018.2.2 bal4u
#include <stdio.h>
#define M 1000000007
#define N1 4000000
#define N2 2999999
int fact[N1+2], inv[N2+2], factinv[N2+2];
//#define getchar_unlocked() getchar()
int in()
{
int n = 0;
int c = getchar_unlocked();
do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
while (c >= '0');
return n;
}
int comb(int n, int k)
{
if (n < 0 || k < 0) return 0;
return (int)((long long)fact[n] * factinv[k] % M * factinv[n-k] % M);
}
int H(int n, int k)
{
if (!n && !k) return 1;
return comb(n+k-1, k);
}
int main()
{
int a, b, c, sx, sy, i;
long long ans, t;
fact[0] = 1; for (i = 1; i <= N1; i++)
fact[i] = (long long)fact[i-1] * i % M;
inv[1] = 1; for (i = 2; i <= N2; i++)
inv[i] = M - (M / i) * (long long)inv[M % i] % M;
factinv[0] = 1; for (i = 1; i <= N2; i++)
factinv[i] = (long long)factinv[i-1] * inv[i] % M;
while (1) {
a = in(), b = in(), c = in(), sx = in(), sy = in();
if ((a|b|c|sx|sy) == 0) break;
ans = 0;
for (i = a; i <= sx; i++) {
t = H(a, i-a);
t = t * H(b, sy-sx+i-b) % M;
t = t * H(a+b+c, sx-i) % M;
ans += t;
if (ans >= M) ans -= M;
}
ans = ans * comb(a+b+c, a) % M;
ans = ans * comb(b+c, b) % M;
printf("%d\n", (int)ans);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175561/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175561/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] }
@fact = dso_local local_unnamed_addr global [4000002 x i32] zeroinitializer, align 16
@factinv = dso_local local_unnamed_addr global [3000001 x i32] zeroinitializer, align 16
@inv = dso_local local_unnamed_addr global [3000001 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [4 x i8] c"%d\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) #4
%.pre17.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 ], [ %.pre17.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.exit16
%4 = phi ptr [ %8, %getchar_unlocked.exit16 ], [ %.ph, %do.body.preheader ]
%n.0 = phi i32 [ %add2, %getchar_unlocked.exit16 ], [ 0, %do.body.preheader ]
%c.0 = phi i32 [ %cond.i12, %getchar_unlocked.exit16 ], [ %c.0.ph, %do.body.preheader ]
%add = mul i32 %n.0, 10
%and = and i32 %c.0, 15
%add2 = add nsw i32 %and, %add
%_IO_read_ptr.i7 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i7, align 8, !tbaa !9
%_IO_read_end.i8 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i8, align 8, !tbaa !14
%cmp.not.i9 = icmp ult ptr %5, %6
br i1 %cmp.not.i9, label %cond.false.i13, label %cond.true.i10, !prof !15
cond.true.i10: ; preds = %do.body
%call.i11 = tail call i32 @__uflow(ptr noundef nonnull %4) #4
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit16
cond.false.i13: ; preds = %do.body
%incdec.ptr.i14 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i14, ptr %_IO_read_ptr.i7, align 8, !tbaa !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%conv3.i15 = zext i8 %7 to i32
br label %getchar_unlocked.exit16
getchar_unlocked.exit16: ; preds = %cond.true.i10, %cond.false.i13
%8 = phi ptr [ %.pre, %cond.true.i10 ], [ %4, %cond.false.i13 ]
%cond.i12 = phi i32 [ %call.i11, %cond.true.i10 ], [ %conv3.i15, %cond.false.i13 ]
%cmp = icmp sgt i32 %cond.i12, 47
br i1 %cmp, label %do.body, label %do.end, !llvm.loop !17
do.end: ; preds = %getchar_unlocked.exit16
ret i32 %add2
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @comb(i32 noundef %n, i32 noundef %k) local_unnamed_addr #1 {
entry:
%0 = or i32 %k, %n
%or.cond.not = icmp sgt i32 %0, -1
br i1 %or.cond.not, label %if.end, label %return
if.end: ; preds = %entry
%idxprom = zext i32 %n to i64
%arrayidx = getelementptr inbounds [4000002 x i32], ptr @fact, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !19
%conv = sext i32 %1 to i64
%idxprom2 = zext i32 %k to i64
%arrayidx3 = getelementptr inbounds [3000001 x i32], ptr @factinv, i64 0, i64 %idxprom2
%2 = load i32, ptr %arrayidx3, align 4, !tbaa !19
%conv4 = sext i32 %2 to i64
%mul = mul nsw i64 %conv4, %conv
%rem = srem i64 %mul, 1000000007
%sub = sub nsw i32 %n, %k
%idxprom5 = sext i32 %sub to i64
%arrayidx6 = getelementptr inbounds [3000001 x i32], ptr @factinv, i64 0, i64 %idxprom5
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !19
%conv7 = sext i32 %3 to i64
%mul8 = mul nsw i64 %rem, %conv7
%rem9 = srem i64 %mul8, 1000000007
%conv10 = trunc i64 %rem9 to i32
br label %return
return: ; preds = %entry, %if.end
%retval.0 = phi i32 [ %conv10, %if.end ], [ 0, %entry ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @H(i32 noundef %n, i32 noundef %k) local_unnamed_addr #1 {
entry:
%0 = or i32 %k, %n
%or.cond.not = icmp eq i32 %0, 0
br i1 %or.cond.not, label %return, label %if.end
if.end: ; preds = %entry
%add = add i32 %n, -1
%sub = add i32 %add, %k
%1 = or i32 %sub, %k
%or.cond.not.i = icmp sgt i32 %1, -1
br i1 %or.cond.not.i, label %if.end.i, label %return
if.end.i: ; preds = %if.end
%idxprom.i = zext i32 %sub to i64
%arrayidx.i = getelementptr inbounds [4000002 x i32], ptr @fact, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !19
%conv.i = sext i32 %2 to i64
%idxprom2.i = zext i32 %k to i64
%arrayidx3.i = getelementptr inbounds [3000001 x i32], ptr @factinv, i64 0, i64 %idxprom2.i
%3 = load i32, ptr %arrayidx3.i, align 4, !tbaa !19
%conv4.i = sext i32 %3 to i64
%mul.i = mul nsw i64 %conv4.i, %conv.i
%rem.i = srem i64 %mul.i, 1000000007
%idxprom5.i = sext i32 %add to i64
%arrayidx6.i = getelementptr inbounds [3000001 x i32], ptr @factinv, i64 0, i64 %idxprom5.i
%4 = load i32, ptr %arrayidx6.i, align 4, !tbaa !19
%conv7.i = sext i32 %4 to i64
%mul8.i = mul nsw i64 %rem.i, %conv7.i
%rem9.i = srem i64 %mul8.i, 1000000007
%conv10.i = trunc i64 %rem9.i to i32
br label %return
return: ; preds = %if.end.i, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ %conv10.i, %if.end.i ], [ 0, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
store i32 1, ptr @fact, align 16, !tbaa !19
br label %for.body
for.body: ; preds = %for.body, %entry
%conv = phi i64 [ 1, %entry ], [ %rem.1, %for.body ]
%indvars.iv = phi i64 [ 1, %entry ], [ %indvars.iv.next.1, %for.body ]
%mul = mul nsw i64 %conv, %indvars.iv
%rem = srem i64 %mul, 1000000007
%conv2 = trunc i64 %rem to i32
%arrayidx4 = getelementptr inbounds [4000002 x i32], ptr @fact, i64 0, i64 %indvars.iv
store i32 %conv2, ptr %arrayidx4, align 4, !tbaa !19
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%mul.1 = mul nsw i64 %rem, %indvars.iv.next
%rem.1 = srem i64 %mul.1, 1000000007
%conv2.1 = trunc i64 %rem.1 to i32
%arrayidx4.1 = getelementptr inbounds [4000002 x i32], ptr @fact, i64 0, i64 %indvars.iv.next
store i32 %conv2.1, ptr %arrayidx4.1, align 4, !tbaa !19
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 4000001
br i1 %exitcond.not.1, label %for.end, label %for.body, !llvm.loop !20
for.end: ; preds = %for.body
store i32 1, ptr getelementptr inbounds ([3000001 x i32], ptr @inv, i64 0, i64 1), align 4, !tbaa !19
br label %for.body8
for.body8: ; preds = %for.end, %for.body8
%indvars.iv337 = phi i64 [ 2, %for.end ], [ %indvars.iv.next338, %for.body8 ]
%0 = trunc i64 %indvars.iv337 to i32
%div = udiv i32 1000000007, %0
%conv9 = zext i32 %div to i64
%rem10 = urem i32 1000000007, %0
%idxprom11 = zext i32 %rem10 to i64
%arrayidx12 = getelementptr inbounds [3000001 x i32], ptr @inv, i64 0, i64 %idxprom11
%1 = load i32, ptr %arrayidx12, align 4, !tbaa !19
%conv13 = sext i32 %1 to i64
%mul14 = mul nsw i64 %conv13, %conv9
%rem15 = srem i64 %mul14, 1000000007
%2 = trunc i64 %rem15 to i32
%conv17 = sub nsw i32 1000000007, %2
%arrayidx19 = getelementptr inbounds [3000001 x i32], ptr @inv, i64 0, i64 %indvars.iv337
store i32 %conv17, ptr %arrayidx19, align 4, !tbaa !19
%indvars.iv.next338 = add nuw nsw i64 %indvars.iv337, 1
%exitcond340.not = icmp eq i64 %indvars.iv.next338, 3000000
br i1 %exitcond340.not, label %for.end22, label %for.body8, !llvm.loop !21
for.end22: ; preds = %for.body8
store i32 1, ptr @factinv, align 16, !tbaa !19
br label %for.body26
for.body26: ; preds = %for.body26.1, %for.end22
%conv30 = phi i64 [ 1, %for.end22 ], [ %rem35.1, %for.body26.1 ]
%indvars.iv341 = phi i64 [ 1, %for.end22 ], [ %indvars.iv.next342.1, %for.body26.1 ]
%arrayidx32 = getelementptr inbounds [3000001 x i32], ptr @inv, i64 0, i64 %indvars.iv341
%3 = load i32, ptr %arrayidx32, align 4, !tbaa !19
%conv33 = sext i32 %3 to i64
%mul34 = mul nsw i64 %conv30, %conv33
%rem35 = srem i64 %mul34, 1000000007
%conv36 = trunc i64 %rem35 to i32
%arrayidx38 = getelementptr inbounds [3000001 x i32], ptr @factinv, i64 0, i64 %indvars.iv341
store i32 %conv36, ptr %arrayidx38, align 4, !tbaa !19
%indvars.iv.next342 = add nuw nsw i64 %indvars.iv341, 1
%exitcond345.not = icmp eq i64 %indvars.iv.next342, 3000000
br i1 %exitcond345.not, label %while.cond, label %for.body26.1, !llvm.loop !22
for.body26.1: ; preds = %for.body26
%arrayidx32.1 = getelementptr inbounds [3000001 x i32], ptr @inv, i64 0, i64 %indvars.iv.next342
%4 = load i32, ptr %arrayidx32.1, align 4, !tbaa !19
%conv33.1 = sext i32 %4 to i64
%mul34.1 = mul nsw i64 %rem35, %conv33.1
%rem35.1 = srem i64 %mul34.1, 1000000007
%conv36.1 = trunc i64 %rem35.1 to i32
%arrayidx38.1 = getelementptr inbounds [3000001 x i32], ptr @factinv, i64 0, i64 %indvars.iv.next342
store i32 %conv36.1, ptr %arrayidx38.1, align 4, !tbaa !19
%indvars.iv.next342.1 = add nuw nsw i64 %indvars.iv341, 2
br label %for.body26
while.cond: ; preds = %for.body26, %comb.exit328
%5 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %5, i64 0, i32 1
%6 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %5, i64 0, i32 2
%7 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !14
%cmp.not.i.i = icmp ult ptr %6, %7
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 %5) #4
%.pre17.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 %6, i64 1
store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%8 = load i8, ptr %6, align 1, !tbaa !16
%conv3.i.i = zext i8 %8 to i32
br label %do.body.i.preheader
do.body.i.preheader: ; preds = %cond.false.i.i, %cond.true.i.i
%.ph356 = phi ptr [ %5, %cond.false.i.i ], [ %.pre17.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.exit16.i
%9 = phi ptr [ %13, %getchar_unlocked.exit16.i ], [ %.ph356, %do.body.i.preheader ]
%n.0.i = phi i32 [ %add2.i, %getchar_unlocked.exit16.i ], [ 0, %do.body.i.preheader ]
%c.0.i = phi i32 [ %cond.i12.i, %getchar_unlocked.exit16.i ], [ %c.0.i.ph, %do.body.i.preheader ]
%add.i = mul i32 %n.0.i, 10
%and.i = and i32 %c.0.i, 15
%add2.i = add nsw i32 %and.i, %add.i
%_IO_read_ptr.i7.i = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 1
%10 = load ptr, ptr %_IO_read_ptr.i7.i, align 8, !tbaa !9
%_IO_read_end.i8.i = getelementptr inbounds %struct._IO_FILE, ptr %9, i64 0, i32 2
%11 = load ptr, ptr %_IO_read_end.i8.i, align 8, !tbaa !14
%cmp.not.i9.i = icmp ult ptr %10, %11
br i1 %cmp.not.i9.i, label %cond.false.i13.i, label %cond.true.i10.i, !prof !15
cond.true.i10.i: ; preds = %do.body.i
%call.i11.i = tail call i32 @__uflow(ptr noundef nonnull %9) #4
%.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit16.i
cond.false.i13.i: ; preds = %do.body.i
%incdec.ptr.i14.i = getelementptr inbounds i8, ptr %10, i64 1
store ptr %incdec.ptr.i14.i, ptr %_IO_read_ptr.i7.i, align 8, !tbaa !9
%12 = load i8, ptr %10, align 1, !tbaa !16
%conv3.i15.i = zext i8 %12 to i32
br label %getchar_unlocked.exit16.i
getchar_unlocked.exit16.i: ; preds = %cond.false.i13.i, %cond.true.i10.i
%13 = phi ptr [ %.pre.i, %cond.true.i10.i ], [ %9, %cond.false.i13.i ]
%cond.i12.i = phi i32 [ %call.i11.i, %cond.true.i10.i ], [ %conv3.i15.i, %cond.false.i13.i ]
%cmp.i = icmp sgt i32 %cond.i12.i, 47
br i1 %cmp.i, label %do.body.i, label %in.exit, !llvm.loop !17
in.exit: ; preds = %getchar_unlocked.exit16.i
%_IO_read_ptr.i.i138 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 1
%14 = load ptr, ptr %_IO_read_ptr.i.i138, align 8, !tbaa !9
%_IO_read_end.i.i139 = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 2
%15 = load ptr, ptr %_IO_read_end.i.i139, align 8, !tbaa !14
%cmp.not.i.i140 = icmp ult ptr %14, %15
br i1 %cmp.not.i.i140, label %cond.false.i.i165, label %cond.true.i.i141, !prof !15
cond.true.i.i141: ; preds = %in.exit
%call.i.i142 = tail call i32 @__uflow(ptr noundef nonnull %13) #4
%.pre17.pre.i143 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i147.preheader
cond.false.i.i165: ; preds = %in.exit
%incdec.ptr.i.i166 = getelementptr inbounds i8, ptr %14, i64 1
store ptr %incdec.ptr.i.i166, ptr %_IO_read_ptr.i.i138, align 8, !tbaa !9
%16 = load i8, ptr %14, align 1, !tbaa !16
%conv3.i.i167 = zext i8 %16 to i32
br label %do.body.i147.preheader
do.body.i147.preheader: ; preds = %cond.false.i.i165, %cond.true.i.i141
%.ph355 = phi ptr [ %13, %cond.false.i.i165 ], [ %.pre17.pre.i143, %cond.true.i.i141 ]
%c.0.i149.ph = phi i32 [ %conv3.i.i167, %cond.false.i.i165 ], [ %call.i.i142, %cond.true.i.i141 ]
br label %do.body.i147
do.body.i147: ; preds = %do.body.i147.preheader, %getchar_unlocked.exit16.i159
%17 = phi ptr [ %21, %getchar_unlocked.exit16.i159 ], [ %.ph355, %do.body.i147.preheader ]
%n.0.i148 = phi i32 [ %add2.i152, %getchar_unlocked.exit16.i159 ], [ 0, %do.body.i147.preheader ]
%c.0.i149 = phi i32 [ %cond.i12.i160, %getchar_unlocked.exit16.i159 ], [ %c.0.i149.ph, %do.body.i147.preheader ]
%add.i150 = mul i32 %n.0.i148, 10
%and.i151 = and i32 %c.0.i149, 15
%add2.i152 = add nsw i32 %and.i151, %add.i150
%_IO_read_ptr.i7.i153 = getelementptr inbounds %struct._IO_FILE, ptr %17, i64 0, i32 1
%18 = load ptr, ptr %_IO_read_ptr.i7.i153, align 8, !tbaa !9
%_IO_read_end.i8.i154 = getelementptr inbounds %struct._IO_FILE, ptr %17, i64 0, i32 2
%19 = load ptr, ptr %_IO_read_end.i8.i154, align 8, !tbaa !14
%cmp.not.i9.i155 = icmp ult ptr %18, %19
br i1 %cmp.not.i9.i155, label %cond.false.i13.i162, label %cond.true.i10.i156, !prof !15
cond.true.i10.i156: ; preds = %do.body.i147
%call.i11.i157 = tail call i32 @__uflow(ptr noundef nonnull %17) #4
%.pre.i158 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit16.i159
cond.false.i13.i162: ; preds = %do.body.i147
%incdec.ptr.i14.i163 = getelementptr inbounds i8, ptr %18, i64 1
store ptr %incdec.ptr.i14.i163, ptr %_IO_read_ptr.i7.i153, align 8, !tbaa !9
%20 = load i8, ptr %18, align 1, !tbaa !16
%conv3.i15.i164 = zext i8 %20 to i32
br label %getchar_unlocked.exit16.i159
getchar_unlocked.exit16.i159: ; preds = %cond.false.i13.i162, %cond.true.i10.i156
%21 = phi ptr [ %.pre.i158, %cond.true.i10.i156 ], [ %17, %cond.false.i13.i162 ]
%cond.i12.i160 = phi i32 [ %call.i11.i157, %cond.true.i10.i156 ], [ %conv3.i15.i164, %cond.false.i13.i162 ]
%cmp.i161 = icmp sgt i32 %cond.i12.i160, 47
br i1 %cmp.i161, label %do.body.i147, label %in.exit168, !llvm.loop !17
in.exit168: ; preds = %getchar_unlocked.exit16.i159
%_IO_read_ptr.i.i169 = getelementptr inbounds %struct._IO_FILE, ptr %21, i64 0, i32 1
%22 = load ptr, ptr %_IO_read_ptr.i.i169, align 8, !tbaa !9
%_IO_read_end.i.i170 = getelementptr inbounds %struct._IO_FILE, ptr %21, i64 0, i32 2
%23 = load ptr, ptr %_IO_read_end.i.i170, align 8, !tbaa !14
%cmp.not.i.i171 = icmp ult ptr %22, %23
br i1 %cmp.not.i.i171, label %cond.false.i.i196, label %cond.true.i.i172, !prof !15
cond.true.i.i172: ; preds = %in.exit168
%call.i.i173 = tail call i32 @__uflow(ptr noundef nonnull %21) #4
%.pre17.pre.i174 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i178.preheader
cond.false.i.i196: ; preds = %in.exit168
%incdec.ptr.i.i197 = getelementptr inbounds i8, ptr %22, i64 1
store ptr %incdec.ptr.i.i197, ptr %_IO_read_ptr.i.i169, align 8, !tbaa !9
%24 = load i8, ptr %22, align 1, !tbaa !16
%conv3.i.i198 = zext i8 %24 to i32
br label %do.body.i178.preheader
do.body.i178.preheader: ; preds = %cond.false.i.i196, %cond.true.i.i172
%.ph354 = phi ptr [ %21, %cond.false.i.i196 ], [ %.pre17.pre.i174, %cond.true.i.i172 ]
%c.0.i180.ph = phi i32 [ %conv3.i.i198, %cond.false.i.i196 ], [ %call.i.i173, %cond.true.i.i172 ]
br label %do.body.i178
do.body.i178: ; preds = %do.body.i178.preheader, %getchar_unlocked.exit16.i190
%25 = phi ptr [ %29, %getchar_unlocked.exit16.i190 ], [ %.ph354, %do.body.i178.preheader ]
%n.0.i179 = phi i32 [ %add2.i183, %getchar_unlocked.exit16.i190 ], [ 0, %do.body.i178.preheader ]
%c.0.i180 = phi i32 [ %cond.i12.i191, %getchar_unlocked.exit16.i190 ], [ %c.0.i180.ph, %do.body.i178.preheader ]
%add.i181 = mul i32 %n.0.i179, 10
%and.i182 = and i32 %c.0.i180, 15
%add2.i183 = add nsw i32 %and.i182, %add.i181
%_IO_read_ptr.i7.i184 = getelementptr inbounds %struct._IO_FILE, ptr %25, i64 0, i32 1
%26 = load ptr, ptr %_IO_read_ptr.i7.i184, align 8, !tbaa !9
%_IO_read_end.i8.i185 = getelementptr inbounds %struct._IO_FILE, ptr %25, i64 0, i32 2
%27 = load ptr, ptr %_IO_read_end.i8.i185, align 8, !tbaa !14
%cmp.not.i9.i186 = icmp ult ptr %26, %27
br i1 %cmp.not.i9.i186, label %cond.false.i13.i193, label %cond.true.i10.i187, !prof !15
cond.true.i10.i187: ; preds = %do.body.i178
%call.i11.i188 = tail call i32 @__uflow(ptr noundef nonnull %25) #4
%.pre.i189 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit16.i190
cond.false.i13.i193: ; preds = %do.body.i178
%incdec.ptr.i14.i194 = getelementptr inbounds i8, ptr %26, i64 1
store ptr %incdec.ptr.i14.i194, ptr %_IO_read_ptr.i7.i184, align 8, !tbaa !9
%28 = load i8, ptr %26, align 1, !tbaa !16
%conv3.i15.i195 = zext i8 %28 to i32
br label %getchar_unlocked.exit16.i190
getchar_unlocked.exit16.i190: ; preds = %cond.false.i13.i193, %cond.true.i10.i187
%29 = phi ptr [ %.pre.i189, %cond.true.i10.i187 ], [ %25, %cond.false.i13.i193 ]
%cond.i12.i191 = phi i32 [ %call.i11.i188, %cond.true.i10.i187 ], [ %conv3.i15.i195, %cond.false.i13.i193 ]
%cmp.i192 = icmp sgt i32 %cond.i12.i191, 47
br i1 %cmp.i192, label %do.body.i178, label %in.exit199, !llvm.loop !17
in.exit199: ; preds = %getchar_unlocked.exit16.i190
%_IO_read_ptr.i.i200 = getelementptr inbounds %struct._IO_FILE, ptr %29, i64 0, i32 1
%30 = load ptr, ptr %_IO_read_ptr.i.i200, align 8, !tbaa !9
%_IO_read_end.i.i201 = getelementptr inbounds %struct._IO_FILE, ptr %29, i64 0, i32 2
%31 = load ptr, ptr %_IO_read_end.i.i201, align 8, !tbaa !14
%cmp.not.i.i202 = icmp ult ptr %30, %31
br i1 %cmp.not.i.i202, label %cond.false.i.i227, label %cond.true.i.i203, !prof !15
cond.true.i.i203: ; preds = %in.exit199
%call.i.i204 = tail call i32 @__uflow(ptr noundef nonnull %29) #4
%.pre17.pre.i205 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i209.preheader
cond.false.i.i227: ; preds = %in.exit199
%incdec.ptr.i.i228 = getelementptr inbounds i8, ptr %30, i64 1
store ptr %incdec.ptr.i.i228, ptr %_IO_read_ptr.i.i200, align 8, !tbaa !9
%32 = load i8, ptr %30, align 1, !tbaa !16
%conv3.i.i229 = zext i8 %32 to i32
br label %do.body.i209.preheader
do.body.i209.preheader: ; preds = %cond.false.i.i227, %cond.true.i.i203
%.ph353 = phi ptr [ %29, %cond.false.i.i227 ], [ %.pre17.pre.i205, %cond.true.i.i203 ]
%c.0.i211.ph = phi i32 [ %conv3.i.i229, %cond.false.i.i227 ], [ %call.i.i204, %cond.true.i.i203 ]
br label %do.body.i209
do.body.i209: ; preds = %do.body.i209.preheader, %getchar_unlocked.exit16.i221
%33 = phi ptr [ %37, %getchar_unlocked.exit16.i221 ], [ %.ph353, %do.body.i209.preheader ]
%n.0.i210 = phi i32 [ %add2.i214, %getchar_unlocked.exit16.i221 ], [ 0, %do.body.i209.preheader ]
%c.0.i211 = phi i32 [ %cond.i12.i222, %getchar_unlocked.exit16.i221 ], [ %c.0.i211.ph, %do.body.i209.preheader ]
%add.i212 = mul i32 %n.0.i210, 10
%and.i213 = and i32 %c.0.i211, 15
%add2.i214 = add nsw i32 %and.i213, %add.i212
%_IO_read_ptr.i7.i215 = getelementptr inbounds %struct._IO_FILE, ptr %33, i64 0, i32 1
%34 = load ptr, ptr %_IO_read_ptr.i7.i215, align 8, !tbaa !9
%_IO_read_end.i8.i216 = getelementptr inbounds %struct._IO_FILE, ptr %33, i64 0, i32 2
%35 = load ptr, ptr %_IO_read_end.i8.i216, align 8, !tbaa !14
%cmp.not.i9.i217 = icmp ult ptr %34, %35
br i1 %cmp.not.i9.i217, label %cond.false.i13.i224, label %cond.true.i10.i218, !prof !15
cond.true.i10.i218: ; preds = %do.body.i209
%call.i11.i219 = tail call i32 @__uflow(ptr noundef nonnull %33) #4
%.pre.i220 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit16.i221
cond.false.i13.i224: ; preds = %do.body.i209
%incdec.ptr.i14.i225 = getelementptr inbounds i8, ptr %34, i64 1
store ptr %incdec.ptr.i14.i225, ptr %_IO_read_ptr.i7.i215, align 8, !tbaa !9
%36 = load i8, ptr %34, align 1, !tbaa !16
%conv3.i15.i226 = zext i8 %36 to i32
br label %getchar_unlocked.exit16.i221
getchar_unlocked.exit16.i221: ; preds = %cond.false.i13.i224, %cond.true.i10.i218
%37 = phi ptr [ %.pre.i220, %cond.true.i10.i218 ], [ %33, %cond.false.i13.i224 ]
%cond.i12.i222 = phi i32 [ %call.i11.i219, %cond.true.i10.i218 ], [ %conv3.i15.i226, %cond.false.i13.i224 ]
%cmp.i223 = icmp sgt i32 %cond.i12.i222, 47
br i1 %cmp.i223, label %do.body.i209, label %in.exit230, !llvm.loop !17
in.exit230: ; preds = %getchar_unlocked.exit16.i221
%_IO_read_ptr.i.i231 = getelementptr inbounds %struct._IO_FILE, ptr %37, i64 0, i32 1
%38 = load ptr, ptr %_IO_read_ptr.i.i231, align 8, !tbaa !9
%_IO_read_end.i.i232 = getelementptr inbounds %struct._IO_FILE, ptr %37, i64 0, i32 2
%39 = load ptr, ptr %_IO_read_end.i.i232, align 8, !tbaa !14
%cmp.not.i.i233 = icmp ult ptr %38, %39
br i1 %cmp.not.i.i233, label %cond.false.i.i258, label %cond.true.i.i234, !prof !15
cond.true.i.i234: ; preds = %in.exit230
%call.i.i235 = tail call i32 @__uflow(ptr noundef nonnull %37) #4
%.pre17.pre.i236 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i240.preheader
cond.false.i.i258: ; preds = %in.exit230
%incdec.ptr.i.i259 = getelementptr inbounds i8, ptr %38, i64 1
store ptr %incdec.ptr.i.i259, ptr %_IO_read_ptr.i.i231, align 8, !tbaa !9
%40 = load i8, ptr %38, align 1, !tbaa !16
%conv3.i.i260 = zext i8 %40 to i32
br label %do.body.i240.preheader
do.body.i240.preheader: ; preds = %cond.false.i.i258, %cond.true.i.i234
%.ph = phi ptr [ %37, %cond.false.i.i258 ], [ %.pre17.pre.i236, %cond.true.i.i234 ]
%c.0.i242.ph = phi i32 [ %conv3.i.i260, %cond.false.i.i258 ], [ %call.i.i235, %cond.true.i.i234 ]
br label %do.body.i240
do.body.i240: ; preds = %do.body.i240.preheader, %getchar_unlocked.exit16.i252
%41 = phi ptr [ %45, %getchar_unlocked.exit16.i252 ], [ %.ph, %do.body.i240.preheader ]
%n.0.i241 = phi i32 [ %add2.i245, %getchar_unlocked.exit16.i252 ], [ 0, %do.body.i240.preheader ]
%c.0.i242 = phi i32 [ %cond.i12.i253, %getchar_unlocked.exit16.i252 ], [ %c.0.i242.ph, %do.body.i240.preheader ]
%add.i243 = mul i32 %n.0.i241, 10
%and.i244 = and i32 %c.0.i242, 15
%add2.i245 = add nsw i32 %and.i244, %add.i243
%_IO_read_ptr.i7.i246 = getelementptr inbounds %struct._IO_FILE, ptr %41, i64 0, i32 1
%42 = load ptr, ptr %_IO_read_ptr.i7.i246, align 8, !tbaa !9
%_IO_read_end.i8.i247 = getelementptr inbounds %struct._IO_FILE, ptr %41, i64 0, i32 2
%43 = load ptr, ptr %_IO_read_end.i8.i247, align 8, !tbaa !14
%cmp.not.i9.i248 = icmp ult ptr %42, %43
br i1 %cmp.not.i9.i248, label %cond.false.i13.i255, label %cond.true.i10.i249, !prof !15
cond.true.i10.i249: ; preds = %do.body.i240
%call.i11.i250 = tail call i32 @__uflow(ptr noundef nonnull %41) #4
%.pre.i251 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit16.i252
cond.false.i13.i255: ; preds = %do.body.i240
%incdec.ptr.i14.i256 = getelementptr inbounds i8, ptr %42, i64 1
store ptr %incdec.ptr.i14.i256, ptr %_IO_read_ptr.i7.i246, align 8, !tbaa !9
%44 = load i8, ptr %42, align 1, !tbaa !16
%conv3.i15.i257 = zext i8 %44 to i32
br label %getchar_unlocked.exit16.i252
getchar_unlocked.exit16.i252: ; preds = %cond.false.i13.i255, %cond.true.i10.i249
%45 = phi ptr [ %.pre.i251, %cond.true.i10.i249 ], [ %41, %cond.false.i13.i255 ]
%cond.i12.i253 = phi i32 [ %call.i11.i250, %cond.true.i10.i249 ], [ %conv3.i15.i257, %cond.false.i13.i255 ]
%cmp.i254 = icmp sgt i32 %cond.i12.i253, 47
br i1 %cmp.i254, label %do.body.i240, label %in.exit261, !llvm.loop !17
in.exit261: ; preds = %getchar_unlocked.exit16.i252
%or = or i32 %add2.i152, %add2.i
%or46 = or i32 %or, %add2.i183
%or47 = or i32 %or46, %add2.i214
%or48 = or i32 %or47, %add2.i245
%cmp49 = icmp eq i32 %or48, 0
br i1 %cmp49, label %while.end, label %for.cond51.preheader
for.cond51.preheader: ; preds = %in.exit261
%cmp52.not332 = icmp sgt i32 %add2.i, %add2.i214
br i1 %cmp52.not332, label %for.cond51.preheader.for.end79_crit_edge, label %for.body54.lr.ph
for.cond51.preheader.for.end79_crit_edge: ; preds = %for.cond51.preheader
%.pre = add nsw i32 %add2.i152, %add2.i
%.pre346 = add nsw i32 %.pre, %add2.i183
br label %for.end79
for.body54.lr.ph: ; preds = %for.cond51.preheader
%add.i262 = add i32 %add2.i, -1
%idxprom5.i.i = sext i32 %add.i262 to i64
%arrayidx6.i.i = getelementptr inbounds [3000001 x i32], ptr @factinv, i64 0, i64 %idxprom5.i.i
%46 = add i32 %add2.i214, %add2.i152
%47 = sub i32 %add2.i245, %46
%add.i265 = add i32 %add2.i152, -1
%idxprom5.i.i278 = sext i32 %add.i265 to i64
%arrayidx6.i.i279 = getelementptr inbounds [3000001 x i32], ptr @factinv, i64 0, i64 %idxprom5.i.i278
%add64 = add nsw i32 %add2.i152, %add2.i
%add65 = add nsw i32 %add64, %add2.i183
%add.i287 = add i32 %add65, -1
%idxprom5.i.i300 = sext i32 %add.i287 to i64
%arrayidx6.i.i301 = getelementptr inbounds [3000001 x i32], ptr @factinv, i64 0, i64 %idxprom5.i.i300
br label %for.body54
for.body54: ; preds = %for.body54.lr.ph, %H.exit306
%i.3334 = phi i32 [ %add2.i, %for.body54.lr.ph ], [ %inc78, %H.exit306 ]
%ans.0333 = phi i64 [ 0, %for.body54.lr.ph ], [ %spec.select, %H.exit306 ]
%sub55 = sub nsw i32 %i.3334, %add2.i
%48 = or i32 %sub55, %add2.i
%or.cond.not.i = icmp eq i32 %48, 0
br i1 %or.cond.not.i, label %H.exit, label %if.end.i
if.end.i: ; preds = %for.body54
%sub.i = add i32 %i.3334, -1
%49 = or i32 %sub.i, %sub55
%or.cond.not.i.i = icmp sgt i32 %49, -1
br i1 %or.cond.not.i.i, label %if.end.i.i, label %H.exit
if.end.i.i: ; preds = %if.end.i
%idxprom.i.i = zext i32 %sub.i to i64
%arrayidx.i.i = getelementptr inbounds [4000002 x i32], ptr @fact, i64 0, i64 %idxprom.i.i
%50 = load i32, ptr %arrayidx.i.i, align 4, !tbaa !19
%conv.i.i = sext i32 %50 to i64
%idxprom2.i.i = zext i32 %sub55 to i64
%arrayidx3.i.i = getelementptr inbounds [3000001 x i32], ptr @factinv, i64 0, i64 %idxprom2.i.i
%51 = load i32, ptr %arrayidx3.i.i, align 4, !tbaa !19
%conv4.i.i = sext i32 %51 to i64
%mul.i.i = mul nsw i64 %conv4.i.i, %conv.i.i
%rem.i.i = srem i64 %mul.i.i, 1000000007
%52 = load i32, ptr %arrayidx6.i.i, align 4, !tbaa !19
%conv7.i.i = sext i32 %52 to i64
%mul8.i.i = mul nsw i64 %rem.i.i, %conv7.i.i
%rem9.i.i = srem i64 %mul8.i.i, 1000000007
br label %H.exit
H.exit: ; preds = %for.body54, %if.end.i, %if.end.i.i
%retval.0.i = phi i64 [ 1, %for.body54 ], [ %rem9.i.i, %if.end.i.i ], [ 0, %if.end.i ]
%sub59 = add i32 %47, %i.3334
%53 = or i32 %sub59, %add2.i152
%or.cond.not.i263 = icmp eq i32 %53, 0
br i1 %or.cond.not.i263, label %H.exit284, label %if.end.i264
if.end.i264: ; preds = %H.exit
%sub.i266 = add i32 %sub59, %add.i265
%54 = or i32 %sub.i266, %sub59
%or.cond.not.i.i267 = icmp sgt i32 %54, -1
br i1 %or.cond.not.i.i267, label %if.end.i.i269, label %H.exit284
if.end.i.i269: ; preds = %if.end.i264
%idxprom.i.i270 = zext i32 %sub.i266 to i64
%arrayidx.i.i271 = getelementptr inbounds [4000002 x i32], ptr @fact, i64 0, i64 %idxprom.i.i270
%55 = load i32, ptr %arrayidx.i.i271, align 4, !tbaa !19
%conv.i.i272 = sext i32 %55 to i64
%idxprom2.i.i273 = zext i32 %sub59 to i64
%arrayidx3.i.i274 = getelementptr inbounds [3000001 x i32], ptr @factinv, i64 0, i64 %idxprom2.i.i273
%56 = load i32, ptr %arrayidx3.i.i274, align 4, !tbaa !19
%conv4.i.i275 = sext i32 %56 to i64
%mul.i.i276 = mul nsw i64 %conv4.i.i275, %conv.i.i272
%rem.i.i277 = srem i64 %mul.i.i276, 1000000007
%57 = load i32, ptr %arrayidx6.i.i279, align 4, !tbaa !19
%conv7.i.i280 = sext i32 %57 to i64
%mul8.i.i281 = mul nsw i64 %rem.i.i277, %conv7.i.i280
%rem9.i.i282 = srem i64 %mul8.i.i281, 1000000007
br label %H.exit284
H.exit284: ; preds = %H.exit, %if.end.i264, %if.end.i.i269
%retval.0.i268 = phi i64 [ 1, %H.exit ], [ %rem9.i.i282, %if.end.i.i269 ], [ 0, %if.end.i264 ]
%mul62 = mul nsw i64 %retval.0.i268, %retval.0.i
%rem63 = srem i64 %mul62, 1000000007
%sub66 = sub nsw i32 %add2.i214, %i.3334
%58 = or i32 %sub66, %add65
%or.cond.not.i285 = icmp eq i32 %58, 0
br i1 %or.cond.not.i285, label %H.exit306, label %if.end.i286
if.end.i286: ; preds = %H.exit284
%sub.i288 = add i32 %sub66, %add.i287
%59 = or i32 %sub.i288, %sub66
%or.cond.not.i.i289 = icmp sgt i32 %59, -1
br i1 %or.cond.not.i.i289, label %if.end.i.i291, label %H.exit306
if.end.i.i291: ; preds = %if.end.i286
%idxprom.i.i292 = zext i32 %sub.i288 to i64
%arrayidx.i.i293 = getelementptr inbounds [4000002 x i32], ptr @fact, i64 0, i64 %idxprom.i.i292
%60 = load i32, ptr %arrayidx.i.i293, align 4, !tbaa !19
%conv.i.i294 = sext i32 %60 to i64
%idxprom2.i.i295 = zext i32 %sub66 to i64
%arrayidx3.i.i296 = getelementptr inbounds [3000001 x i32], ptr @factinv, i64 0, i64 %idxprom2.i.i295
%61 = load i32, ptr %arrayidx3.i.i296, align 4, !tbaa !19
%conv4.i.i297 = sext i32 %61 to i64
%mul.i.i298 = mul nsw i64 %conv4.i.i297, %conv.i.i294
%rem.i.i299 = srem i64 %mul.i.i298, 1000000007
%62 = load i32, ptr %arrayidx6.i.i301, align 4, !tbaa !19
%conv7.i.i302 = sext i32 %62 to i64
%mul8.i.i303 = mul nsw i64 %rem.i.i299, %conv7.i.i302
%rem9.i.i304 = srem i64 %mul8.i.i303, 1000000007
br label %H.exit306
H.exit306: ; preds = %H.exit284, %if.end.i286, %if.end.i.i291
%retval.0.i290 = phi i64 [ 1, %H.exit284 ], [ %rem9.i.i304, %if.end.i.i291 ], [ 0, %if.end.i286 ]
%mul69 = mul nsw i64 %retval.0.i290, %rem63
%rem70 = srem i64 %mul69, 1000000007
%add71 = add nsw i64 %rem70, %ans.0333
%cmp72 = icmp sgt i64 %add71, 1000000006
%sub75 = add nsw i64 %add71, -1000000007
%spec.select = select i1 %cmp72, i64 %sub75, i64 %add71
%inc78 = add nsw i32 %i.3334, 1
%cmp52.not.not = icmp slt i32 %i.3334, %add2.i214
br i1 %cmp52.not.not, label %for.body54, label %for.end79, !llvm.loop !23
for.end79: ; preds = %H.exit306, %for.cond51.preheader.for.end79_crit_edge
%add81.pre-phi = phi i32 [ %.pre346, %for.cond51.preheader.for.end79_crit_edge ], [ %add65, %H.exit306 ]
%ans.0.lcssa = phi i64 [ 0, %for.cond51.preheader.for.end79_crit_edge ], [ %spec.select, %H.exit306 ]
%63 = or i32 %add81.pre-phi, %add2.i
%or.cond.not.i307 = icmp sgt i32 %63, -1
br i1 %or.cond.not.i307, label %if.end.i309, label %comb.exit
if.end.i309: ; preds = %for.end79
%idxprom.i = zext i32 %add81.pre-phi to i64
%arrayidx.i = getelementptr inbounds [4000002 x i32], ptr @fact, i64 0, i64 %idxprom.i
%64 = load i32, ptr %arrayidx.i, align 4, !tbaa !19
%conv.i = sext i32 %64 to i64
%idxprom2.i = zext i32 %add2.i to i64
%arrayidx3.i = getelementptr inbounds [3000001 x i32], ptr @factinv, i64 0, i64 %idxprom2.i
%65 = load i32, ptr %arrayidx3.i, align 4, !tbaa !19
%conv4.i = sext i32 %65 to i64
%mul.i = mul nsw i64 %conv4.i, %conv.i
%rem.i = srem i64 %mul.i, 1000000007
%sub.i310 = sub nsw i32 %add81.pre-phi, %add2.i
%idxprom5.i = sext i32 %sub.i310 to i64
%arrayidx6.i = getelementptr inbounds [3000001 x i32], ptr @factinv, i64 0, i64 %idxprom5.i
%66 = load i32, ptr %arrayidx6.i, align 4, !tbaa !19
%conv7.i = sext i32 %66 to i64
%mul8.i = mul nsw i64 %rem.i, %conv7.i
%rem9.i = srem i64 %mul8.i, 1000000007
br label %comb.exit
comb.exit: ; preds = %for.end79, %if.end.i309
%retval.0.i308 = phi i64 [ %rem9.i, %if.end.i309 ], [ 0, %for.end79 ]
%mul84 = mul nsw i64 %retval.0.i308, %ans.0.lcssa
%rem85 = srem i64 %mul84, 1000000007
%add86 = add nsw i32 %add2.i183, %add2.i152
%67 = or i32 %add86, %add2.i152
%or.cond.not.i311 = icmp sgt i32 %67, -1
br i1 %or.cond.not.i311, label %if.end.i313, label %comb.exit328
if.end.i313: ; preds = %comb.exit
%idxprom.i314 = zext i32 %add86 to i64
%arrayidx.i315 = getelementptr inbounds [4000002 x i32], ptr @fact, i64 0, i64 %idxprom.i314
%68 = load i32, ptr %arrayidx.i315, align 4, !tbaa !19
%conv.i316 = sext i32 %68 to i64
%idxprom2.i317 = zext i32 %add2.i152 to i64
%arrayidx3.i318 = getelementptr inbounds [3000001 x i32], ptr @factinv, i64 0, i64 %idxprom2.i317
%69 = load i32, ptr %arrayidx3.i318, align 4, !tbaa !19
%conv4.i319 = sext i32 %69 to i64
%mul.i320 = mul nsw i64 %conv4.i319, %conv.i316
%rem.i321 = srem i64 %mul.i320, 1000000007
%idxprom5.i322 = sext i32 %add2.i183 to i64
%arrayidx6.i323 = getelementptr inbounds [3000001 x i32], ptr @factinv, i64 0, i64 %idxprom5.i322
%70 = load i32, ptr %arrayidx6.i323, align 4, !tbaa !19
%conv7.i324 = sext i32 %70 to i64
%mul8.i325 = mul nsw i64 %rem.i321, %conv7.i324
%rem9.i326 = srem i64 %mul8.i325, 1000000007
br label %comb.exit328
comb.exit328: ; preds = %comb.exit, %if.end.i313
%retval.0.i312 = phi i64 [ %rem9.i326, %if.end.i313 ], [ 0, %comb.exit ]
%mul89 = mul nsw i64 %retval.0.i312, %rem85
%rem90 = srem i64 %mul89, 1000000007
%conv91 = trunc i64 %rem90 to i32
%call92 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %conv91)
br label %while.cond
while.end: ; preds = %in.exit261
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
declare i32 @__uflow(ptr noundef) local_unnamed_addr #3
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 nofree norecurse nosync nounwind willreturn 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 #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 = { "no-trapping-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 = !{!"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}
!23 = distinct !{!23, !18}
|
#include <stdio.h>
int main(void) {
char inbuf[1280];
int pos = 0;
/* 情報数読取り */
fgets(inbuf, sizeof(inbuf), stdin);
/* 大文字と小文字の置換 */
while (inbuf[pos] != EOF) {
char theChar = inbuf[pos];
if ((theChar >= 'a') && (theChar <= 'z'))
inbuf[pos] = theChar - 32;
else if ((theChar >= 'A') && (theChar <= 'Z'))
inbuf[pos] = theChar + 32;
pos++;
}
inbuf[pos] = 0;
printf("%s", inbuf);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175619/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175619/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%inbuf = alloca [1280 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1280, ptr nonnull %inbuf) #3
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %inbuf, i32 noundef 1280, ptr noundef %0)
%1 = load i8, ptr %inbuf, align 16, !tbaa !9
%cmp.not42 = icmp eq i8 %1, -1
br i1 %cmp.not42, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end26
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end26 ], [ 0, %entry ]
%2 = phi i8 [ %5, %if.end26 ], [ %1, %entry ]
%arrayidx44 = phi ptr [ %arrayidx, %if.end26 ], [ %inbuf, %entry ]
%3 = add i8 %2, -97
%or.cond = icmp ult i8 %3, 26
br i1 %or.cond, label %if.end26.sink.split, label %if.else
if.else: ; preds = %while.body
%4 = add i8 %2, -65
%or.cond31 = icmp ult i8 %4, 26
br i1 %or.cond31, label %if.end26.sink.split, label %if.end26
if.end26.sink.split: ; preds = %if.else, %while.body
%.sink = phi i8 [ -32, %while.body ], [ 32, %if.else ]
%add = add nsw i8 %2, %.sink
store i8 %add, ptr %arrayidx44, align 1, !tbaa !9
br label %if.end26
if.end26: ; preds = %if.end26.sink.split, %if.else
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [1280 x i8], ptr %inbuf, i64 0, i64 %indvars.iv.next
%5 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp.not = icmp eq i8 %5, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !10
while.end: ; preds = %if.end26, %entry
%arrayidx.lcssa = phi ptr [ %inbuf, %entry ], [ %arrayidx, %if.end26 ]
store i8 0, ptr %arrayidx.lcssa, align 1, !tbaa !9
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %inbuf)
call void @llvm.lifetime.end.p0(i64 1280, ptr nonnull %inbuf) #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 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 @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 = !{!"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 <stdlib.h>
void swap(int * a, int * b) {
int t = *a;
*a = *b;
*b = t;
}
int * rev(int * a, int sz, int first) {
for(int i = first; i < sz / 2; i++)
swap(&a[i], &a[sz - 1 - i]);
return a;
}
void print_array(int * a, int sz) {
for(int i = 0; i < sz - 1; i++)
printf("%d ", a[i]);
printf("%d\n", a[sz - 1]);
}
int main(int argc, const char * argv[]) {
int n;
scanf("%d", &n);
int * a = malloc(sizeof(int) * n);
for(int i = 0; i < n; i++)
scanf("%d", &a[i]);
for(int i = n / 2 - 1; i > 0; i--) {
if(i % 2) swap(&a[i], &a[n - i - 1]);
}
rev(a, n, 0);
print_array(a, n);
free(a);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_17567/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_17567/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 [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local ptr @rev(ptr noundef returned %a, i32 noundef %sz, i32 noundef %first) local_unnamed_addr #2 {
entry:
%div = sdiv i32 %sz, 2
%cmp10 = icmp sgt i32 %div, %first
br i1 %cmp10, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = sext i32 %first to i64
%wide.trip.count = sext i32 %div to i64
%1 = sub nsw i64 %wide.trip.count, %0
%xtraiter = and i64 %1, 1
%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
%arrayidx.prol = getelementptr inbounds i32, ptr %a, i64 %0
%2 = xor i32 %first, -1
%sub1.prol = add i32 %2, %sz
%idxprom2.prol = sext i32 %sub1.prol to i64
%arrayidx3.prol = getelementptr inbounds i32, ptr %a, i64 %idxprom2.prol
%3 = load i32, ptr %arrayidx.prol, align 4, !tbaa !5
%4 = load i32, ptr %arrayidx3.prol, align 4, !tbaa !5
store i32 %4, ptr %arrayidx.prol, align 4, !tbaa !5
store i32 %3, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nsw i64 %0, 1
br label %for.body.prol.loopexit
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader
%indvars.iv.unr = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next.prol, %for.body.prol ]
%5 = sub nsw i64 0, %wide.trip.count
%6 = xor i64 %0, %5
%7 = icmp eq i64 %6, -1
br i1 %7, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.body.prol.loopexit, %for.body, %entry
ret ptr %a
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%8 = trunc i64 %indvars.iv to i32
%9 = xor i32 %8, -1
%sub1 = add i32 %9, %sz
%idxprom2 = sext i32 %sub1 to i64
%arrayidx3 = getelementptr inbounds i32, ptr %a, i64 %idxprom2
%10 = load i32, ptr %arrayidx, align 4, !tbaa !5
%11 = load i32, ptr %arrayidx3, align 4, !tbaa !5
store i32 %11, ptr %arrayidx, align 4, !tbaa !5
store i32 %10, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next
%12 = trunc i64 %indvars.iv.next to i32
%13 = xor i32 %12, -1
%sub1.1 = add i32 %13, %sz
%idxprom2.1 = sext i32 %sub1.1 to i64
%arrayidx3.1 = getelementptr inbounds i32, ptr %a, i64 %idxprom2.1
%14 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%15 = load i32, ptr %arrayidx3.1, align 4, !tbaa !5
store i32 %15, ptr %arrayidx.1, align 4, !tbaa !5
store i32 %14, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nsw i64 %indvars.iv, 2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.cond.cleanup, label %for.body, !llvm.loop !9
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print_array(ptr nocapture noundef readonly %a, i32 noundef %sz) local_unnamed_addr #3 {
entry:
%sub = add i32 %sz, -1
%cmp9 = icmp sgt i32 %sz, 1
br i1 %cmp9, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %sub to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
%idxprom2 = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds i32, ptr %a, i64 %idxprom2
%0 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%call4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
ret void
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !11
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #5 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #9
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.body, label %for.cond.cleanup8.thread
for.cond.cleanup8.thread: ; preds = %entry
%sub.i63 = add i32 %0, -1
br label %print_array.exit
for.cond.cleanup: ; preds = %for.body
%div = sdiv i32 %.pr, 2
%cmp642 = icmp sgt i32 %.pr, 3
br i1 %cmp642, label %for.body9.preheader, label %for.cond.cleanup8
for.body9.preheader: ; preds = %for.cond.cleanup
%1 = sext i32 %div to i64
br label %for.body9
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%.pr = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %.pr to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !12
for.cond.cleanup8: ; preds = %for.inc16, %for.cond.cleanup
%cmp10.i = icmp sgt i32 %.pr, 1
br i1 %cmp10.i, label %for.body.preheader.i, label %rev.exit.thread
rev.exit.thread: ; preds = %for.cond.cleanup8
%sub.i61 = add i32 %.pr, -1
br label %print_array.exit
for.body.preheader.i: ; preds = %for.cond.cleanup8
%wide.trip.count.i = zext i32 %div to i64
%xtraiter = and i64 %wide.trip.count.i, 1
%3 = and i32 %.pr, -2
%4 = icmp eq i32 %3, 2
br i1 %4, label %rev.exit.unr-lcssa, label %for.body.preheader.i.new
for.body.preheader.i.new: ; preds = %for.body.preheader.i
%unroll_iter = and i64 %wide.trip.count.i, 4294967294
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i.new
%indvars.iv.i = phi i64 [ 0, %for.body.preheader.i.new ], [ %indvars.iv.next.i.1, %for.body.i ]
%niter = phi i64 [ 0, %for.body.preheader.i.new ], [ %niter.next.1, %for.body.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.i
%5 = trunc i64 %indvars.iv.i to i32
%6 = xor i32 %5, -1
%sub1.i = add i32 %.pr, %6
%idxprom2.i = sext i32 %sub1.i to i64
%arrayidx3.i = getelementptr inbounds i32, ptr %call1, i64 %idxprom2.i
%7 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%8 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
store i32 %8, ptr %arrayidx.i, align 4, !tbaa !5
store i32 %7, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next.i
%9 = trunc i64 %indvars.iv.next.i to i32
%10 = xor i32 %9, -1
%sub1.i.1 = add i32 %.pr, %10
%idxprom2.i.1 = sext i32 %sub1.i.1 to i64
%arrayidx3.i.1 = getelementptr inbounds i32, ptr %call1, i64 %idxprom2.i.1
%11 = load i32, ptr %arrayidx.i.1, align 4, !tbaa !5
%12 = load i32, ptr %arrayidx3.i.1, align 4, !tbaa !5
store i32 %12, ptr %arrayidx.i.1, align 4, !tbaa !5
store i32 %11, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 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 %rev.exit.unr-lcssa, label %for.body.i, !llvm.loop !9
rev.exit.unr-lcssa: ; preds = %for.body.i, %for.body.preheader.i
%indvars.iv.i.unr = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %rev.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %rev.exit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.i.unr
%13 = trunc i64 %indvars.iv.i.unr to i32
%14 = xor i32 %13, -1
%sub1.i.epil = add i32 %.pr, %14
%idxprom2.i.epil = sext i32 %sub1.i.epil to i64
%arrayidx3.i.epil = getelementptr inbounds i32, ptr %call1, i64 %idxprom2.i.epil
%15 = load i32, ptr %arrayidx.i.epil, align 4, !tbaa !5
%16 = load i32, ptr %arrayidx3.i.epil, align 4, !tbaa !5
store i32 %16, ptr %arrayidx.i.epil, align 4, !tbaa !5
store i32 %15, ptr %arrayidx3.i.epil, align 4, !tbaa !5
br label %rev.exit
rev.exit: ; preds = %rev.exit.unr-lcssa, %for.body.i.epil
%sub.i = add i32 %.pr, -1
br i1 %cmp10.i, label %for.body.preheader.i32, label %print_array.exit
for.body.preheader.i32: ; preds = %rev.exit
%wide.trip.count.i33 = zext i32 %sub.i to i64
br label %for.body.i34
for.body.i34: ; preds = %for.body.i34, %for.body.preheader.i32
%indvars.iv.i35 = phi i64 [ 0, %for.body.preheader.i32 ], [ %indvars.iv.next.i37, %for.body.i34 ]
%arrayidx.i36 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.i35
%17 = load i32, ptr %arrayidx.i36, align 4, !tbaa !5
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %17)
%indvars.iv.next.i37 = add nuw nsw i64 %indvars.iv.i35, 1
%exitcond.not.i38 = icmp eq i64 %indvars.iv.next.i37, %wide.trip.count.i33
br i1 %exitcond.not.i38, label %print_array.exit, label %for.body.i34, !llvm.loop !11
print_array.exit: ; preds = %for.body.i34, %for.cond.cleanup8.thread, %rev.exit.thread, %rev.exit
%sub.i62 = phi i32 [ %sub.i61, %rev.exit.thread ], [ %sub.i, %rev.exit ], [ %sub.i63, %for.cond.cleanup8.thread ], [ %sub.i, %for.body.i34 ]
%idxprom2.i30 = sext i32 %sub.i62 to i64
%arrayidx3.i31 = getelementptr inbounds i32, ptr %call1, i64 %idxprom2.i30
%18 = load i32, ptr %arrayidx3.i31, align 4, !tbaa !5
%call4.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %18)
call void @free(ptr noundef %call1) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
for.body9: ; preds = %for.body9.preheader, %for.inc16
%indvars.iv46 = phi i64 [ %1, %for.body9.preheader ], [ %indvars.iv.next47, %for.inc16 ]
%indvars.iv.next47 = add nsw i64 %indvars.iv46, -1
%rem65 = and i64 %indvars.iv.next47, 1
%tobool.not = icmp eq i64 %rem65, 0
br i1 %tobool.not, label %for.inc16, label %if.then
if.then: ; preds = %for.body9
%idxprom10 = and i64 %indvars.iv.next47, 4294967295
%arrayidx11 = getelementptr inbounds i32, ptr %call1, i64 %idxprom10
%19 = trunc i64 %indvars.iv46 to i32
%sub13 = sub i32 %.pr, %19
%idxprom14 = sext i32 %sub13 to i64
%arrayidx15 = getelementptr inbounds i32, ptr %call1, i64 %idxprom14
%20 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%21 = load i32, ptr %arrayidx15, align 4, !tbaa !5
store i32 %21, ptr %arrayidx11, align 4, !tbaa !5
store i32 %20, ptr %arrayidx15, align 4, !tbaa !5
br label %for.inc16
for.inc16: ; preds = %for.body9, %if.then
%cmp6 = icmp sgt i64 %indvars.iv46, 2
br i1 %cmp6, label %for.body9, label %for.cond.cleanup8, !llvm.loop !13
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #6
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #7
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#include<ctype.h>
int main(void)
{
char c;
while(1){
scanf("%c",&c);
if(c == '\n')break;
if(islower(c) != 0){
c = toupper(c);
printf("%c",c);
}else{
c = tolower(c);
printf("%c",c);
}
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175712/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175712/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"%c\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #5
%call29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%0 = load i8, ptr %c, align 1, !tbaa !5
%cmp30 = icmp eq i8 %0, 10
br i1 %cmp30, label %while.end, label %if.end.lr.ph
if.end.lr.ph: ; preds = %entry
%call2 = tail call ptr @__ctype_b_loc() #6
br label %if.end
if.end: ; preds = %if.end.lr.ph, %if.end24
%1 = phi i8 [ %0, %if.end.lr.ph ], [ %5, %if.end24 ]
%2 = load ptr, ptr %call2, align 8, !tbaa !8
%idxprom = sext i8 %1 to i64
%arrayidx = getelementptr inbounds i16, ptr %2, i64 %idxprom
%3 = load i16, ptr %arrayidx, align 2, !tbaa !10
%4 = and i16 %3, 512
%cmp5.not = icmp eq i16 %4, 0
br i1 %cmp5.not, label %if.else, label %if.then7
if.then7: ; preds = %if.end
%call8 = tail call ptr @__ctype_toupper_loc() #6
br label %if.end24
if.else: ; preds = %if.end
%call16 = tail call ptr @__ctype_tolower_loc() #6
br label %if.end24
if.end24: ; preds = %if.else, %if.then7
%.pn.in = phi ptr [ %call8, %if.then7 ], [ %call16, %if.else ]
%.pn = load ptr, ptr %.pn.in, align 8, !tbaa !8
%storemerge.in.in = getelementptr inbounds i32, ptr %.pn, i64 %idxprom
%storemerge.in = load i32, ptr %storemerge.in.in, align 4, !tbaa !12
%storemerge = trunc i32 %storemerge.in to i8
store i8 %storemerge, ptr %c, align 1, !tbaa !5
%sext = shl i32 %storemerge.in, 24
%conv22 = ashr exact i32 %sext, 24
%putchar = call i32 @putchar(i32 %conv22)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%5 = load i8, ptr %c, align 1, !tbaa !5
%cmp = icmp eq i8 %5, 10
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %if.end24, %entry
%putchar28 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 1, 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 nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #3
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_toupper_loc() 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 nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_tolower_loc() local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-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(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !6, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !6, i64 0}
|
#include <stdio.h>
#include <ctype.h>
int main(void)
{
char c;
while(scanf("%c", &c), c != '\n'){
if(isalpha(c)){
if(isupper(c)){
printf("%c", tolower(c));
}else{
printf("%c", toupper(c));
}
}else{
printf("%c", c);
}
}
puts("");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175763/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175763/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"%c\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #5
%call33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%0 = load i8, ptr %c, align 1, !tbaa !5
%cmp.not35 = icmp eq i8 %0, 10
br i1 %cmp.not35, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%call2 = tail call ptr @__ctype_b_loc() #6
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end28
%1 = phi i8 [ %0, %while.body.lr.ph ], [ %8, %if.end28 ]
%2 = load ptr, ptr %call2, align 8, !tbaa !8
%idxprom = sext i8 %1 to i64
%arrayidx = getelementptr inbounds i16, ptr %2, i64 %idxprom
%3 = load i16, ptr %arrayidx, align 2, !tbaa !10
%conv4 = zext i16 %3 to i32
%and = and i32 %conv4, 1024
%tobool.not = icmp eq i32 %and, 0
br i1 %tobool.not, label %if.else25, label %if.then
if.then: ; preds = %while.body
%and10 = and i32 %conv4, 256
%tobool11.not = icmp eq i32 %and10, 0
br i1 %tobool11.not, label %if.else, label %if.then12
if.then12: ; preds = %if.then
%call13 = tail call ptr @__ctype_tolower_loc() #6
%4 = load ptr, ptr %call13, align 8, !tbaa !8
%arrayidx16 = getelementptr inbounds i32, ptr %4, i64 %idxprom
%5 = load i32, ptr %arrayidx16, align 4, !tbaa !12
br label %if.end28
if.else: ; preds = %if.then
%call19 = tail call ptr @__ctype_toupper_loc() #6
%6 = load ptr, ptr %call19, align 8, !tbaa !8
%arrayidx22 = getelementptr inbounds i32, ptr %6, i64 %idxprom
%7 = load i32, ptr %arrayidx22, align 4, !tbaa !12
br label %if.end28
if.else25: ; preds = %while.body
%conv36 = sext i8 %1 to i32
br label %if.end28
if.end28: ; preds = %if.then12, %if.else, %if.else25
%.sink = phi i32 [ %5, %if.then12 ], [ %7, %if.else ], [ %conv36, %if.else25 ]
%putchar32 = call i32 @putchar(i32 %.sink)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%8 = load i8, ptr %c, align 1, !tbaa !5
%cmp.not = icmp eq i8 %8, 10
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %if.end28, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 1, 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 nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #3
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_tolower_loc() 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 nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_toupper_loc() local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-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(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !6, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !6, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int main(){
char ch;
scanf("%c",&ch);
while(!('\n'==ch)){
if(islower(ch)){
printf("%c",toupper(ch));}
else printf("%c",tolower(ch));
scanf("%c",&ch);
}
printf("\n");
return 0;} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175828/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175828/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"%c\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%ch = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %ch) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch)
%0 = load i8, ptr %ch, align 1, !tbaa !5
%cmp.not21 = icmp eq i8 %0, 10
br i1 %cmp.not21, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%call2 = tail call ptr @__ctype_b_loc() #6
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%1 = phi i8 [ %0, %while.body.lr.ph ], [ %7, %if.end ]
%2 = load ptr, ptr %call2, align 8, !tbaa !8
%idxprom = sext i8 %1 to i64
%arrayidx = getelementptr inbounds i16, ptr %2, i64 %idxprom
%3 = load i16, ptr %arrayidx, align 2, !tbaa !10
%4 = and i16 %3, 512
%tobool.not = icmp eq i16 %4, 0
br i1 %tobool.not, label %if.else, label %if.then
if.then: ; preds = %while.body
%call5 = tail call ptr @__ctype_toupper_loc() #6
br label %if.end
if.else: ; preds = %while.body
%call11 = tail call ptr @__ctype_tolower_loc() #6
br label %if.end
if.end: ; preds = %if.else, %if.then
%call11.sink = phi ptr [ %call11, %if.else ], [ %call5, %if.then ]
%5 = load ptr, ptr %call11.sink, align 8, !tbaa !8
%arrayidx14 = getelementptr inbounds i32, ptr %5, i64 %idxprom
%6 = load i32, ptr %arrayidx14, align 4, !tbaa !12
%putchar19 = call i32 @putchar(i32 %6)
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch)
%7 = load i8, ptr %ch, align 1, !tbaa !5
%cmp.not = icmp eq i8 %7, 10
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %if.end, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %ch) #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 nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #3
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_toupper_loc() 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 nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_tolower_loc() local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-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(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !6, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !6, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
|
/*
* a.c
*
* Created on: 2017/06/13
* Author: AWV060608
*/
#include <stdio.h>
#define MXCLEN 1200
int main(void)
{
int i;
//int str[MXCLEN];
char str[MXCLEN]={0};
fgets( str, MXCLEN, stdin);
for( i=0; i<MXCLEN; i++ )
{
if(str[i] == '\0')
break;
if( 65<=str[i] && str[i]<=90 )
{
str[i] = str[i] + 32;
}
else if( 97<=str[i] && str[i]<=122 )
{
str[i] = str[i] - 32;
}
printf("%c",str[i] );
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175879/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175879/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:
%str = alloca [1200 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %str) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1200) %str, i8 0, i64 1200, i1 false)
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 1200, ptr noundef %0)
br label %for.body
for.body: ; preds = %entry, %if.end39
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %if.end39 ]
%arrayidx = getelementptr inbounds [1200 x i8], ptr %str, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp1 = icmp eq i8 %1, 0
br i1 %cmp1, label %for.end, label %if.end
if.end: ; preds = %for.body
%2 = add i8 %1, -65
%or.cond = icmp ult i8 %2, 26
br i1 %or.cond, label %if.end39.sink.split, label %if.else
if.else: ; preds = %if.end
%3 = add i8 %1, -97
%or.cond55 = icmp ult i8 %3, 26
br i1 %or.cond55, label %if.end39.sink.split, label %if.end39
if.end39.sink.split: ; preds = %if.else, %if.end
%.sink = phi i8 [ 32, %if.end ], [ -32, %if.else ]
%add = add nsw i8 %1, %.sink
store i8 %add, ptr %arrayidx, align 1, !tbaa !9
br label %if.end39
if.end39: ; preds = %if.end39.sink.split, %if.else
%4 = phi i8 [ %1, %if.else ], [ %add, %if.end39.sink.split ]
%conv42 = sext i8 %4 to i32
%putchar = call i32 @putchar(i32 %conv42)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 1200
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.body, %if.end39
call void @llvm.lifetime.end.p0(i64 1200, 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: 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 ptr @fgets(ptr noundef, i32 noundef, 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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<ctype.h>
int main(void){
char c;
while(1){
scanf("%c",&c);
if(islower(c)){
c=toupper(c);
}else{
c=tolower(c);
}
printf("%c",c);
if(c=='\n')
break;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175921/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175921/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"%c\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #5
br label %while.cond
while.cond: ; preds = %if.end, %entry
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%call1 = tail call ptr @__ctype_b_loc() #6
%0 = load ptr, ptr %call1, align 8, !tbaa !5
%1 = load i8, ptr %c, align 1, !tbaa !9
%idxprom = sext i8 %1 to i64
%arrayidx = getelementptr inbounds i16, ptr %0, i64 %idxprom
%2 = load i16, ptr %arrayidx, align 2, !tbaa !10
%3 = and i16 %2, 512
%tobool.not = icmp eq i16 %3, 0
br i1 %tobool.not, label %if.else, label %if.then
if.then: ; preds = %while.cond
%call3 = tail call ptr @__ctype_toupper_loc() #6
br label %if.end
if.else: ; preds = %while.cond
%call9 = tail call ptr @__ctype_tolower_loc() #6
br label %if.end
if.end: ; preds = %if.else, %if.then
%.pn.in = phi ptr [ %call9, %if.else ], [ %call3, %if.then ]
%.pn = load ptr, ptr %.pn.in, align 8, !tbaa !5
%storemerge.in.in = getelementptr inbounds i32, ptr %.pn, i64 %idxprom
%storemerge.in = load i32, ptr %storemerge.in.in, align 4, !tbaa !12
%storemerge = trunc i32 %storemerge.in to i8
store i8 %storemerge, ptr %c, align 1, !tbaa !9
%sext = shl i32 %storemerge.in, 24
%conv15 = ashr exact i32 %sext, 24
%putchar = call i32 @putchar(i32 %conv15)
%4 = load i8, ptr %c, align 1, !tbaa !9
%cmp = icmp eq i8 %4, 10
br i1 %cmp, label %while.end, label %while.cond
while.end: ; preds = %if.end
call void @llvm.lifetime.end.p0(i64 1, 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 nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #3
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_toupper_loc() 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 nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_tolower_loc() local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-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(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !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 = !{!"short", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
|
#include <stdio.h>
#include <ctype.h>
int main(void){
char ch;
while(1){
scanf("%c",&ch);
if(isupper(ch)!=0){
ch=tolower(ch);
printf("%c",ch);
}else if(islower(ch)!=0){
ch=toupper(ch);
printf("%c",ch);
}else{
printf("%c",ch);
}
if(ch=='\n') break;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_175972/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_175972/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"%c\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%ch = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %ch) #5
br label %while.cond
while.cond: ; preds = %if.end32, %entry
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch)
%call1 = tail call ptr @__ctype_b_loc() #6
%0 = load ptr, ptr %call1, align 8, !tbaa !5
%1 = load i8, ptr %ch, align 1, !tbaa !9
%idxprom = sext i8 %1 to i64
%arrayidx = getelementptr inbounds i16, ptr %0, i64 %idxprom
%2 = load i16, ptr %arrayidx, align 2, !tbaa !10
%conv2 = zext i16 %2 to i32
%and = and i32 %conv2, 256
%cmp.not = icmp eq i32 %and, 0
br i1 %cmp.not, label %if.else, label %if.then
if.then: ; preds = %while.cond
%call4 = tail call ptr @__ctype_tolower_loc() #6
%3 = load ptr, ptr %call4, align 8, !tbaa !5
%arrayidx7 = getelementptr inbounds i32, ptr %3, i64 %idxprom
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !12
%conv8 = trunc i32 %4 to i8
store i8 %conv8, ptr %ch, align 1, !tbaa !9
%sext39 = shl i32 %4, 24
%conv9 = ashr exact i32 %sext39, 24
br label %if.end32
if.else: ; preds = %while.cond
%conv = sext i8 %1 to i32
%and16 = and i32 %conv2, 512
%cmp17.not = icmp eq i32 %and16, 0
br i1 %cmp17.not, label %if.end32, label %if.then19
if.then19: ; preds = %if.else
%call21 = tail call ptr @__ctype_toupper_loc() #6
%5 = load ptr, ptr %call21, align 8, !tbaa !5
%arrayidx24 = getelementptr inbounds i32, ptr %5, i64 %idxprom
%6 = load i32, ptr %arrayidx24, align 4, !tbaa !12
%conv26 = trunc i32 %6 to i8
store i8 %conv26, ptr %ch, align 1, !tbaa !9
%sext = shl i32 %6, 24
%conv27 = ashr exact i32 %sext, 24
br label %if.end32
if.end32: ; preds = %if.else, %if.then19, %if.then
%conv27.sink = phi i32 [ %conv27, %if.then19 ], [ %conv9, %if.then ], [ %conv, %if.else ]
%putchar38 = call i32 @putchar(i32 %conv27.sink)
%7 = load i8, ptr %ch, align 1, !tbaa !9
%cmp34 = icmp eq i8 %7, 10
br i1 %cmp34, label %while.end, label %while.cond
while.end: ; preds = %if.end32
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %ch) #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 nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #3
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_tolower_loc() 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 nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_toupper_loc() local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-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(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !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 = !{!"short", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
|
#include <stdio.h>
#include<string.h>
int main(void){
int i;
char str[1200];
scanf("%[^\n]",str);
for(i=0;i<=strlen(str);i++){
if(str[i]>=97&&str[i]<=122){
str[i]=str[i]-32;
}
else if(str[i]>=65&&str[i]<=90){
str[i]=str[i]+32;
}
else{
str[i]=str[i];
}
}printf("%s\n",str);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176014/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176014/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"%[^\0A]\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [1200 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %str) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
br label %for.body
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc ]
%arrayidx = getelementptr inbounds [1200 x i8], ptr %str, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%1 = add i8 %0, -97
%or.cond = icmp ult i8 %1, 26
br i1 %or.cond, label %for.inc.sink.split, label %if.else
if.else: ; preds = %for.body
%2 = add i8 %0, -65
%or.cond55 = icmp ult i8 %2, 26
br i1 %or.cond55, label %for.inc.sink.split, label %for.inc
for.inc.sink.split: ; preds = %if.else, %for.body
%.sink = phi i8 [ -32, %for.body ], [ 32, %if.else ]
%sub = add nsw i8 %0, %.sink
store i8 %sub, ptr %arrayidx, align 1, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.inc.sink.split, %if.else
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #6
%cmp.not.not = icmp ugt i64 %call2, %indvars.iv
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !8
for.end: ; preds = %for.inc
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str)
call void @llvm.lifetime.end.p0(i64 1200, 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}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int i, n;
char ch;
n = 'A'-'a';
while(1){
scanf("%c",&ch);
if('a' <= ch && ch <= 'z'){
ch += n;
} else if('A' <= ch && ch <= 'Z'){
ch -= n;
}
printf("%c",ch);
if(ch == '\n')break;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176058/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176058/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"%c\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%ch = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %ch) #4
br label %while.cond
while.cond: ; preds = %if.end17, %entry
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch)
%0 = load i8, ptr %ch, align 1
%1 = add i8 %0, -97
%or.cond = icmp ult i8 %1, 26
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %while.cond
%add = add nsw i8 %0, -32
store i8 %add, ptr %ch, align 1, !tbaa !5
br label %if.end17
if.else: ; preds = %while.cond
%2 = add i8 %0, -65
%or.cond25 = icmp ult i8 %2, 26
br i1 %or.cond25, label %if.then14, label %if.end17
if.then14: ; preds = %if.else
%sub = add nuw nsw i8 %0, 32
store i8 %sub, ptr %ch, align 1, !tbaa !5
br label %if.end17
if.end17: ; preds = %if.else, %if.then14, %if.then
%3 = phi i8 [ %0, %if.else ], [ %sub, %if.then14 ], [ %add, %if.then ]
%conv18 = sext i8 %3 to i32
%putchar = call i32 @putchar(i32 %conv18)
%4 = load i8, ptr %ch, align 1, !tbaa !5
%cmp21 = icmp eq i8 %4, 10
br i1 %cmp21, label %while.end, label %while.cond
while.end: ; preds = %if.end17
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %ch) #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
//======================================================================
// Contents : AOJ ITP1_8_A
// 与えられた文字列の小文字と大文字を入れ替える
// Input : 文字列を1行に与える
// Output : 与えられた文字列の小文字と大文字を入れ替えた文字列
// Constraints : 入力される文字列の長さ < 1200
// アルファベット以外の文字はそのまま出力
// Author : 廣部智也
// LastUpdate : 2020/07/23
// Since : 2020/07/13
//======================================================================
#include <stdio.h>
void Upper_lower_change( char str );
int main(){
char str = 'A';
while(1){
scanf("%c", &str );
if ( str == '\n' ){
break;
}
Upper_lower_change( str );
}
printf("\n");
return 0;
}
void Upper_lower_change( char str ){
if( str >= 'a' && str <= 'z' ){
str = str - ('a' - 'A');
}
else if( str >= 'A' && str <= 'Z' ){
str = str + ('a' - 'A');
}
printf("%c", str );
return;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176100/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176100/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"%c\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %str) #4
store i8 65, ptr %str, align 1, !tbaa !5
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%0 = load i8, ptr %str, align 1, !tbaa !5
%cmp4 = icmp eq i8 %0, 10
br i1 %cmp4, label %while.end, label %if.end
if.end: ; preds = %entry, %Upper_lower_change.exit
%1 = phi i8 [ %4, %Upper_lower_change.exit ], [ %0, %entry ]
%2 = add i8 %1, -97
%or.cond.i = icmp ult i8 %2, 26
br i1 %or.cond.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %if.end
%sub.i = add nsw i8 %1, -32
br label %Upper_lower_change.exit
if.else.i: ; preds = %if.end
%3 = add i8 %1, -65
%or.cond19.i = icmp ult i8 %3, 26
%add.i = add i8 %1, 32
%spec.select.i = select i1 %or.cond19.i, i8 %add.i, i8 %1
br label %Upper_lower_change.exit
Upper_lower_change.exit: ; preds = %if.then.i, %if.else.i
%str.addr.0.i = phi i8 [ %sub.i, %if.then.i ], [ %spec.select.i, %if.else.i ]
%conv18.i = sext i8 %str.addr.0.i to i32
%putchar.i = call i32 @putchar(i32 %conv18.i)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%4 = load i8, ptr %str, align 1, !tbaa !5
%cmp = icmp eq i8 %4, 10
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %Upper_lower_change.exit, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 1, 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: nofree nounwind uwtable
define dso_local void @Upper_lower_change(i8 noundef signext %str) local_unnamed_addr #0 {
entry:
%0 = add i8 %str, -97
%or.cond = icmp ult i8 %0, 26
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %entry
%sub = add nsw i8 %str, -32
br label %if.end17
if.else: ; preds = %entry
%1 = add i8 %str, -65
%or.cond19 = icmp ult i8 %1, 26
%add = add i8 %str, 32
%spec.select = select i1 %or.cond19, i8 %add, i8 %str
br label %if.end17
if.end17: ; preds = %if.else, %if.then
%str.addr.0 = phi i8 [ %sub, %if.then ], [ %spec.select, %if.else ]
%conv18 = sext i8 %str.addr.0 to i32
%putchar = tail call i32 @putchar(i32 %conv18)
ret void
}
; 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
int main(){
char ch;
do{
scanf("%c",&ch);
if(ch>='a'&&ch<='z'){
ch=ch-32;
}else if (ch>='A'&&ch<='Z'){
ch=ch+32;
}
printf("%c",ch);
}while(ch!='\n');
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176144/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176144/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"%c\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%ch = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %ch) #4
br label %do.body
do.body: ; preds = %if.end17, %entry
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch)
%0 = load i8, ptr %ch, align 1
%1 = add i8 %0, -97
%or.cond = icmp ult i8 %1, 26
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %do.body
%sub = add nsw i8 %0, -32
store i8 %sub, ptr %ch, align 1, !tbaa !5
br label %if.end17
if.else: ; preds = %do.body
%2 = add i8 %0, -65
%or.cond23 = icmp ult i8 %2, 26
br i1 %or.cond23, label %if.then14, label %if.end17
if.then14: ; preds = %if.else
%add = add nuw nsw i8 %0, 32
store i8 %add, ptr %ch, align 1, !tbaa !5
br label %if.end17
if.end17: ; preds = %if.else, %if.then14, %if.then
%3 = phi i8 [ %0, %if.else ], [ %add, %if.then14 ], [ %sub, %if.then ]
%conv18 = sext i8 %3 to i32
%putchar = call i32 @putchar(i32 %conv18)
%4 = load i8, ptr %ch, align 1, !tbaa !5
%cmp21.not = icmp eq i8 %4, 10
br i1 %cmp21.not, label %do.end, label %do.body, !llvm.loop !8
do.end: ; preds = %if.end17
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %ch) #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main() {
char ch;
while(1){
scanf("%c", &ch);
if('a' <= ch && ch <= 'z'){
printf("%c", ch - 32);
} else if('A' <= ch && ch <= 'Z'){
printf("%c", ch + 32);
} else {
printf("%c", ch);
}
if(ch == '\n') break;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176188/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176188/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"%c\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%ch = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %ch) #4
br label %while.cond
while.cond: ; preds = %if.end20, %entry
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch)
%0 = load i8, ptr %ch, align 1
%conv = sext i8 %0 to i32
%1 = add i8 %0, -97
%or.cond = icmp ult i8 %1, 26
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %while.cond
%sub = add nsw i32 %conv, -32
br label %if.end20
if.else: ; preds = %while.cond
%2 = add i8 %0, -65
%or.cond26 = icmp ult i8 %2, 26
%add = add nuw nsw i32 %conv, 32
%spec.select = select i1 %or.cond26, i32 %add, i32 %conv
br label %if.end20
if.end20: ; preds = %if.else, %if.then
%add.sink = phi i32 [ %sub, %if.then ], [ %spec.select, %if.else ]
%putchar27 = call i32 @putchar(i32 %add.sink)
%3 = load i8, ptr %ch, align 1, !tbaa !5
%cmp22 = icmp eq i8 %3, 10
br i1 %cmp22, label %while.end, label %while.cond
while.end: ; preds = %if.end20
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %ch) #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int c;
while (1) {
c = getchar();
if (c == EOF)
break;
if ('A' <= c && c <= 'Z')
putchar(c + 0x20);
else if ('a' <= c && c <= 'z')
putchar(c - 0x20);
else
putchar(c);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176230/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176230/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:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i25 = tail call i32 @getc(ptr noundef %0)
%cmp26 = icmp eq i32 %call.i25, -1
br i1 %cmp26, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end13
%call.i27 = phi i32 [ %call.i, %if.end13 ], [ %call.i25, %entry ]
%1 = add i32 %call.i27, -65
%or.cond = icmp ult i32 %1, 26
br i1 %or.cond, label %if.then3, label %if.else
if.then3: ; preds = %if.end
%add = add nuw nsw i32 %call.i27, 32
br label %if.end13
if.else: ; preds = %if.end
%2 = add i32 %call.i27, -97
%or.cond14 = icmp ult i32 %2, 26
%sub = add nsw i32 %call.i27, -32
%spec.select = select i1 %or.cond14, i32 %sub, i32 %call.i27
br label %if.end13
if.end13: ; preds = %if.else, %if.then3
%sub.sink = phi i32 [ %add, %if.then3 ], [ %spec.select, %if.else ]
%3 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i23 = tail call i32 @putc(i32 noundef %sub.sink, ptr noundef %3)
%4 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = tail call i32 @getc(ptr noundef %4)
%cmp = icmp eq i32 %call.i, -1
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %if.end13, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <string.h>
int main(void)
{
int i,len;
char str[1220];
scanf("%[^\n]",str);
len=strlen(str);
for(i=0;i<len;i++){
if('A'<=str[i] && str[i]<='Z'){
str[i]+=32;
}else if('a'<=str[i] && str[i]<='z'){
str[i]-=32;
}
}
printf("%s\n",str);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176274/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176274/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"%[^\0A]\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [1220 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1220, 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
%cmp43 = icmp sgt i32 %conv, 0
br i1 %cmp43, label %iter.check, label %for.end
iter.check: ; preds = %entry
%wide.trip.count = and i64 %call2, 4294967295
%min.iters.check = icmp ult i64 %wide.trip.count, 8
br i1 %min.iters.check, label %for.body.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %iter.check
%min.iters.check46 = icmp ult i64 %wide.trip.count, 16
br i1 %min.iters.check46, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.mod.vf = and i64 %call2, 15
%n.vec = sub nsw i64 %wide.trip.count, %n.mod.vf
br label %vector.body
vector.body: ; preds = %pred.store.continue76, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue76 ]
%0 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %index
%wide.load = load <16 x i8>, ptr %0, align 16, !tbaa !5
%1 = add <16 x i8> %wide.load, <i8 -65, i8 -65, i8 -65, i8 -65, i8 -65, i8 -65, i8 -65, i8 -65, i8 -65, i8 -65, i8 -65, i8 -65, i8 -65, i8 -65, i8 -65, i8 -65>
%2 = icmp ult <16 x i8> %1, <i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26>
%3 = add <16 x i8> %wide.load, <i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97>
%4 = icmp ult <16 x i8> %3, <i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26>
%5 = xor <16 x i1> %2, <i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true>
%6 = select <16 x i1> %5, <16 x i1> %4, <16 x i1> zeroinitializer
%predphi = select <16 x i1> %6, <16 x i8> <i8 -32, i8 -32, i8 -32, i8 -32, i8 -32, i8 -32, i8 -32, i8 -32, i8 -32, i8 -32, i8 -32, i8 -32, i8 -32, i8 -32, i8 -32, i8 -32>, <16 x i8> <i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32>
%7 = or <16 x i1> %6, %2
%8 = extractelement <16 x i1> %7, i64 0
br i1 %8, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body
%9 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %index
%10 = add nsw <16 x i8> %wide.load, %predphi
%11 = extractelement <16 x i8> %10, i64 0
store i8 %11, ptr %9, align 16, !tbaa !5
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body
%12 = extractelement <16 x i1> %7, i64 1
br i1 %12, label %pred.store.if47, label %pred.store.continue48
pred.store.if47: ; preds = %pred.store.continue
%13 = or i64 %index, 1
%14 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %13
%15 = add nsw <16 x i8> %wide.load, %predphi
%16 = extractelement <16 x i8> %15, i64 1
store i8 %16, ptr %14, align 1, !tbaa !5
br label %pred.store.continue48
pred.store.continue48: ; preds = %pred.store.if47, %pred.store.continue
%17 = extractelement <16 x i1> %7, i64 2
br i1 %17, label %pred.store.if49, label %pred.store.continue50
pred.store.if49: ; preds = %pred.store.continue48
%18 = or i64 %index, 2
%19 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %18
%20 = add nsw <16 x i8> %wide.load, %predphi
%21 = extractelement <16 x i8> %20, i64 2
store i8 %21, ptr %19, align 2, !tbaa !5
br label %pred.store.continue50
pred.store.continue50: ; preds = %pred.store.if49, %pred.store.continue48
%22 = extractelement <16 x i1> %7, i64 3
br i1 %22, label %pred.store.if51, label %pred.store.continue52
pred.store.if51: ; preds = %pred.store.continue50
%23 = or i64 %index, 3
%24 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %23
%25 = add nsw <16 x i8> %wide.load, %predphi
%26 = extractelement <16 x i8> %25, i64 3
store i8 %26, ptr %24, align 1, !tbaa !5
br label %pred.store.continue52
pred.store.continue52: ; preds = %pred.store.if51, %pred.store.continue50
%27 = extractelement <16 x i1> %7, i64 4
br i1 %27, label %pred.store.if53, label %pred.store.continue54
pred.store.if53: ; preds = %pred.store.continue52
%28 = or i64 %index, 4
%29 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %28
%30 = add nsw <16 x i8> %wide.load, %predphi
%31 = extractelement <16 x i8> %30, i64 4
store i8 %31, ptr %29, align 4, !tbaa !5
br label %pred.store.continue54
pred.store.continue54: ; preds = %pred.store.if53, %pred.store.continue52
%32 = extractelement <16 x i1> %7, i64 5
br i1 %32, label %pred.store.if55, label %pred.store.continue56
pred.store.if55: ; preds = %pred.store.continue54
%33 = or i64 %index, 5
%34 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %33
%35 = add nsw <16 x i8> %wide.load, %predphi
%36 = extractelement <16 x i8> %35, i64 5
store i8 %36, ptr %34, align 1, !tbaa !5
br label %pred.store.continue56
pred.store.continue56: ; preds = %pred.store.if55, %pred.store.continue54
%37 = extractelement <16 x i1> %7, i64 6
br i1 %37, label %pred.store.if57, label %pred.store.continue58
pred.store.if57: ; preds = %pred.store.continue56
%38 = or i64 %index, 6
%39 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %38
%40 = add nsw <16 x i8> %wide.load, %predphi
%41 = extractelement <16 x i8> %40, i64 6
store i8 %41, ptr %39, align 2, !tbaa !5
br label %pred.store.continue58
pred.store.continue58: ; preds = %pred.store.if57, %pred.store.continue56
%42 = extractelement <16 x i1> %7, i64 7
br i1 %42, label %pred.store.if59, label %pred.store.continue60
pred.store.if59: ; preds = %pred.store.continue58
%43 = or i64 %index, 7
%44 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %43
%45 = add nsw <16 x i8> %wide.load, %predphi
%46 = extractelement <16 x i8> %45, i64 7
store i8 %46, ptr %44, align 1, !tbaa !5
br label %pred.store.continue60
pred.store.continue60: ; preds = %pred.store.if59, %pred.store.continue58
%47 = extractelement <16 x i1> %7, i64 8
br i1 %47, label %pred.store.if61, label %pred.store.continue62
pred.store.if61: ; preds = %pred.store.continue60
%48 = or i64 %index, 8
%49 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %48
%50 = add nsw <16 x i8> %wide.load, %predphi
%51 = extractelement <16 x i8> %50, i64 8
store i8 %51, ptr %49, align 8, !tbaa !5
br label %pred.store.continue62
pred.store.continue62: ; preds = %pred.store.if61, %pred.store.continue60
%52 = extractelement <16 x i1> %7, i64 9
br i1 %52, label %pred.store.if63, label %pred.store.continue64
pred.store.if63: ; preds = %pred.store.continue62
%53 = or i64 %index, 9
%54 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %53
%55 = add nsw <16 x i8> %wide.load, %predphi
%56 = extractelement <16 x i8> %55, i64 9
store i8 %56, ptr %54, align 1, !tbaa !5
br label %pred.store.continue64
pred.store.continue64: ; preds = %pred.store.if63, %pred.store.continue62
%57 = extractelement <16 x i1> %7, i64 10
br i1 %57, label %pred.store.if65, label %pred.store.continue66
pred.store.if65: ; preds = %pred.store.continue64
%58 = or i64 %index, 10
%59 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %58
%60 = add nsw <16 x i8> %wide.load, %predphi
%61 = extractelement <16 x i8> %60, i64 10
store i8 %61, ptr %59, align 2, !tbaa !5
br label %pred.store.continue66
pred.store.continue66: ; preds = %pred.store.if65, %pred.store.continue64
%62 = extractelement <16 x i1> %7, i64 11
br i1 %62, label %pred.store.if67, label %pred.store.continue68
pred.store.if67: ; preds = %pred.store.continue66
%63 = or i64 %index, 11
%64 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %63
%65 = add nsw <16 x i8> %wide.load, %predphi
%66 = extractelement <16 x i8> %65, i64 11
store i8 %66, ptr %64, align 1, !tbaa !5
br label %pred.store.continue68
pred.store.continue68: ; preds = %pred.store.if67, %pred.store.continue66
%67 = extractelement <16 x i1> %7, i64 12
br i1 %67, label %pred.store.if69, label %pred.store.continue70
pred.store.if69: ; preds = %pred.store.continue68
%68 = or i64 %index, 12
%69 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %68
%70 = add nsw <16 x i8> %wide.load, %predphi
%71 = extractelement <16 x i8> %70, i64 12
store i8 %71, ptr %69, align 4, !tbaa !5
br label %pred.store.continue70
pred.store.continue70: ; preds = %pred.store.if69, %pred.store.continue68
%72 = extractelement <16 x i1> %7, i64 13
br i1 %72, label %pred.store.if71, label %pred.store.continue72
pred.store.if71: ; preds = %pred.store.continue70
%73 = or i64 %index, 13
%74 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %73
%75 = add nsw <16 x i8> %wide.load, %predphi
%76 = extractelement <16 x i8> %75, i64 13
store i8 %76, ptr %74, align 1, !tbaa !5
br label %pred.store.continue72
pred.store.continue72: ; preds = %pred.store.if71, %pred.store.continue70
%77 = extractelement <16 x i1> %7, i64 14
br i1 %77, label %pred.store.if73, label %pred.store.continue74
pred.store.if73: ; preds = %pred.store.continue72
%78 = or i64 %index, 14
%79 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %78
%80 = add nsw <16 x i8> %wide.load, %predphi
%81 = extractelement <16 x i8> %80, i64 14
store i8 %81, ptr %79, align 2, !tbaa !5
br label %pred.store.continue74
pred.store.continue74: ; preds = %pred.store.if73, %pred.store.continue72
%82 = extractelement <16 x i1> %7, i64 15
br i1 %82, label %pred.store.if75, label %pred.store.continue76
pred.store.if75: ; preds = %pred.store.continue74
%83 = or i64 %index, 15
%84 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %83
%85 = add nsw <16 x i8> %wide.load, %predphi
%86 = extractelement <16 x i8> %85, i64 15
store i8 %86, ptr %84, align 1, !tbaa !5
br label %pred.store.continue76
pred.store.continue76: ; preds = %pred.store.if75, %pred.store.continue74
%index.next = add nuw i64 %index, 16
%87 = icmp eq i64 %index.next, %n.vec
br i1 %87, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %pred.store.continue76
%cmp.n = icmp eq i64 %n.mod.vf, 0
br i1 %cmp.n, label %for.end, 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.vf77 = and i64 %call2, 7
%n.vec78 = sub nsw i64 %wide.trip.count, %n.mod.vf77
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %pred.store.continue98, %vec.epilog.ph
%index80 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next99, %pred.store.continue98 ]
%88 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %index80
%wide.load81 = load <8 x i8>, ptr %88, align 1, !tbaa !5
%89 = add <8 x i8> %wide.load81, <i8 -65, i8 -65, i8 -65, i8 -65, i8 -65, i8 -65, i8 -65, i8 -65>
%90 = icmp ult <8 x i8> %89, <i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26>
%91 = add <8 x i8> %wide.load81, <i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97, i8 -97>
%92 = icmp ult <8 x i8> %91, <i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26, i8 26>
%93 = xor <8 x i1> %90, <i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true>
%94 = select <8 x i1> %93, <8 x i1> %92, <8 x i1> zeroinitializer
%predphi82 = select <8 x i1> %94, <8 x i8> <i8 -32, i8 -32, i8 -32, i8 -32, i8 -32, i8 -32, i8 -32, i8 -32>, <8 x i8> <i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32>
%95 = or <8 x i1> %94, %90
%96 = extractelement <8 x i1> %95, i64 0
br i1 %96, label %pred.store.if83, label %pred.store.continue84
pred.store.if83: ; preds = %vec.epilog.vector.body
%97 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %index80
%98 = add nsw <8 x i8> %wide.load81, %predphi82
%99 = extractelement <8 x i8> %98, i64 0
store i8 %99, ptr %97, align 1, !tbaa !5
br label %pred.store.continue84
pred.store.continue84: ; preds = %pred.store.if83, %vec.epilog.vector.body
%100 = extractelement <8 x i1> %95, i64 1
br i1 %100, label %pred.store.if85, label %pred.store.continue86
pred.store.if85: ; preds = %pred.store.continue84
%101 = add i64 %index80, 1
%102 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %101
%103 = add nsw <8 x i8> %wide.load81, %predphi82
%104 = extractelement <8 x i8> %103, i64 1
store i8 %104, ptr %102, align 1, !tbaa !5
br label %pred.store.continue86
pred.store.continue86: ; preds = %pred.store.if85, %pred.store.continue84
%105 = extractelement <8 x i1> %95, i64 2
br i1 %105, label %pred.store.if87, label %pred.store.continue88
pred.store.if87: ; preds = %pred.store.continue86
%106 = add i64 %index80, 2
%107 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %106
%108 = add nsw <8 x i8> %wide.load81, %predphi82
%109 = extractelement <8 x i8> %108, i64 2
store i8 %109, ptr %107, align 1, !tbaa !5
br label %pred.store.continue88
pred.store.continue88: ; preds = %pred.store.if87, %pred.store.continue86
%110 = extractelement <8 x i1> %95, i64 3
br i1 %110, label %pred.store.if89, label %pred.store.continue90
pred.store.if89: ; preds = %pred.store.continue88
%111 = add i64 %index80, 3
%112 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %111
%113 = add nsw <8 x i8> %wide.load81, %predphi82
%114 = extractelement <8 x i8> %113, i64 3
store i8 %114, ptr %112, align 1, !tbaa !5
br label %pred.store.continue90
pred.store.continue90: ; preds = %pred.store.if89, %pred.store.continue88
%115 = extractelement <8 x i1> %95, i64 4
br i1 %115, label %pred.store.if91, label %pred.store.continue92
pred.store.if91: ; preds = %pred.store.continue90
%116 = add i64 %index80, 4
%117 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %116
%118 = add nsw <8 x i8> %wide.load81, %predphi82
%119 = extractelement <8 x i8> %118, i64 4
store i8 %119, ptr %117, align 1, !tbaa !5
br label %pred.store.continue92
pred.store.continue92: ; preds = %pred.store.if91, %pred.store.continue90
%120 = extractelement <8 x i1> %95, i64 5
br i1 %120, label %pred.store.if93, label %pred.store.continue94
pred.store.if93: ; preds = %pred.store.continue92
%121 = add i64 %index80, 5
%122 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %121
%123 = add nsw <8 x i8> %wide.load81, %predphi82
%124 = extractelement <8 x i8> %123, i64 5
store i8 %124, ptr %122, align 1, !tbaa !5
br label %pred.store.continue94
pred.store.continue94: ; preds = %pred.store.if93, %pred.store.continue92
%125 = extractelement <8 x i1> %95, i64 6
br i1 %125, label %pred.store.if95, label %pred.store.continue96
pred.store.if95: ; preds = %pred.store.continue94
%126 = add i64 %index80, 6
%127 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %126
%128 = add nsw <8 x i8> %wide.load81, %predphi82
%129 = extractelement <8 x i8> %128, i64 6
store i8 %129, ptr %127, align 1, !tbaa !5
br label %pred.store.continue96
pred.store.continue96: ; preds = %pred.store.if95, %pred.store.continue94
%130 = extractelement <8 x i1> %95, i64 7
br i1 %130, label %pred.store.if97, label %pred.store.continue98
pred.store.if97: ; preds = %pred.store.continue96
%131 = add i64 %index80, 7
%132 = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %131
%133 = add nsw <8 x i8> %wide.load81, %predphi82
%134 = extractelement <8 x i8> %133, i64 7
store i8 %134, ptr %132, align 1, !tbaa !5
br label %pred.store.continue98
pred.store.continue98: ; preds = %pred.store.if97, %pred.store.continue96
%index.next99 = add nuw i64 %index80, 8
%135 = icmp eq i64 %index.next99, %n.vec78
br i1 %135, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !12
vec.epilog.middle.block: ; preds = %pred.store.continue98
%cmp.n79 = icmp eq i64 %n.mod.vf77, 0
br i1 %cmp.n79, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec78, %vec.epilog.middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %indvars.iv.ph, %for.body.preheader ]
%arrayidx = getelementptr inbounds [1220 x i8], ptr %str, i64 0, i64 %indvars.iv
%136 = load i8, ptr %arrayidx, align 1, !tbaa !5
%137 = add i8 %136, -65
%or.cond = icmp ult i8 %137, 26
br i1 %or.cond, label %for.inc.sink.split, label %if.else
if.else: ; preds = %for.body
%138 = add i8 %136, -97
%or.cond42 = icmp ult i8 %138, 26
br i1 %or.cond42, label %for.inc.sink.split, label %for.inc
for.inc.sink.split: ; preds = %if.else, %for.body
%.sink = phi i8 [ 32, %for.body ], [ -32, %if.else ]
%add = add nsw i8 %136, %.sink
store i8 %add, ptr %arrayidx, align 1, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.inc.sink.split, %if.else
%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 !13
for.end: ; preds = %for.inc, %middle.block, %vec.epilog.middle.block, %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str)
call void @llvm.lifetime.end.p0(i64 1220, 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, !9, !11, !10}
|
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main(void) {
int i;
char string[1200];
fgets(string,sizeof(string),stdin);
for (i=0; i<strlen(string); i++) {
if (isalpha(string[i])) {
if (islower(string[i])) {
printf("%c",toupper(string[i]));
} else {
printf("%c",tolower(string[i]));
}
} else {
printf("%c",string[i]);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176317/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176317/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:
%string = alloca [1200 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %string) #6
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %string, i32 noundef 1200, ptr noundef %0)
%char0 = load i8, ptr %string, align 16
%cmp50.not = icmp eq i8 %char0, 0
br i1 %cmp50.not, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%call4 = tail call ptr @__ctype_b_loc() #7
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%1 = load ptr, ptr %call4, align 8, !tbaa !5
%arrayidx = getelementptr inbounds [1200 x i8], ptr %string, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 1, !tbaa !9
%idxprom6 = sext i8 %2 to i64
%arrayidx7 = getelementptr inbounds i16, ptr %1, i64 %idxprom6
%3 = load i16, ptr %arrayidx7, align 2, !tbaa !10
%conv8 = zext i16 %3 to i32
%and = and i32 %conv8, 1024
%tobool.not = icmp eq i32 %and, 0
br i1 %tobool.not, label %if.else35, label %if.then
if.then: ; preds = %for.body
%and16 = and i32 %conv8, 512
%tobool17.not = icmp eq i32 %and16, 0
br i1 %tobool17.not, label %if.else, label %if.then18
if.then18: ; preds = %if.then
%call19 = tail call ptr @__ctype_toupper_loc() #7
%4 = load ptr, ptr %call19, align 8, !tbaa !5
%arrayidx24 = getelementptr inbounds i32, ptr %4, i64 %idxprom6
%5 = load i32, ptr %arrayidx24, align 4, !tbaa !12
br label %for.inc
if.else: ; preds = %if.then
%call27 = tail call ptr @__ctype_tolower_loc() #7
%6 = load ptr, ptr %call27, align 8, !tbaa !5
%arrayidx32 = getelementptr inbounds i32, ptr %6, i64 %idxprom6
%7 = load i32, ptr %arrayidx32, align 4, !tbaa !12
br label %for.inc
if.else35: ; preds = %for.body
%conv5 = sext i8 %2 to i32
br label %for.inc
for.inc: ; preds = %if.else35, %if.else, %if.then18
%conv5.sink = phi i32 [ %conv5, %if.else35 ], [ %7, %if.else ], [ %5, %if.then18 ]
%putchar = call i32 @putchar(i32 %conv5.sink)
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %string) #8
%cmp = icmp ugt i64 %call2, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !14
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %string) #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 nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #4
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_toupper_loc() 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: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_tolower_loc() local_unnamed_addr #4
; 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 = { 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 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-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(none) }
attributes #8 = { 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 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int h, w, k;
scanf("%d%d%d",&h,&w,&k);
char c[h][w];
for(int i = 0; i < h; i++)
scanf("%s",c[i]);
int ans = 0;
for(int i = 0; i < (1 << h); i++){
for(int j = 0; j < (1 << w); j++){
int b = 0;
for(int l = 0; l < h; l++){
for(int p = 0; p < w; p++){
if(((i >> l) & 1) == 0 && ((j >> p) & 1) == 0 && c[l][p] == '#')
b ++;
}
}
if(b == k)
ans ++;
}
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176403/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176403/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 [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w, ptr noundef nonnull %k)
%0 = load i32, ptr %h, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = load i32, ptr %w, align 4, !tbaa !5
%3 = zext i32 %2 to i64
%4 = call ptr @llvm.stacksave.p0()
%5 = mul nuw i64 %3, %1
%vla = alloca i8, i64 %5, align 16
%6 = load i32, ptr %h, align 4, !tbaa !5
%cmp65 = icmp sgt i32 %6, 0
br i1 %cmp65, label %for.body, label %for.cond7.preheader.lr.ph
for.cond3.preheader: ; preds = %for.body
%cmp494.not = icmp eq i32 %31, 31
br i1 %cmp494.not, label %for.cond.cleanup5, label %for.cond7.preheader.lr.ph
for.cond7.preheader.lr.ph: ; preds = %entry, %for.cond3.preheader
%.lcssa144 = phi i32 [ %31, %for.cond3.preheader ], [ %6, %entry ]
%7 = load i32, ptr %w, align 4, !tbaa !5
%cmp982.not = icmp eq i32 %7, 31
%cmp1767 = icmp sgt i32 %7, 0
%8 = load i32, ptr %k, align 4
%cmp38 = icmp eq i32 %8, 0
br i1 %cmp982.not, label %for.cond.cleanup5, label %for.cond7.preheader.lr.ph.split.us
for.cond7.preheader.lr.ph.split.us: ; preds = %for.cond7.preheader.lr.ph
%shl8 = shl nuw i32 1, %7
%shl145 = shl nuw i32 1, %.lcssa144
%cmp1371 = icmp sgt i32 %.lcssa144, 0
%smax137 = call i32 @llvm.smax.i32(i32 %shl8, i32 1)
%smax139 = call i32 @llvm.smax.i32(i32 %shl145, i32 1)
br i1 %cmp1371, label %for.cond7.preheader.lr.ph.split.us.split.us, label %for.cond7.preheader.us.preheader
for.cond7.preheader.us.preheader: ; preds = %for.cond7.preheader.lr.ph.split.us
%9 = mul i32 %smax137, %smax139
%10 = select i1 %cmp38, i32 %9, i32 0
br label %for.cond.cleanup5
for.cond7.preheader.lr.ph.split.us.split.us: ; preds = %for.cond7.preheader.lr.ph.split.us
br i1 %cmp1767, label %for.cond7.preheader.us.us.us.preheader, label %for.cond7.preheader.us.us.preheader
for.cond7.preheader.us.us.preheader: ; preds = %for.cond7.preheader.lr.ph.split.us.split.us
%11 = mul i32 %smax137, %smax139
%12 = select i1 %cmp38, i32 %11, i32 0
br label %for.cond.cleanup5
for.cond7.preheader.us.us.us.preheader: ; preds = %for.cond7.preheader.lr.ph.split.us.split.us
%wide.trip.count135 = zext i32 %.lcssa144 to i64
%wide.trip.count = zext i32 %7 to i64
%xtraiter = and i64 %wide.trip.count, 1
%13 = icmp eq i32 %7, 1
%unroll_iter = and i64 %wide.trip.count, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond7.preheader.us.us.us
for.cond7.preheader.us.us.us: ; preds = %for.cond7.preheader.us.us.us.preheader, %for.cond7.for.cond.cleanup10_crit_edge.split.us.split.us.us.us.us
%i2.096.us.us.us = phi i32 [ %inc47.us.us.us, %for.cond7.for.cond.cleanup10_crit_edge.split.us.split.us.us.us.us ], [ 0, %for.cond7.preheader.us.us.us.preheader ]
%ans.095.us.us.us = phi i32 [ %spec.select.us.us.us.us.us, %for.cond7.for.cond.cleanup10_crit_edge.split.us.split.us.us.us.us ], [ 0, %for.cond7.preheader.us.us.us.preheader ]
br label %for.cond12.preheader.us.us.us.us.us
for.cond12.preheader.us.us.us.us.us: ; preds = %for.cond12.for.cond.cleanup14_crit_edge.split.us.us.us.us.us.us, %for.cond7.preheader.us.us.us
%j.084.us.us.us.us.us = phi i32 [ 0, %for.cond7.preheader.us.us.us ], [ %inc44.us.us.us.us.us, %for.cond12.for.cond.cleanup14_crit_edge.split.us.us.us.us.us.us ]
%ans.183.us.us.us.us.us = phi i32 [ %ans.095.us.us.us, %for.cond7.preheader.us.us.us ], [ %spec.select.us.us.us.us.us, %for.cond12.for.cond.cleanup14_crit_edge.split.us.us.us.us.us.us ]
br label %for.cond16.preheader.us.us.us.us.us.us
for.cond16.preheader.us.us.us.us.us.us: ; preds = %for.cond16.for.cond.cleanup18_crit_edge.us.us.us.us.us.us, %for.cond12.preheader.us.us.us.us.us
%indvars.iv132 = phi i64 [ %indvars.iv.next133, %for.cond16.for.cond.cleanup18_crit_edge.us.us.us.us.us.us ], [ 0, %for.cond12.preheader.us.us.us.us.us ]
%b.072.us.us.us.us.us.us = phi i32 [ %.us-phi.us.us.us.us.us.us, %for.cond16.for.cond.cleanup18_crit_edge.us.us.us.us.us.us ], [ 0, %for.cond12.preheader.us.us.us.us.us ]
%14 = trunc i64 %indvars.iv132 to i32
%15 = shl nuw i32 1, %14
%16 = and i32 %15, %i2.096.us.us.us
%cmp20.us.us.us.us.us.us = icmp eq i32 %16, 0
%17 = mul nuw nsw i64 %indvars.iv132, %3
%arrayidx26.us.us.us.us.us.us = getelementptr inbounds i8, ptr %vla, i64 %17
br i1 %cmp20.us.us.us.us.us.us, label %for.body19.us.us.us.us.us.us.us.preheader, label %for.cond16.for.cond.cleanup18_crit_edge.us.us.us.us.us.us
for.body19.us.us.us.us.us.us.us.preheader: ; preds = %for.cond16.preheader.us.us.us.us.us.us
br i1 %13, label %for.cond16.for.cond.cleanup18_crit_edge.us.us.us.us.us.us.loopexit.unr-lcssa, label %for.body19.us.us.us.us.us.us.us
for.cond16.for.cond.cleanup18_crit_edge.us.us.us.us.us.us.loopexit.unr-lcssa: ; preds = %for.inc32.us.us.us.us.us.us.us.1, %for.body19.us.us.us.us.us.us.us.preheader
%b.2.us.us.us.us.us.us.us.lcssa.ph = phi i32 [ undef, %for.body19.us.us.us.us.us.us.us.preheader ], [ %b.2.us.us.us.us.us.us.us.1, %for.inc32.us.us.us.us.us.us.us.1 ]
%indvars.iv129.unr = phi i64 [ 0, %for.body19.us.us.us.us.us.us.us.preheader ], [ %indvars.iv.next130.1, %for.inc32.us.us.us.us.us.us.us.1 ]
%b.168.us.us.us.us.us.us.us.unr = phi i32 [ %b.072.us.us.us.us.us.us, %for.body19.us.us.us.us.us.us.us.preheader ], [ %b.2.us.us.us.us.us.us.us.1, %for.inc32.us.us.us.us.us.us.us.1 ]
br i1 %lcmp.mod.not, label %for.cond16.for.cond.cleanup18_crit_edge.us.us.us.us.us.us, label %for.body19.us.us.us.us.us.us.us.epil
for.body19.us.us.us.us.us.us.us.epil: ; preds = %for.cond16.for.cond.cleanup18_crit_edge.us.us.us.us.us.us.loopexit.unr-lcssa
%18 = trunc i64 %indvars.iv129.unr to i32
%19 = shl nuw i32 1, %18
%20 = and i32 %19, %j.084.us.us.us.us.us
%cmp23.us.us.us.us.us.us.us.epil = icmp eq i32 %20, 0
br i1 %cmp23.us.us.us.us.us.us.us.epil, label %land.lhs.true24.us.us.us.us.us.us.us.epil, label %for.cond16.for.cond.cleanup18_crit_edge.us.us.us.us.us.us
land.lhs.true24.us.us.us.us.us.us.us.epil: ; preds = %for.body19.us.us.us.us.us.us.us.epil
%arrayidx28.us.us.us.us.us.us.us.epil = getelementptr inbounds i8, ptr %arrayidx26.us.us.us.us.us.us, i64 %indvars.iv129.unr
%21 = load i8, ptr %arrayidx28.us.us.us.us.us.us.us.epil, align 1, !tbaa !9
%cmp29.us.us.us.us.us.us.us.epil = icmp eq i8 %21, 35
%inc31.us.us.us.us.us.us.us.epil = zext i1 %cmp29.us.us.us.us.us.us.us.epil to i32
%spec.select64.us.us.us.us.us.us.us.epil = add nsw i32 %b.168.us.us.us.us.us.us.us.unr, %inc31.us.us.us.us.us.us.us.epil
br label %for.cond16.for.cond.cleanup18_crit_edge.us.us.us.us.us.us
for.cond16.for.cond.cleanup18_crit_edge.us.us.us.us.us.us: ; preds = %for.cond16.for.cond.cleanup18_crit_edge.us.us.us.us.us.us.loopexit.unr-lcssa, %land.lhs.true24.us.us.us.us.us.us.us.epil, %for.body19.us.us.us.us.us.us.us.epil, %for.cond16.preheader.us.us.us.us.us.us
%.us-phi.us.us.us.us.us.us = phi i32 [ %b.072.us.us.us.us.us.us, %for.cond16.preheader.us.us.us.us.us.us ], [ %b.2.us.us.us.us.us.us.us.lcssa.ph, %for.cond16.for.cond.cleanup18_crit_edge.us.us.us.us.us.us.loopexit.unr-lcssa ], [ %b.168.us.us.us.us.us.us.us.unr, %for.body19.us.us.us.us.us.us.us.epil ], [ %spec.select64.us.us.us.us.us.us.us.epil, %land.lhs.true24.us.us.us.us.us.us.us.epil ]
%indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
%exitcond136.not = icmp eq i64 %indvars.iv.next133, %wide.trip.count135
br i1 %exitcond136.not, label %for.cond12.for.cond.cleanup14_crit_edge.split.us.us.us.us.us.us, label %for.cond16.preheader.us.us.us.us.us.us, !llvm.loop !10
for.body19.us.us.us.us.us.us.us: ; preds = %for.body19.us.us.us.us.us.us.us.preheader, %for.inc32.us.us.us.us.us.us.us.1
%indvars.iv129 = phi i64 [ %indvars.iv.next130.1, %for.inc32.us.us.us.us.us.us.us.1 ], [ 0, %for.body19.us.us.us.us.us.us.us.preheader ]
%b.168.us.us.us.us.us.us.us = phi i32 [ %b.2.us.us.us.us.us.us.us.1, %for.inc32.us.us.us.us.us.us.us.1 ], [ %b.072.us.us.us.us.us.us, %for.body19.us.us.us.us.us.us.us.preheader ]
%niter = phi i64 [ %niter.next.1, %for.inc32.us.us.us.us.us.us.us.1 ], [ 0, %for.body19.us.us.us.us.us.us.us.preheader ]
%22 = trunc i64 %indvars.iv129 to i32
%23 = shl nuw i32 1, %22
%24 = and i32 %23, %j.084.us.us.us.us.us
%cmp23.us.us.us.us.us.us.us = icmp eq i32 %24, 0
br i1 %cmp23.us.us.us.us.us.us.us, label %land.lhs.true24.us.us.us.us.us.us.us, label %for.inc32.us.us.us.us.us.us.us
land.lhs.true24.us.us.us.us.us.us.us: ; preds = %for.body19.us.us.us.us.us.us.us
%arrayidx28.us.us.us.us.us.us.us = getelementptr inbounds i8, ptr %arrayidx26.us.us.us.us.us.us, i64 %indvars.iv129
%25 = load i8, ptr %arrayidx28.us.us.us.us.us.us.us, align 1, !tbaa !9
%cmp29.us.us.us.us.us.us.us = icmp eq i8 %25, 35
%inc31.us.us.us.us.us.us.us = zext i1 %cmp29.us.us.us.us.us.us.us to i32
%spec.select64.us.us.us.us.us.us.us = add nsw i32 %b.168.us.us.us.us.us.us.us, %inc31.us.us.us.us.us.us.us
br label %for.inc32.us.us.us.us.us.us.us
for.inc32.us.us.us.us.us.us.us: ; preds = %land.lhs.true24.us.us.us.us.us.us.us, %for.body19.us.us.us.us.us.us.us
%b.2.us.us.us.us.us.us.us = phi i32 [ %b.168.us.us.us.us.us.us.us, %for.body19.us.us.us.us.us.us.us ], [ %spec.select64.us.us.us.us.us.us.us, %land.lhs.true24.us.us.us.us.us.us.us ]
%indvars.iv.next130 = or i64 %indvars.iv129, 1
%26 = trunc i64 %indvars.iv.next130 to i32
%27 = shl nuw i32 1, %26
%28 = and i32 %27, %j.084.us.us.us.us.us
%cmp23.us.us.us.us.us.us.us.1 = icmp eq i32 %28, 0
br i1 %cmp23.us.us.us.us.us.us.us.1, label %land.lhs.true24.us.us.us.us.us.us.us.1, label %for.inc32.us.us.us.us.us.us.us.1
land.lhs.true24.us.us.us.us.us.us.us.1: ; preds = %for.inc32.us.us.us.us.us.us.us
%arrayidx28.us.us.us.us.us.us.us.1 = getelementptr inbounds i8, ptr %arrayidx26.us.us.us.us.us.us, i64 %indvars.iv.next130
%29 = load i8, ptr %arrayidx28.us.us.us.us.us.us.us.1, align 1, !tbaa !9
%cmp29.us.us.us.us.us.us.us.1 = icmp eq i8 %29, 35
%inc31.us.us.us.us.us.us.us.1 = zext i1 %cmp29.us.us.us.us.us.us.us.1 to i32
%spec.select64.us.us.us.us.us.us.us.1 = add nsw i32 %b.2.us.us.us.us.us.us.us, %inc31.us.us.us.us.us.us.us.1
br label %for.inc32.us.us.us.us.us.us.us.1
for.inc32.us.us.us.us.us.us.us.1: ; preds = %land.lhs.true24.us.us.us.us.us.us.us.1, %for.inc32.us.us.us.us.us.us.us
%b.2.us.us.us.us.us.us.us.1 = phi i32 [ %b.2.us.us.us.us.us.us.us, %for.inc32.us.us.us.us.us.us.us ], [ %spec.select64.us.us.us.us.us.us.us.1, %land.lhs.true24.us.us.us.us.us.us.us.1 ]
%indvars.iv.next130.1 = add nuw nsw i64 %indvars.iv129, 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.cond16.for.cond.cleanup18_crit_edge.us.us.us.us.us.us.loopexit.unr-lcssa, label %for.body19.us.us.us.us.us.us.us, !llvm.loop !12
for.cond12.for.cond.cleanup14_crit_edge.split.us.us.us.us.us.us: ; preds = %for.cond16.for.cond.cleanup18_crit_edge.us.us.us.us.us.us
%cmp38.us.us.us.us.us = icmp eq i32 %.us-phi.us.us.us.us.us.us, %8
%inc41.us.us.us.us.us = zext i1 %cmp38.us.us.us.us.us to i32
%spec.select.us.us.us.us.us = add nsw i32 %ans.183.us.us.us.us.us, %inc41.us.us.us.us.us
%inc44.us.us.us.us.us = add nuw nsw i32 %j.084.us.us.us.us.us, 1
%exitcond138.not = icmp eq i32 %inc44.us.us.us.us.us, %smax137
br i1 %exitcond138.not, label %for.cond7.for.cond.cleanup10_crit_edge.split.us.split.us.us.us.us, label %for.cond12.preheader.us.us.us.us.us, !llvm.loop !13
for.cond7.for.cond.cleanup10_crit_edge.split.us.split.us.us.us.us: ; preds = %for.cond12.for.cond.cleanup14_crit_edge.split.us.us.us.us.us.us
%inc47.us.us.us = add nuw nsw i32 %i2.096.us.us.us, 1
%exitcond140.not = icmp eq i32 %inc47.us.us.us, %smax139
br i1 %exitcond140.not, label %for.cond.cleanup5, label %for.cond7.preheader.us.us.us, !llvm.loop !14
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%30 = mul nuw nsw i64 %indvars.iv, %3
%arrayidx = getelementptr inbounds i8, ptr %vla, i64 %30
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%31 = load i32, ptr %h, align 4, !tbaa !5
%32 = sext i32 %31 to i64
%cmp = icmp slt i64 %indvars.iv.next, %32
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !15
for.cond.cleanup5: ; preds = %for.cond7.for.cond.cleanup10_crit_edge.split.us.split.us.us.us.us, %for.cond7.preheader.lr.ph, %for.cond7.preheader.us.preheader, %for.cond7.preheader.us.us.preheader, %for.cond3.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ %12, %for.cond7.preheader.us.us.preheader ], [ %10, %for.cond7.preheader.us.preheader ], [ 0, %for.cond7.preheader.lr.ph ], [ %spec.select.us.us.us.us.us, %for.cond7.for.cond.cleanup10_crit_edge.split.us.split.us.us.us.us ]
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!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 h, w, k;
scanf("%d %d %d", &h, &w, &k);
char s[10][10];
int i, j;
for (i = 0; i < h; i++)
scanf("%s", s[i]);
int mh, mw;
mh = 1;
for (i = 0; i < h; i++)
mh *= 2;
mw = 1;
for (i = 0; i < w; i++)
mw *= 2;
int ans = 0;
int p[10], q[10];
int a, b, c;
for (a = 0; a < mh; a++)
{
c = a;
for (i = 0; i < h; i++)
{
p[i] = c % 2;
c /= 2;
}
for (b = 0; b < mw; b++)
{
c = b;
for (j = 0; j < w; j++)
{
q[j] = c % 2;
c /= 2;
}
c = 0;
for (i = 0; i < h; i++)
for (j = 0; j < w; j++)
if (s[i][j] == '#' && p[i] == 0 && q[j] == 0)
c++;
if (c == k)
ans++;
}
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176447/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176447/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%k = alloca i32, align 4
%s = alloca [10 x [10 x i8]], align 16
%p = alloca [10 x i32], align 16
%q = alloca [10 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w, ptr noundef nonnull %k)
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %s) #4
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp112 = icmp sgt i32 %0, 0
br i1 %cmp112, label %for.body, label %for.cond8.preheader
for.cond2.preheader: ; preds = %for.body
%cmp3114 = icmp sgt i32 %2, 0
br i1 %cmp3114, label %for.body4.preheader, label %for.cond8.preheader
for.body4.preheader: ; preds = %for.cond2.preheader
%xtraiter = and i32 %2, 7
%1 = icmp ult i32 %2, 8
br i1 %1, label %for.cond8.preheader.loopexit.unr-lcssa, label %for.body4.preheader.new
for.body4.preheader.new: ; preds = %for.body4.preheader
%unroll_iter = and i32 %2, -8
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10 x [10 x i8]], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %h, 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.cond8.preheader.loopexit.unr-lcssa: ; preds = %for.body4, %for.body4.preheader
%mul.lcssa.ph = phi i32 [ undef, %for.body4.preheader ], [ %mul, %for.body4 ]
%mh.0116.unr = phi i32 [ 1, %for.body4.preheader ], [ %mul, %for.body4 ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond8.preheader, label %for.body4.epil
for.body4.epil: ; preds = %for.cond8.preheader.loopexit.unr-lcssa, %for.body4.epil
%mh.0116.epil = phi i32 [ %mul.epil, %for.body4.epil ], [ %mh.0116.unr, %for.cond8.preheader.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body4.epil ], [ 0, %for.cond8.preheader.loopexit.unr-lcssa ]
%mul.epil = shl nsw i32 %mh.0116.epil, 1
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond8.preheader, label %for.body4.epil, !llvm.loop !11
for.cond8.preheader: ; preds = %for.cond8.preheader.loopexit.unr-lcssa, %for.body4.epil, %entry, %for.cond2.preheader
%cmp3114169 = phi i1 [ false, %for.cond2.preheader ], [ false, %entry ], [ %cmp3114, %for.body4.epil ], [ %cmp3114, %for.cond8.preheader.loopexit.unr-lcssa ]
%.lcssa111168 = phi i32 [ %2, %for.cond2.preheader ], [ %0, %entry ], [ %2, %for.body4.epil ], [ %2, %for.cond8.preheader.loopexit.unr-lcssa ]
%mh.0.lcssa = phi i32 [ 1, %for.cond2.preheader ], [ 1, %entry ], [ %mul.lcssa.ph, %for.cond8.preheader.loopexit.unr-lcssa ], [ %mul.epil, %for.body4.epil ]
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp9118 = icmp sgt i32 %4, 0
br i1 %cmp9118, label %for.body10.preheader, label %for.end14
for.body10.preheader: ; preds = %for.cond8.preheader
%xtraiter171 = and i32 %4, 7
%5 = icmp ult i32 %4, 8
br i1 %5, label %for.end14.loopexit.unr-lcssa, label %for.body10.preheader.new
for.body10.preheader.new: ; preds = %for.body10.preheader
%unroll_iter175 = and i32 %4, -8
br label %for.body10
for.body4: ; preds = %for.body4, %for.body4.preheader.new
%mh.0116 = phi i32 [ 1, %for.body4.preheader.new ], [ %mul, %for.body4 ]
%niter = phi i32 [ 0, %for.body4.preheader.new ], [ %niter.next.7, %for.body4 ]
%mul = shl i32 %mh.0116, 8
%niter.next.7 = add i32 %niter, 8
%niter.ncmp.7 = icmp eq i32 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond8.preheader.loopexit.unr-lcssa, label %for.body4, !llvm.loop !13
for.body10: ; preds = %for.body10, %for.body10.preheader.new
%mw.0120 = phi i32 [ 1, %for.body10.preheader.new ], [ %mul11, %for.body10 ]
%niter176 = phi i32 [ 0, %for.body10.preheader.new ], [ %niter176.next.7, %for.body10 ]
%mul11 = shl i32 %mw.0120, 8
%niter176.next.7 = add i32 %niter176, 8
%niter176.ncmp.7 = icmp eq i32 %niter176.next.7, %unroll_iter175
br i1 %niter176.ncmp.7, label %for.end14.loopexit.unr-lcssa, label %for.body10, !llvm.loop !14
for.end14.loopexit.unr-lcssa: ; preds = %for.body10, %for.body10.preheader
%mul11.lcssa.ph = phi i32 [ undef, %for.body10.preheader ], [ %mul11, %for.body10 ]
%mw.0120.unr = phi i32 [ 1, %for.body10.preheader ], [ %mul11, %for.body10 ]
%lcmp.mod173.not = icmp eq i32 %xtraiter171, 0
br i1 %lcmp.mod173.not, label %for.end14, label %for.body10.epil
for.body10.epil: ; preds = %for.end14.loopexit.unr-lcssa, %for.body10.epil
%mw.0120.epil = phi i32 [ %mul11.epil, %for.body10.epil ], [ %mw.0120.unr, %for.end14.loopexit.unr-lcssa ]
%epil.iter172 = phi i32 [ %epil.iter172.next, %for.body10.epil ], [ 0, %for.end14.loopexit.unr-lcssa ]
%mul11.epil = shl nsw i32 %mw.0120.epil, 1
%epil.iter172.next = add i32 %epil.iter172, 1
%epil.iter172.cmp.not = icmp eq i32 %epil.iter172.next, %xtraiter171
br i1 %epil.iter172.cmp.not, label %for.end14, label %for.body10.epil, !llvm.loop !15
for.end14: ; preds = %for.end14.loopexit.unr-lcssa, %for.body10.epil, %for.cond8.preheader
%mw.0.lcssa = phi i32 [ 1, %for.cond8.preheader ], [ %mul11.lcssa.ph, %for.end14.loopexit.unr-lcssa ], [ %mul11.epil, %for.body10.epil ]
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %p) #4
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %q) #4
%6 = load i32, ptr %k, align 4, !tbaa !5
%umax = call i32 @llvm.umax.i32(i32 %mw.0.lcssa, i32 1)
%umax164 = call i32 @llvm.umax.i32(i32 %mh.0.lcssa, i32 1)
%wide.trip.count = zext i32 %.lcssa111168 to i64
%wide.trip.count151 = zext i32 %4 to i64
%wide.trip.count161 = zext i32 %.lcssa111168 to i64
%7 = add nsw i64 %wide.trip.count151, -1
%xtraiter177 = and i64 %wide.trip.count, 1
%8 = icmp eq i32 %.lcssa111168, 1
%unroll_iter180 = and i64 %wide.trip.count, 4294967294
%lcmp.mod179.not = icmp eq i64 %xtraiter177, 0
%xtraiter182 = and i64 %wide.trip.count151, 1
%9 = icmp eq i64 %7, 0
%unroll_iter185 = and i64 %wide.trip.count151, 4294967294
%lcmp.mod184.not = icmp eq i64 %xtraiter182, 0
%brmerge.not = and i1 %cmp9118, %cmp3114169
%xtraiter187 = and i64 %wide.trip.count151, 1
%10 = icmp eq i64 %7, 0
%unroll_iter191 = and i64 %wide.trip.count151, 4294967294
%lcmp.mod189.not = icmp eq i64 %xtraiter187, 0
br label %for.cond18.preheader
for.cond18.preheader: ; preds = %for.end14, %for.inc75
%a.0140 = phi i32 [ 0, %for.end14 ], [ %inc76, %for.inc75 ]
%ans.0139 = phi i32 [ 0, %for.end14 ], [ %spec.select110, %for.inc75 ]
br i1 %cmp3114169, label %for.body20.preheader, label %for.cond29.preheader.preheader
for.body20.preheader: ; preds = %for.cond18.preheader
br i1 %8, label %for.cond29.preheader.preheader.loopexit.unr-lcssa, label %for.body20
for.body20: ; preds = %for.body20.preheader, %for.body20
%indvars.iv144 = phi i64 [ %indvars.iv.next145.1, %for.body20 ], [ 0, %for.body20.preheader ]
%c.0125 = phi i32 [ %div.1, %for.body20 ], [ %a.0140, %for.body20.preheader ]
%niter181 = phi i64 [ %niter181.next.1, %for.body20 ], [ 0, %for.body20.preheader ]
%rem = srem i32 %c.0125, 2
%arrayidx22 = getelementptr inbounds [10 x i32], ptr %p, i64 0, i64 %indvars.iv144
store i32 %rem, ptr %arrayidx22, align 8, !tbaa !5
%div = sdiv i32 %c.0125, 2
%indvars.iv.next145 = or i64 %indvars.iv144, 1
%rem.1 = srem i32 %div, 2
%arrayidx22.1 = getelementptr inbounds [10 x i32], ptr %p, i64 0, i64 %indvars.iv.next145
store i32 %rem.1, ptr %arrayidx22.1, align 4, !tbaa !5
%div.1 = sdiv i32 %c.0125, 4
%indvars.iv.next145.1 = add nuw nsw i64 %indvars.iv144, 2
%niter181.next.1 = add i64 %niter181, 2
%niter181.ncmp.1 = icmp eq i64 %niter181.next.1, %unroll_iter180
br i1 %niter181.ncmp.1, label %for.cond29.preheader.preheader.loopexit.unr-lcssa, label %for.body20, !llvm.loop !16
for.cond29.preheader.preheader.loopexit.unr-lcssa: ; preds = %for.body20, %for.body20.preheader
%indvars.iv144.unr = phi i64 [ 0, %for.body20.preheader ], [ %indvars.iv.next145.1, %for.body20 ]
%c.0125.unr = phi i32 [ %a.0140, %for.body20.preheader ], [ %div.1, %for.body20 ]
br i1 %lcmp.mod179.not, label %for.cond29.preheader.preheader, label %for.body20.epil
for.body20.epil: ; preds = %for.cond29.preheader.preheader.loopexit.unr-lcssa
%rem.epil = srem i32 %c.0125.unr, 2
%arrayidx22.epil = getelementptr inbounds [10 x i32], ptr %p, i64 0, i64 %indvars.iv144.unr
store i32 %rem.epil, ptr %arrayidx22.epil, align 4, !tbaa !5
br label %for.cond29.preheader.preheader
for.cond29.preheader.preheader: ; preds = %for.body20.epil, %for.cond29.preheader.preheader.loopexit.unr-lcssa, %for.cond18.preheader
br label %for.cond29.preheader
for.cond29.preheader: ; preds = %for.cond29.preheader.preheader, %for.end66
%b.0138 = phi i32 [ %inc73, %for.end66 ], [ 0, %for.cond29.preheader.preheader ]
%ans.1137 = phi i32 [ %spec.select110, %for.end66 ], [ %ans.0139, %for.cond29.preheader.preheader ]
br i1 %cmp9118, label %for.body31.preheader, label %for.end66
for.body31.preheader: ; preds = %for.cond29.preheader
br i1 %9, label %for.cond39.preheader.unr-lcssa, label %for.body31
for.cond39.preheader.unr-lcssa: ; preds = %for.body31, %for.body31.preheader
%indvars.iv148.unr = phi i64 [ 0, %for.body31.preheader ], [ %indvars.iv.next149.1, %for.body31 ]
%c.1128.unr = phi i32 [ %b.0138, %for.body31.preheader ], [ %div35.1, %for.body31 ]
br i1 %lcmp.mod184.not, label %for.cond39.preheader, label %for.body31.epil
for.body31.epil: ; preds = %for.cond39.preheader.unr-lcssa
%rem32.epil = srem i32 %c.1128.unr, 2
%arrayidx34.epil = getelementptr inbounds [10 x i32], ptr %q, i64 0, i64 %indvars.iv148.unr
store i32 %rem32.epil, ptr %arrayidx34.epil, align 4, !tbaa !5
br label %for.cond39.preheader
for.cond39.preheader: ; preds = %for.cond39.preheader.unr-lcssa, %for.body31.epil
br i1 %brmerge.not, label %for.cond42.preheader.us, label %for.end66
for.cond42.preheader.us: ; preds = %for.cond39.preheader, %for.cond42.for.inc64_crit_edge.us
%indvars.iv158 = phi i64 [ %indvars.iv.next159, %for.cond42.for.inc64_crit_edge.us ], [ 0, %for.cond39.preheader ]
%c.2135.us = phi i32 [ %c.4.us.lcssa, %for.cond42.for.inc64_crit_edge.us ], [ 0, %for.cond39.preheader ]
%arrayidx52.us = getelementptr inbounds [10 x i32], ptr %p, i64 0, i64 %indvars.iv158
br i1 %10, label %for.cond42.for.inc64_crit_edge.us.unr-lcssa, label %for.body44.us
for.body44.us: ; preds = %for.cond42.preheader.us, %for.inc61.us.1
%indvars.iv153 = phi i64 [ %indvars.iv.next154.1, %for.inc61.us.1 ], [ 0, %for.cond42.preheader.us ]
%c.3131.us = phi i32 [ %c.4.us.1, %for.inc61.us.1 ], [ %c.2135.us, %for.cond42.preheader.us ]
%niter192 = phi i64 [ %niter192.next.1, %for.inc61.us.1 ], [ 0, %for.cond42.preheader.us ]
%arrayidx48.us = getelementptr inbounds [10 x [10 x i8]], ptr %s, i64 0, i64 %indvars.iv158, i64 %indvars.iv153
%11 = load i8, ptr %arrayidx48.us, align 2, !tbaa !17
%cmp49.us = icmp eq i8 %11, 35
br i1 %cmp49.us, label %land.lhs.true.us, label %for.inc61.us
land.lhs.true.us: ; preds = %for.body44.us
%12 = load i32, ptr %arrayidx52.us, align 4, !tbaa !5
%cmp53.us = icmp eq i32 %12, 0
br i1 %cmp53.us, label %land.lhs.true55.us, label %for.inc61.us
land.lhs.true55.us: ; preds = %land.lhs.true.us
%arrayidx57.us = getelementptr inbounds [10 x i32], ptr %q, i64 0, i64 %indvars.iv153
%13 = load i32, ptr %arrayidx57.us, align 8, !tbaa !5
%cmp58.us = icmp eq i32 %13, 0
%inc60.us = zext i1 %cmp58.us to i32
%spec.select.us = add nsw i32 %c.3131.us, %inc60.us
br label %for.inc61.us
for.inc61.us: ; preds = %land.lhs.true55.us, %land.lhs.true.us, %for.body44.us
%c.4.us = phi i32 [ %c.3131.us, %land.lhs.true.us ], [ %c.3131.us, %for.body44.us ], [ %spec.select.us, %land.lhs.true55.us ]
%indvars.iv.next154 = or i64 %indvars.iv153, 1
%arrayidx48.us.1 = getelementptr inbounds [10 x [10 x i8]], ptr %s, i64 0, i64 %indvars.iv158, i64 %indvars.iv.next154
%14 = load i8, ptr %arrayidx48.us.1, align 1, !tbaa !17
%cmp49.us.1 = icmp eq i8 %14, 35
br i1 %cmp49.us.1, label %land.lhs.true.us.1, label %for.inc61.us.1
land.lhs.true.us.1: ; preds = %for.inc61.us
%15 = load i32, ptr %arrayidx52.us, align 4, !tbaa !5
%cmp53.us.1 = icmp eq i32 %15, 0
br i1 %cmp53.us.1, label %land.lhs.true55.us.1, label %for.inc61.us.1
land.lhs.true55.us.1: ; preds = %land.lhs.true.us.1
%arrayidx57.us.1 = getelementptr inbounds [10 x i32], ptr %q, i64 0, i64 %indvars.iv.next154
%16 = load i32, ptr %arrayidx57.us.1, align 4, !tbaa !5
%cmp58.us.1 = icmp eq i32 %16, 0
%inc60.us.1 = zext i1 %cmp58.us.1 to i32
%spec.select.us.1 = add nsw i32 %c.4.us, %inc60.us.1
br label %for.inc61.us.1
for.inc61.us.1: ; preds = %land.lhs.true55.us.1, %land.lhs.true.us.1, %for.inc61.us
%c.4.us.1 = phi i32 [ %c.4.us, %land.lhs.true.us.1 ], [ %c.4.us, %for.inc61.us ], [ %spec.select.us.1, %land.lhs.true55.us.1 ]
%indvars.iv.next154.1 = add nuw nsw i64 %indvars.iv153, 2
%niter192.next.1 = add i64 %niter192, 2
%niter192.ncmp.1 = icmp eq i64 %niter192.next.1, %unroll_iter191
br i1 %niter192.ncmp.1, label %for.cond42.for.inc64_crit_edge.us.unr-lcssa, label %for.body44.us, !llvm.loop !18
for.cond42.for.inc64_crit_edge.us.unr-lcssa: ; preds = %for.inc61.us.1, %for.cond42.preheader.us
%c.4.us.lcssa.ph = phi i32 [ undef, %for.cond42.preheader.us ], [ %c.4.us.1, %for.inc61.us.1 ]
%indvars.iv153.unr = phi i64 [ 0, %for.cond42.preheader.us ], [ %indvars.iv.next154.1, %for.inc61.us.1 ]
%c.3131.us.unr = phi i32 [ %c.2135.us, %for.cond42.preheader.us ], [ %c.4.us.1, %for.inc61.us.1 ]
br i1 %lcmp.mod189.not, label %for.cond42.for.inc64_crit_edge.us, label %for.body44.us.epil
for.body44.us.epil: ; preds = %for.cond42.for.inc64_crit_edge.us.unr-lcssa
%arrayidx48.us.epil = getelementptr inbounds [10 x [10 x i8]], ptr %s, i64 0, i64 %indvars.iv158, i64 %indvars.iv153.unr
%17 = load i8, ptr %arrayidx48.us.epil, align 1, !tbaa !17
%cmp49.us.epil = icmp eq i8 %17, 35
br i1 %cmp49.us.epil, label %land.lhs.true.us.epil, label %for.cond42.for.inc64_crit_edge.us
land.lhs.true.us.epil: ; preds = %for.body44.us.epil
%18 = load i32, ptr %arrayidx52.us, align 4, !tbaa !5
%cmp53.us.epil = icmp eq i32 %18, 0
br i1 %cmp53.us.epil, label %land.lhs.true55.us.epil, label %for.cond42.for.inc64_crit_edge.us
land.lhs.true55.us.epil: ; preds = %land.lhs.true.us.epil
%arrayidx57.us.epil = getelementptr inbounds [10 x i32], ptr %q, i64 0, i64 %indvars.iv153.unr
%19 = load i32, ptr %arrayidx57.us.epil, align 4, !tbaa !5
%cmp58.us.epil = icmp eq i32 %19, 0
%inc60.us.epil = zext i1 %cmp58.us.epil to i32
%spec.select.us.epil = add nsw i32 %c.3131.us.unr, %inc60.us.epil
br label %for.cond42.for.inc64_crit_edge.us
for.cond42.for.inc64_crit_edge.us: ; preds = %for.body44.us.epil, %land.lhs.true.us.epil, %land.lhs.true55.us.epil, %for.cond42.for.inc64_crit_edge.us.unr-lcssa
%c.4.us.lcssa = phi i32 [ %c.4.us.lcssa.ph, %for.cond42.for.inc64_crit_edge.us.unr-lcssa ], [ %c.3131.us.unr, %land.lhs.true.us.epil ], [ %c.3131.us.unr, %for.body44.us.epil ], [ %spec.select.us.epil, %land.lhs.true55.us.epil ]
%indvars.iv.next159 = add nuw nsw i64 %indvars.iv158, 1
%exitcond162.not = icmp eq i64 %indvars.iv.next159, %wide.trip.count161
br i1 %exitcond162.not, label %for.end66, label %for.cond42.preheader.us, !llvm.loop !19
for.body31: ; preds = %for.body31.preheader, %for.body31
%indvars.iv148 = phi i64 [ %indvars.iv.next149.1, %for.body31 ], [ 0, %for.body31.preheader ]
%c.1128 = phi i32 [ %div35.1, %for.body31 ], [ %b.0138, %for.body31.preheader ]
%niter186 = phi i64 [ %niter186.next.1, %for.body31 ], [ 0, %for.body31.preheader ]
%rem32 = srem i32 %c.1128, 2
%arrayidx34 = getelementptr inbounds [10 x i32], ptr %q, i64 0, i64 %indvars.iv148
store i32 %rem32, ptr %arrayidx34, align 8, !tbaa !5
%div35 = sdiv i32 %c.1128, 2
%indvars.iv.next149 = or i64 %indvars.iv148, 1
%rem32.1 = srem i32 %div35, 2
%arrayidx34.1 = getelementptr inbounds [10 x i32], ptr %q, i64 0, i64 %indvars.iv.next149
store i32 %rem32.1, ptr %arrayidx34.1, align 4, !tbaa !5
%div35.1 = sdiv i32 %c.1128, 4
%indvars.iv.next149.1 = add nuw nsw i64 %indvars.iv148, 2
%niter186.next.1 = add i64 %niter186, 2
%niter186.ncmp.1 = icmp eq i64 %niter186.next.1, %unroll_iter185
br i1 %niter186.ncmp.1, label %for.cond39.preheader.unr-lcssa, label %for.body31, !llvm.loop !20
for.end66: ; preds = %for.cond42.for.inc64_crit_edge.us, %for.cond39.preheader, %for.cond29.preheader
%c.2.lcssa = phi i32 [ 0, %for.cond39.preheader ], [ 0, %for.cond29.preheader ], [ %c.4.us.lcssa, %for.cond42.for.inc64_crit_edge.us ]
%cmp67 = icmp eq i32 %c.2.lcssa, %6
%inc70 = zext i1 %cmp67 to i32
%spec.select110 = add nsw i32 %ans.1137, %inc70
%inc73 = add nuw nsw i32 %b.0138, 1
%exitcond163.not = icmp eq i32 %inc73, %umax
br i1 %exitcond163.not, label %for.inc75, label %for.cond29.preheader, !llvm.loop !21
for.inc75: ; preds = %for.end66
%inc76 = add nuw nsw i32 %a.0140, 1
%exitcond165.not = icmp eq i32 %inc76, %umax164
br i1 %exitcond165.not, label %for.end77, label %for.cond18.preheader, !llvm.loop !22
for.end77: ; preds = %for.inc75
%call78 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %spec.select110)
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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.umax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !10}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
|
#include<stdio.h>
int main(void){
char s[4];
int i,a=0,b=0,c=0;
scanf("%s",s);
for(i=0;i<3;i++){
if(s[i]=='a')
a++;
if(s[i]=='b')
b++;
if(s[i]=='c')
c++;
}
if(a==1&&b==1&&c==1){
printf("Yes\n");
}else{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176498/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176498/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 = 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:
%s = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp14 = icmp eq i8 %0, 99
%inc17 = zext i1 %cmp14 to i32
%arrayidx.1 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%cmp14.1 = icmp eq i8 %1, 99
%inc17.1 = zext i1 %cmp14.1 to i32
%c.1.1 = add nuw nsw i32 %inc17, %inc17.1
%arrayidx.2 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%cmp14.2 = icmp eq i8 %2, 99
%inc17.2 = zext i1 %cmp14.2 to i32
%c.1.2 = add nuw nsw i32 %c.1.1, %inc17.2
%3 = insertelement <2 x i8> poison, i8 %0, i64 0
%4 = shufflevector <2 x i8> %3, <2 x i8> poison, <2 x i32> zeroinitializer
%5 = icmp eq <2 x i8> %4, <i8 98, i8 97>
%6 = zext <2 x i1> %5 to <2 x i32>
%7 = insertelement <2 x i8> poison, i8 %1, i64 0
%8 = shufflevector <2 x i8> %7, <2 x i8> poison, <2 x i32> zeroinitializer
%9 = icmp eq <2 x i8> %8, <i8 98, i8 97>
%10 = zext <2 x i1> %9 to <2 x i32>
%11 = add nuw nsw <2 x i32> %6, %10
%12 = insertelement <2 x i8> poison, i8 %2, i64 0
%13 = shufflevector <2 x i8> %12, <2 x i8> poison, <2 x i32> zeroinitializer
%14 = icmp eq <2 x i8> %13, <i8 98, i8 97>
%15 = zext <2 x i1> %14 to <2 x i32>
%16 = add nuw nsw <2 x i32> %11, %15
%17 = icmp eq <2 x i32> %16, <i32 1, i32 1>
%18 = extractelement <2 x i1> %17, i64 0
%19 = extractelement <2 x i1> %17, i64 1
%or.cond = select i1 %19, i1 %18, i1 false
%cmp25 = icmp eq i32 %c.1.2, 1
%or.cond31 = select i1 %or.cond, i1 %cmp25, i1 false
%str.3.str = select i1 %or.cond31, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
char a[3];
int i,b=0,c=0,d=0;
scanf("%s",a);
for(i=0;i<3;i++){
if(a[i]=='a') b++;
else if (a[i]=='b') c++;
else if (a[i]=='c') d++;
}
if(b==1&&c==1&&d==1)
printf("Yes\n");
else printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176540/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176540/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 = 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
@switch.table.main = private unnamed_addr constant [3 x i32] [i32 1, i32 0, i32 0], align 4
@switch.table.main.4 = private unnamed_addr constant [3 x i32] [i32 0, i32 1, i32 0], align 4
@switch.table.main.5 = private unnamed_addr constant [3 x i32] [i32 0, i32 0, i32 1], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i8, ptr %a, align 1, !tbaa !5
%switch.tableidx = add i8 %0, -97
%1 = icmp ult i8 %switch.tableidx, 3
br i1 %1, label %switch.lookup, label %for.inc
switch.lookup: ; preds = %entry
%2 = sext i8 %switch.tableidx to i64
%switch.gep = getelementptr inbounds [3 x i32], ptr @switch.table.main, i64 0, i64 %2
%switch.load = load i32, ptr %switch.gep, align 4
%3 = sext i8 %switch.tableidx to i64
%switch.gep47 = getelementptr inbounds [3 x i32], ptr @switch.table.main.4, i64 0, i64 %3
%switch.load48 = load i32, ptr %switch.gep47, align 4
%4 = sext i8 %switch.tableidx to i64
%switch.gep49 = getelementptr inbounds [3 x i32], ptr @switch.table.main.5, i64 0, i64 %4
%switch.load50 = load i32, ptr %switch.gep49, align 4
br label %for.inc
for.inc: ; preds = %switch.lookup, %entry
%b.1 = phi i32 [ 0, %entry ], [ %switch.load, %switch.lookup ]
%c.1 = phi i32 [ 0, %entry ], [ %switch.load48, %switch.lookup ]
%d.1 = phi i32 [ 0, %entry ], [ %switch.load50, %switch.lookup ]
%arrayidx.1 = getelementptr inbounds [3 x i8], ptr %a, i64 0, i64 1
%5 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %5, label %for.inc.1 [
i8 97, label %if.then.1
i8 98, label %if.then8.1
i8 99, label %if.then16.1
]
if.then16.1: ; preds = %for.inc
%inc17.1 = add nuw nsw i32 %d.1, 1
br label %for.inc.1
if.then8.1: ; preds = %for.inc
%inc9.1 = add nuw nsw i32 %c.1, 1
br label %for.inc.1
if.then.1: ; preds = %for.inc
%inc.1 = add nuw nsw i32 %b.1, 1
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %if.then8.1, %if.then16.1, %for.inc
%b.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ %b.1, %if.then8.1 ], [ %b.1, %if.then16.1 ], [ %b.1, %for.inc ]
%c.1.1 = phi i32 [ %c.1, %if.then.1 ], [ %inc9.1, %if.then8.1 ], [ %c.1, %if.then16.1 ], [ %c.1, %for.inc ]
%d.1.1 = phi i32 [ %d.1, %if.then.1 ], [ %d.1, %if.then8.1 ], [ %inc17.1, %if.then16.1 ], [ %d.1, %for.inc ]
%arrayidx.2 = getelementptr inbounds [3 x i8], ptr %a, i64 0, i64 2
%6 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
switch i8 %6, label %for.inc.2 [
i8 97, label %if.then.2
i8 98, label %if.then8.2
i8 99, label %if.then16.2
]
if.then16.2: ; preds = %for.inc.1
%inc17.2 = add nuw nsw i32 %d.1.1, 1
br label %for.inc.2
if.then8.2: ; preds = %for.inc.1
%inc9.2 = add nuw nsw i32 %c.1.1, 1
br label %for.inc.2
if.then.2: ; preds = %for.inc.1
%inc.2 = add nuw nsw i32 %b.1.1, 1
br label %for.inc.2
for.inc.2: ; preds = %if.then.2, %if.then8.2, %if.then16.2, %for.inc.1
%b.1.2 = phi i32 [ %inc.2, %if.then.2 ], [ %b.1.1, %if.then8.2 ], [ %b.1.1, %if.then16.2 ], [ %b.1.1, %for.inc.1 ]
%c.1.2 = phi i32 [ %c.1.1, %if.then.2 ], [ %inc9.2, %if.then8.2 ], [ %c.1.1, %if.then16.2 ], [ %c.1.1, %for.inc.1 ]
%d.1.2 = phi i32 [ %d.1.1, %if.then.2 ], [ %d.1.1, %if.then8.2 ], [ %inc17.2, %if.then16.2 ], [ %d.1.1, %for.inc.1 ]
%cmp21 = icmp eq i32 %b.1.2, 1
%cmp23 = icmp eq i32 %c.1.2, 1
%or.cond = select i1 %cmp21, i1 %cmp23, i1 false
%cmp26 = icmp eq i32 %d.1.2, 1
%or.cond33 = select i1 %or.cond, i1 %cmp26, i1 false
%str.3.str = select i1 %or.cond33, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 3, 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
char s[4];
int i,abc[3] = {0,0,0};
scanf("%s",s);
for(i = 0;i < 3;i++){
if(s[i] == 'a')
abc[0] = 1;
if(s[i] == 'b')
abc[1] = 1;
if(s[i] == 'c')
abc[2] = 1;
}
if(abc[0] == 1 && abc[1] == 1 && abc[2] == 1)
puts("Yes");
else
puts("No");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176584/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176584/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp1 = icmp eq i8 %0, 97
%cmp7 = icmp eq i8 %0, 98
%cmp15 = icmp eq i8 %0, 99
%arrayidx.1 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%cmp1.1 = icmp eq i8 %1, 97
%cmp7.1 = icmp eq i8 %1, 98
%cmp15.1 = icmp eq i8 %1, 99
%arrayidx.2 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%cmp1.2 = icmp eq i8 %2, 97
%3 = select i1 %cmp1.2, i1 true, i1 %cmp1.1
%narrow46 = select i1 %3, i1 true, i1 %cmp1
%cmp7.2 = icmp eq i8 %2, 98
%4 = select i1 %cmp7.2, i1 true, i1 %cmp7.1
%narrow = select i1 %4, i1 true, i1 %cmp7
%cmp15.2 = icmp eq i8 %2, 99
%5 = select i1 %cmp15.2, i1 true, i1 %cmp15.1
%narrow47 = select i1 %5, i1 true, i1 %cmp15
%or.cond = select i1 %narrow46, i1 %narrow, i1 false
%or.cond34 = select i1 %or.cond, i1 %narrow47, i1 false
%.str.1..str.2 = select i1 %or.cond34, ptr @.str.1, ptr @.str.2
%call32 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, 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 @puts(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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
char a[4];
scanf("%s",&a);
if(a[0]!=a[1]&&a[1]!=a[2]&&a[2]!=a[0]){
printf("Yes");
}else{
printf("No");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176627/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176627/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [4 x i8], align 1
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 i8, ptr %a, align 1, !tbaa !5
%arrayidx1 = getelementptr inbounds [4 x i8], ptr %a, i64 0, i64 1
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !5
%cmp.not = icmp eq i8 %0, %1
br i1 %cmp.not, label %if.else, label %land.lhs.true
land.lhs.true: ; preds = %entry
%arrayidx6 = getelementptr inbounds [4 x i8], ptr %a, i64 0, i64 2
%2 = load i8, ptr %arrayidx6, align 1, !tbaa !5
%cmp8.not = icmp eq i8 %1, %2
%cmp15.not = icmp eq i8 %2, %0
%or.cond = or i1 %cmp8.not, %cmp15.not
br i1 %or.cond, label %if.else, label %if.end
if.else: ; preds = %land.lhs.true, %entry
br label %if.end
if.end: ; preds = %land.lhs.true, %if.else
%.str.2.sink = phi ptr [ @.str.2, %if.else ], [ @.str.1, %land.lhs.true ]
%call18 = 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
char S[]= "aaa";//とりあえず代入
scanf("%s",&S);//ここで真の値を代入
//printf("入力された文字列は:%s", S);
if (S[0] == S[1] || S[1] == S[2] || S[0] == S[2]) {
printf("No\n");
}
else {
printf("Yes\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176678/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176678/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 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [4 x i8], align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %S) #4
store i32 6381921, ptr %S, align 4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%0 = load i8, ptr %S, align 4, !tbaa !5
%arrayidx1 = getelementptr inbounds [4 x i8], ptr %S, i64 0, i64 1
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !5
%cmp = icmp eq i8 %0, %1
br i1 %cmp, label %if.end, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%arrayidx6 = getelementptr inbounds [4 x i8], ptr %S, i64 0, i64 2
%2 = load i8, ptr %arrayidx6, align 2, !tbaa !5
%cmp8 = icmp eq i8 %1, %2
%cmp15 = icmp eq i8 %0, %2
%or.cond = or i1 %cmp8, %cmp15
%spec.select = select i1 %or.cond, ptr @str.3, ptr @str
br label %if.end
if.end: ; preds = %lor.lhs.false, %entry
%str.sink = phi ptr [ @str.3, %entry ], [ %spec.select, %lor.lhs.false ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %S) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
char s[3];
int i,s0=0,s1=0,s2=0;
scanf("%s",s);
if(s[0]=='a'||s[1]=='a'||s[2]=='a')s0++;
if(s[0]=='b'||s[1]=='b'||s[2]=='b')s1++;
if(s[0]=='c'||s[1]=='c'||s[2]=='c')s2++;
if(s0+s1+s2==3){
printf("Yes\n");
}else{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176728/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176728/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 = 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:
%s = alloca [3 x i8], align 1
call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%cmp = icmp eq i8 %0, 97
%arrayidx2 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx2, align 1
%cmp4 = icmp eq i8 %1, 97
%or.cond = select i1 %cmp, i1 true, i1 %cmp4
%arrayidx7 = getelementptr inbounds [3 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx7, align 1
%cmp9 = icmp eq i8 %2, 97
%or.cond52 = select i1 %or.cond, i1 true, i1 %cmp9
%spec.select = zext i1 %or.cond52 to i32
%cmp13 = icmp eq i8 %0, 98
%cmp18 = icmp eq i8 %1, 98
%or.cond53 = select i1 %cmp13, i1 true, i1 %cmp18
%cmp23 = icmp eq i8 %2, 98
%or.cond54 = select i1 %or.cond53, i1 true, i1 %cmp23
%s1.0 = zext i1 %or.cond54 to i32
%cmp30 = icmp eq i8 %0, 99
%cmp35 = icmp eq i8 %1, 99
%or.cond55 = select i1 %cmp30, i1 true, i1 %cmp35
%cmp40 = icmp eq i8 %2, 99
%or.cond56 = select i1 %or.cond55, i1 true, i1 %cmp40
%s2.0 = zext i1 %or.cond56 to i32
%add = add nuw nsw i32 %spec.select, %s1.0
%add45 = add nuw nsw i32 %add, %s2.0
%cmp46 = icmp eq i32 %add45, 3
%str.3.str = select i1 %cmp46, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
typedef long long int int64;
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a,b) ((a)>(0)?(a):-(a))
void run(void){
int s[3]={0};
int i;
for(i=0;i<3;i++){
char c;
scanf("%c",&c);
s[c-'a']++;
}
for(i=0;i<3;i++){
if(s[i]!=1){
printf("No\n");
return;
}
}
printf("Yes\n");
return;
}
int main(void){
run();
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176779/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176779/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"%c\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @run() local_unnamed_addr #0 {
entry:
%s = alloca [3 x i32], align 4
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %s) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %s, i8 0, i64 12, i1 false)
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%0 = load i8, ptr %c, align 1, !tbaa !5
%conv = sext i8 %0 to i64
%sub = add nsw i64 %conv, -97
%arrayidx = getelementptr inbounds [3 x i32], ptr %s, i64 0, i64 %sub
%1 = load i32, ptr %arrayidx, align 4, !tbaa !8
%inc = add nsw i32 %1, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !8
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #5
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%2 = load i8, ptr %c, align 1, !tbaa !5
%conv.1 = sext i8 %2 to i64
%sub.1 = add nsw i64 %conv.1, -97
%arrayidx.1 = getelementptr inbounds [3 x i32], ptr %s, i64 0, i64 %sub.1
%3 = load i32, ptr %arrayidx.1, align 4, !tbaa !8
%inc.1 = add nsw i32 %3, 1
store i32 %inc.1, ptr %arrayidx.1, align 4, !tbaa !8
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #5
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%4 = load i8, ptr %c, align 1, !tbaa !5
%conv.2 = sext i8 %4 to i64
%sub.2 = add nsw i64 %conv.2, -97
%arrayidx.2 = getelementptr inbounds [3 x i32], ptr %s, i64 0, i64 %sub.2
%5 = load i32, ptr %arrayidx.2, align 4, !tbaa !8
%inc.2 = add nsw i32 %5, 1
store i32 %inc.2, ptr %arrayidx.2, align 4, !tbaa !8
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #5
%6 = load i32, ptr %s, align 4, !tbaa !8
%cmp8.not = icmp eq i32 %6, 1
%arrayidx7.1 = getelementptr inbounds [3 x i32], ptr %s, i64 0, i64 1
%7 = load i32, ptr %arrayidx7.1, align 4
%cmp8.not.1 = icmp eq i32 %7, 1
%or.cond = select i1 %cmp8.not, i1 %cmp8.not.1, i1 false
%arrayidx7.2 = getelementptr inbounds [3 x i32], ptr %s, i64 0, i64 2
%8 = load i32, ptr %arrayidx7.2, align 4
%cmp8.not.2 = icmp eq i32 %8, 1
%or.cond24 = select i1 %or.cond, i1 %cmp8.not.2, i1 false
%str.str.3 = select i1 %or.cond24, ptr @str, ptr @str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3)
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %s) #5
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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind 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:
%s.i = alloca [3 x i32], align 4
%c.i = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %s.i) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %s.i, i8 0, i64 12, i1 false)
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c.i) #5
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c.i)
%0 = load i8, ptr %c.i, align 1, !tbaa !5
%conv.i = sext i8 %0 to i64
%sub.i = add nsw i64 %conv.i, -97
%arrayidx.i = getelementptr inbounds [3 x i32], ptr %s.i, i64 0, i64 %sub.i
%1 = load i32, ptr %arrayidx.i, align 4, !tbaa !8
%inc.i = add nsw i32 %1, 1
store i32 %inc.i, ptr %arrayidx.i, align 4, !tbaa !8
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c.i) #5
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c.i) #5
%call.1.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c.i)
%2 = load i8, ptr %c.i, align 1, !tbaa !5
%conv.1.i = sext i8 %2 to i64
%sub.1.i = add nsw i64 %conv.1.i, -97
%arrayidx.1.i = getelementptr inbounds [3 x i32], ptr %s.i, i64 0, i64 %sub.1.i
%3 = load i32, ptr %arrayidx.1.i, align 4, !tbaa !8
%inc.1.i = add nsw i32 %3, 1
store i32 %inc.1.i, ptr %arrayidx.1.i, align 4, !tbaa !8
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c.i) #5
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c.i) #5
%call.2.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c.i)
%4 = load i8, ptr %c.i, align 1, !tbaa !5
%conv.2.i = sext i8 %4 to i64
%sub.2.i = add nsw i64 %conv.2.i, -97
%arrayidx.2.i = getelementptr inbounds [3 x i32], ptr %s.i, i64 0, i64 %sub.2.i
%5 = load i32, ptr %arrayidx.2.i, align 4, !tbaa !8
%inc.2.i = add nsw i32 %5, 1
store i32 %inc.2.i, ptr %arrayidx.2.i, align 4, !tbaa !8
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c.i) #5
%6 = load i32, ptr %s.i, align 4, !tbaa !8
%cmp8.not.i = icmp eq i32 %6, 1
%arrayidx7.1.i = getelementptr inbounds [3 x i32], ptr %s.i, i64 0, i64 1
%7 = load i32, ptr %arrayidx7.1.i, align 4
%cmp8.not.1.i = icmp eq i32 %7, 1
%or.cond.i = select i1 %cmp8.not.i, i1 %cmp8.not.1.i, i1 false
%arrayidx7.2.i = getelementptr inbounds [3 x i32], ptr %s.i, i64 0, i64 2
%8 = load i32, ptr %arrayidx7.2.i, align 4
%cmp8.not.2.i = icmp eq i32 %8, 1
%or.cond24.i = select i1 %or.cond.i, i1 %cmp8.not.2.i, i1 false
%str.str.3.i = select i1 %or.cond24.i, ptr @str, ptr @str.3
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) %str.str.3.i)
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %s.i) #5
ret i32 0
}
; 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
|
#include<stdio.h>
#define min(a,b) (a)<(b)?(a):(b)
int main(void)
{
long long min=10000000000,n,a[100010],judge=1;
scanf("%lld",&n);
for(int i=0;i<n;i++){
scanf("%lld",&a[i]);
min=min(min,a[i]);
}
while(judge){
for(int i=0;i<n;i++){
if(a[i]%min){
a[i]=a[i]%min;
min=min(min,a[i]);
}
}
judge=0;
for(int i=0;i<n;i++){
if(a[i]%min){
judge++;
}
}
}
printf("%lld",min);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176821/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176821/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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%a = alloca [100010 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 800080, 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
%cmp75 = icmp sgt i64 %0, 0
br i1 %cmp75, label %for.body, label %while.end
while.cond.preheader: ; preds = %for.body
%cmp1280 = icmp sgt i64 %7, 0
br i1 %cmp1280, label %for.body15.us.us.preheader, label %while.end
for.body15.us.us.preheader: ; preds = %while.cond.preheader
%xtraiter = and i64 %7, 1
%1 = icmp eq i64 %7, 1
%unroll_iter = and i64 %7, -2
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.body15.us.us
for.body43.us.us: ; preds = %for.body43.us.us.preheader, %for.body43.us.us
%indvars.iv118 = phi i64 [ %indvars.iv.next119.1, %for.body43.us.us ], [ 0, %for.body43.us.us.preheader ]
%judge.186.us.us = phi i64 [ %spec.select.us.us.1, %for.body43.us.us ], [ 0, %for.body43.us.us.preheader ]
%niter = phi i64 [ %niter.next.1, %for.body43.us.us ], [ 0, %for.body43.us.us.preheader ]
%arrayidx45.us.us = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %indvars.iv118
%2 = load i64, ptr %arrayidx45.us.us, align 16, !tbaa !5
%rem46.us.us = srem i64 %2, %min.3.us.us
%tobool47.not.us.us = icmp ne i64 %rem46.us.us, 0
%inc49.us.us = zext i1 %tobool47.not.us.us to i64
%spec.select.us.us = add nuw nsw i64 %judge.186.us.us, %inc49.us.us
%indvars.iv.next119 = or i64 %indvars.iv118, 1
%arrayidx45.us.us.1 = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %indvars.iv.next119
%3 = load i64, ptr %arrayidx45.us.us.1, align 8, !tbaa !5
%rem46.us.us.1 = srem i64 %3, %min.3.us.us
%tobool47.not.us.us.1 = icmp ne i64 %rem46.us.us.1, 0
%inc49.us.us.1 = zext i1 %tobool47.not.us.us.1 to i64
%spec.select.us.us.1 = add nuw nsw i64 %spec.select.us.us, %inc49.us.us.1
%indvars.iv.next119.1 = add nuw nsw i64 %indvars.iv118, 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.cond38.while.cond.loopexit_crit_edge.us.us.unr-lcssa, label %for.body43.us.us, !llvm.loop !9
for.body15.us.us: ; preds = %for.body15.us.us.backedge, %for.body15.us.us.preheader
%indvars.iv115 = phi i64 [ 0, %for.body15.us.us.preheader ], [ %indvars.iv115.be, %for.body15.us.us.backedge ]
%min.281.us.us = phi i64 [ %min.0., %for.body15.us.us.preheader ], [ %min.3.us.us, %for.body15.us.us.backedge ]
%arrayidx17.us.us = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %indvars.iv115
%4 = load i64, ptr %arrayidx17.us.us, align 8, !tbaa !5
%rem.us.us = srem i64 %4, %min.281.us.us
%tobool18.not.us.us = icmp eq i64 %rem.us.us, 0
br i1 %tobool18.not.us.us, label %for.inc34.us.us, label %if.then.us.us
if.then.us.us: ; preds = %for.body15.us.us
store i64 %rem.us.us, ptr %arrayidx17.us.us, align 8, !tbaa !5
%cmp26.us.us = icmp slt i64 %min.281.us.us, 0
%min.2.rem.us.us = select i1 %cmp26.us.us, i64 %min.281.us.us, i64 %rem.us.us
br label %for.inc34.us.us
for.inc34.us.us: ; preds = %if.then.us.us, %for.body15.us.us
%min.3.us.us = phi i64 [ %min.2.rem.us.us, %if.then.us.us ], [ %min.281.us.us, %for.body15.us.us ]
%indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
%exitcond.not = icmp eq i64 %indvars.iv.next116, %7
br i1 %exitcond.not, label %for.body43.us.us.preheader, label %for.body15.us.us.backedge
for.body15.us.us.backedge: ; preds = %for.inc34.us.us, %for.cond38.while.cond.loopexit_crit_edge.us.us
%indvars.iv115.be = phi i64 [ %indvars.iv.next116, %for.inc34.us.us ], [ 0, %for.cond38.while.cond.loopexit_crit_edge.us.us ]
br label %for.body15.us.us, !llvm.loop !11
for.body43.us.us.preheader: ; preds = %for.inc34.us.us
br i1 %1, label %for.cond38.while.cond.loopexit_crit_edge.us.us.unr-lcssa, label %for.body43.us.us
for.cond38.while.cond.loopexit_crit_edge.us.us.unr-lcssa: ; preds = %for.body43.us.us, %for.body43.us.us.preheader
%spec.select.us.us.lcssa.ph = phi i64 [ undef, %for.body43.us.us.preheader ], [ %spec.select.us.us.1, %for.body43.us.us ]
%indvars.iv118.unr = phi i64 [ 0, %for.body43.us.us.preheader ], [ %indvars.iv.next119.1, %for.body43.us.us ]
%judge.186.us.us.unr = phi i64 [ 0, %for.body43.us.us.preheader ], [ %spec.select.us.us.1, %for.body43.us.us ]
br i1 %lcmp.mod.not, label %for.cond38.while.cond.loopexit_crit_edge.us.us, label %for.body43.us.us.epil
for.body43.us.us.epil: ; preds = %for.cond38.while.cond.loopexit_crit_edge.us.us.unr-lcssa
%arrayidx45.us.us.epil = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %indvars.iv118.unr
%5 = load i64, ptr %arrayidx45.us.us.epil, align 8, !tbaa !5
%rem46.us.us.epil = srem i64 %5, %min.3.us.us
%tobool47.not.us.us.epil = icmp ne i64 %rem46.us.us.epil, 0
%inc49.us.us.epil = zext i1 %tobool47.not.us.us.epil to i64
%spec.select.us.us.epil = add nuw nsw i64 %judge.186.us.us.unr, %inc49.us.us.epil
br label %for.cond38.while.cond.loopexit_crit_edge.us.us
for.cond38.while.cond.loopexit_crit_edge.us.us: ; preds = %for.cond38.while.cond.loopexit_crit_edge.us.us.unr-lcssa, %for.body43.us.us.epil
%spec.select.us.us.lcssa = phi i64 [ %spec.select.us.us.lcssa.ph, %for.cond38.while.cond.loopexit_crit_edge.us.us.unr-lcssa ], [ %spec.select.us.us.epil, %for.body43.us.us.epil ]
%tobool.not.us.us = icmp eq i64 %spec.select.us.us.lcssa, 0
br i1 %tobool.not.us.us, label %while.end, label %for.body15.us.us.backedge
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%min.076 = phi i64 [ %min.0., %for.body ], [ 10000000000, %entry ]
%arrayidx = getelementptr inbounds [100010 x i64], ptr %a, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%min.0. = call i64 @llvm.smin.i64(i64 %min.076, i64 %6)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp sgt i64 %7, %indvars.iv.next
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !12
while.end: ; preds = %for.cond38.while.cond.loopexit_crit_edge.us.us, %entry, %while.cond.preheader
%.us-phi = phi i64 [ %min.0., %while.cond.preheader ], [ 10000000000, %entry ], [ %min.3.us.us, %for.cond38.while.cond.loopexit_crit_edge.us.us ]
%call54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %.us-phi)
call void @llvm.lifetime.end.p0(i64 800080, 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: 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
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int gcd(int a, int b);
int main(void)
{
int n, a, b;
scanf("%d", &n);
scanf("%d", &a);
for(int i = 1; i < n; i++)
{
scanf("%d", &b);
a = gcd(a, b);
}
printf("%d", a);
}
int gcd(int a, int b)
{
if(b == 0)
return a;
return gcd(b, a%b);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176865/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176865/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
; 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
%b = 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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #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 %n, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %0, 1
br i1 %cmp6, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = load i32, ptr %a, align 4, !tbaa !5
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %gcd.exit, %entry.for.cond.cleanup_crit_edge
%1 = phi i32 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %a.tr.lcssa.i, %gcd.exit ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
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, %gcd.exit
%i.07 = phi i32 [ %inc, %gcd.exit ], [ 1, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4, !tbaa !5
%cmp4.i = icmp eq i32 %3, 0
br i1 %cmp4.i, label %gcd.exit, label %if.end.i
if.end.i: ; preds = %for.body, %if.end.i
%b.tr6.i = phi i32 [ %rem.i, %if.end.i ], [ %3, %for.body ]
%a.tr5.i = phi i32 [ %b.tr6.i, %if.end.i ], [ %2, %for.body ]
%rem.i = srem i32 %a.tr5.i, %b.tr6.i
%cmp.i = icmp eq i32 %rem.i, 0
br i1 %cmp.i, label %gcd.exit, label %if.end.i
gcd.exit: ; preds = %if.end.i, %for.body
%a.tr.lcssa.i = phi i32 [ %2, %for.body ], [ %b.tr6.i, %if.end.i ]
store i32 %a.tr.lcssa.i, ptr %a, align 4, !tbaa !5
%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 !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: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%cmp4 = icmp eq i32 %b, 0
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%b.tr6 = phi i32 [ %rem, %if.end ], [ %b, %entry ]
%a.tr5 = phi i32 [ %b.tr6, %if.end ], [ %a, %entry ]
%rem = srem i32 %a.tr5, %b.tr6
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
%a.tr.lcssa = phi i32 [ %a, %entry ], [ %b.tr6, %if.end ]
ret i32 %a.tr.lcssa
}
; 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 = { 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 #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 <stdlib.h>
#include <string.h>
#include <math.h>
int qsort_int(const void *a, const void *b)
{
return *(int *)a - *(int *)b;
}
int main(int argc, char *argv[])
{
int n;
int a[100000];
int alive, offset;
int need_sort;
int check;
int i, count;
int ans;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
qsort(a, n, sizeof(int), qsort_int);
alive = n;
offset = 0;
check = 0;
while(alive > 1) {
need_sort = 0;
count = a[offset + 1] / a[offset];
if (a[offset] == 1) {break;}
check = 0;
for (i = offset + 1; i < n; i++) {
a[i] -= a[offset] * count;
if (a[i] < a[offset]) {need_sort = 1;}
if (a[i] < 1) {alive--;}
if (a[i] > 0 && a[i] % a[offset] == 0) {check++;}
}
if (check == alive - 1) {break;}
if (need_sort) {
qsort(a + offset, n - offset, sizeof(int), qsort_int);
offset = n - alive;
}
}
printf("%d\n", a[offset]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176908/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176908/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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @qsort_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%a = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 400000, 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
%cmp91 = icmp sgt i32 %0, 0
br i1 %cmp91, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %2, %for.body ]
call void @qsort(ptr noundef nonnull %a, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @qsort_int) #5
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp2102 = icmp sgt i32 %3, 1
br i1 %cmp2102, label %while.body, label %while.end
while.body: ; preds = %for.end, %if.end61
%4 = phi i32 [ %12, %if.end61 ], [ %3, %for.end ]
%alive.0104 = phi i32 [ %alive.1.lcssa118122, %if.end61 ], [ %3, %for.end ]
%offset.0103 = phi i32 [ %offset.1, %if.end61 ], [ 0, %for.end ]
%add = add nsw i32 %offset.0103, 1
%idxprom4 = sext i32 %add to i64
%arrayidx5 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %idxprom4
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%idxprom6 = sext i32 %offset.0103 to i64
%arrayidx7 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %idxprom6
%6 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%div = sdiv i32 %5, %6
%cmp10 = icmp eq i32 %6, 1
br i1 %cmp10, label %while.end.loopexit, label %for.cond13.preheader
for.cond13.preheader: ; preds = %while.body
%cmp1493 = icmp slt i32 %add, %4
br i1 %cmp1493, label %for.body16.preheader, label %if.end61
for.body16.preheader: ; preds = %for.cond13.preheader
%7 = add nsw i64 %idxprom6, 1
br label %for.body16
for.body16: ; preds = %for.body16.preheader, %for.inc48
%8 = phi i32 [ %6, %for.body16.preheader ], [ %10, %for.inc48 ]
%indvars.iv109 = phi i64 [ %7, %for.body16.preheader ], [ %indvars.iv.next110, %for.inc48 ]
%alive.197 = phi i32 [ %alive.0104, %for.body16.preheader ], [ %alive.2, %for.inc48 ]
%check.095 = phi i32 [ 0, %for.body16.preheader ], [ %check.1, %for.inc48 ]
%need_sort.094 = phi i32 [ 0, %for.body16.preheader ], [ %spec.select, %for.inc48 ]
%mul = mul nsw i32 %8, %div
%arrayidx20 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv109
%9 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%sub = sub nsw i32 %9, %mul
store i32 %sub, ptr %arrayidx20, align 4, !tbaa !5
%10 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp25 = icmp slt i32 %sub, %10
%spec.select = select i1 %cmp25, i32 1, i32 %need_sort.094
%cmp31 = icmp slt i32 %sub, 1
%dec = sext i1 %cmp31 to i32
%alive.2 = add nsw i32 %alive.197, %dec
%cmp37 = icmp sgt i32 %sub, 0
br i1 %cmp37, label %land.lhs.true, label %for.inc48
land.lhs.true: ; preds = %for.body16
%rem = srem i32 %sub, %10
%cmp43 = icmp eq i32 %rem, 0
%inc46 = zext i1 %cmp43 to i32
%spec.select89 = add nsw i32 %check.095, %inc46
br label %for.inc48
for.inc48: ; preds = %land.lhs.true, %for.body16
%check.1 = phi i32 [ %check.095, %for.body16 ], [ %spec.select89, %land.lhs.true ]
%indvars.iv.next110 = add nsw i64 %indvars.iv109, 1
%lftr.wideiv = trunc i64 %indvars.iv.next110 to i32
%exitcond.not = icmp eq i32 %4, %lftr.wideiv
br i1 %exitcond.not, label %for.end50, label %for.body16, !llvm.loop !11
for.end50: ; preds = %for.inc48
%sub51 = add nsw i32 %alive.2, -1
%cmp52 = icmp eq i32 %check.1, %sub51
br i1 %cmp52, label %while.end.loopexit, label %if.end55
if.end55: ; preds = %for.end50
%tobool.not = icmp eq i32 %spec.select, 0
br i1 %tobool.not, label %if.end61, label %if.then56
if.then56: ; preds = %if.end55
%sub58 = sub nsw i32 %4, %offset.0103
%conv59 = sext i32 %sub58 to i64
call void @qsort(ptr noundef nonnull %arrayidx7, i64 noundef %conv59, i64 noundef 4, ptr noundef nonnull @qsort_int) #5
%11 = load i32, ptr %n, align 4, !tbaa !5
%sub60 = sub nsw i32 %11, %alive.2
br label %if.end61
if.end61: ; preds = %for.cond13.preheader, %if.then56, %if.end55
%alive.1.lcssa118122 = phi i32 [ %alive.2, %if.then56 ], [ %alive.2, %if.end55 ], [ %alive.0104, %for.cond13.preheader ]
%12 = phi i32 [ %11, %if.then56 ], [ %4, %if.end55 ], [ %4, %for.cond13.preheader ]
%offset.1 = phi i32 [ %sub60, %if.then56 ], [ %offset.0103, %if.end55 ], [ %offset.0103, %for.cond13.preheader ]
%cmp2 = icmp sgt i32 %alive.1.lcssa118122, 1
br i1 %cmp2, label %while.body, label %while.end.loopexit, !llvm.loop !12
while.end.loopexit: ; preds = %for.end50, %while.body, %if.end61
%offset.0.lcssa.ph = phi i32 [ %offset.1, %if.end61 ], [ %offset.0103, %while.body ], [ %offset.0103, %for.end50 ]
%13 = sext i32 %offset.0.lcssa.ph to i64
br label %while.end
while.end: ; preds = %while.end.loopexit, %for.end
%offset.0.lcssa = phi i64 [ 0, %for.end ], [ %13, %while.end.loopexit ]
%arrayidx63 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %offset.0.lcssa
%14 = load i32, ptr %arrayidx63, align 4, !tbaa !5
%call64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14)
call void @llvm.lifetime.end.p0(i64 400000, 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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 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) #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 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#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))
typedef struct {
int X;
int Y;
} st_nums;
int main(void) {
int N;
scanf("%d", &N);
st_nums nums[50];
for(int i = 0; i < N; i++) {
scanf("%d %d", &nums[i].X, &nums[i].Y);
}
int minCost = N;
for(int i = 0; i < N-1; i++) {
for(int j = i+1; j < N; j++) {
int p = nums[i].X - nums[j].X;
int q = nums[i].Y - nums[j].Y;
int cost = N;
for(int m = 0; m < N-1; m++) {
for(int n = m+1; n < N; n++) {
if(((nums[m].X-p) == (nums[n].X) &&
(nums[m].Y-q) == (nums[n].Y)) ||
((nums[m].X+p) == (nums[n].X) &&
(nums[m].Y+q) == (nums[n].Y)))
cost--;
}
}
minCost = MIN(minCost, cost);
}
}
printf("%d\n", minCost);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_176959/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_176959/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.st_nums = type { i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%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
%nums = alloca [50 x %struct.st_nums], 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 400, ptr nonnull %nums) #4
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp112 = icmp sgt i32 %0, 0
br i1 %cmp112, label %for.body, label %for.cond.cleanup7
for.cond5.preheader: ; preds = %for.body
%cmp6126 = icmp sgt i32 %12, 1
br i1 %cmp6126, label %for.body8.us.preheader, label %for.cond.cleanup7
for.body8.us.preheader: ; preds = %for.cond5.preheader
%sub = add i32 %12, -1
%1 = zext i32 %12 to i64
%wide.trip.count154 = zext i32 %sub to i64
%wide.trip.count149 = zext i32 %12 to i64
br label %for.body8.us
for.body8.us: ; preds = %for.body8.us.preheader, %for.cond5.loopexit.us
%indvars.iv151 = phi i64 [ 0, %for.body8.us.preheader ], [ %indvars.iv.next152, %for.cond5.loopexit.us ]
%indvars.iv144 = phi i64 [ 1, %for.body8.us.preheader ], [ %indvars.iv.next145, %for.cond5.loopexit.us ]
%minCost.0127.us = phi i32 [ %12, %for.body8.us.preheader ], [ %minCost.1.lcssa.us, %for.cond5.loopexit.us ]
%indvars.iv.next152 = add nuw nsw i64 %indvars.iv151, 1
%cmp10122.us = icmp ult i64 %indvars.iv.next152, %1
br i1 %cmp10122.us, label %for.body12.lr.ph.us, label %for.cond5.loopexit.us
for.cond5.loopexit.us: ; preds = %for.cond27.for.cond.cleanup30_crit_edge.us.us, %for.body8.us
%minCost.1.lcssa.us = phi i32 [ %minCost.0127.us, %for.body8.us ], [ %cond.us.us, %for.cond27.for.cond.cleanup30_crit_edge.us.us ]
%indvars.iv.next145 = add nuw nsw i64 %indvars.iv144, 1
%exitcond155.not = icmp eq i64 %indvars.iv.next152, %wide.trip.count154
br i1 %exitcond155.not, label %for.cond.cleanup7, label %for.body8.us, !llvm.loop !9
for.body12.lr.ph.us: ; preds = %for.body8.us
%arrayidx14.us = getelementptr inbounds [50 x %struct.st_nums], ptr %nums, i64 0, i64 %indvars.iv151
%2 = load i32, ptr %arrayidx14.us, align 8, !tbaa !11
%Y22.us = getelementptr inbounds [50 x %struct.st_nums], ptr %nums, i64 0, i64 %indvars.iv151, i32 1
%3 = load i32, ptr %Y22.us, align 4, !tbaa !13
br label %for.body12.us.us
for.body12.us.us: ; preds = %for.cond27.for.cond.cleanup30_crit_edge.us.us, %for.body12.lr.ph.us
%indvars.iv146 = phi i64 [ %indvars.iv.next147, %for.cond27.for.cond.cleanup30_crit_edge.us.us ], [ %indvars.iv144, %for.body12.lr.ph.us ]
%minCost.1123.us.us = phi i32 [ %cond.us.us, %for.cond27.for.cond.cleanup30_crit_edge.us.us ], [ %minCost.0127.us, %for.body12.lr.ph.us ]
%arrayidx17.us.us = getelementptr inbounds [50 x %struct.st_nums], ptr %nums, i64 0, i64 %indvars.iv146
%4 = load i32, ptr %arrayidx17.us.us, align 8, !tbaa !11
%sub19.us.us = sub nsw i32 %2, %4
%Y25.us.us = getelementptr inbounds [50 x %struct.st_nums], ptr %nums, i64 0, i64 %indvars.iv146, i32 1
%5 = load i32, ptr %Y25.us.us, align 4, !tbaa !13
%sub26.us.us = sub nsw i32 %3, %5
br label %for.body31.us.us
for.body31.us.us: ; preds = %for.cond27.loopexit.us.us, %for.body12.us.us
%indvars.iv139 = phi i64 [ %indvars.iv.next140, %for.cond27.loopexit.us.us ], [ 0, %for.body12.us.us ]
%indvars.iv134 = phi i64 [ %indvars.iv.next135, %for.cond27.loopexit.us.us ], [ 1, %for.body12.us.us ]
%cost.0119.us.us = phi i32 [ %cost.1.lcssa.us.us, %for.cond27.loopexit.us.us ], [ %12, %for.body12.us.us ]
%indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1
%cmp34114.us.us = icmp ult i64 %indvars.iv.next140, %1
br i1 %cmp34114.us.us, label %for.body36.lr.ph.us.us, label %for.cond27.loopexit.us.us
for.body36.us.us: ; preds = %for.body36.lr.ph.us.us, %for.inc70.us.us
%indvars.iv136 = phi i64 [ %indvars.iv134, %for.body36.lr.ph.us.us ], [ %indvars.iv.next137, %for.inc70.us.us ]
%cost.1115.us.us = phi i32 [ %cost.0119.us.us, %for.body36.lr.ph.us.us ], [ %cost.2.us.us, %for.inc70.us.us ]
%arrayidx42.us.us = getelementptr inbounds [50 x %struct.st_nums], ptr %nums, i64 0, i64 %indvars.iv136
%6 = load i32, ptr %arrayidx42.us.us, align 8, !tbaa !11
%cmp44.us.us = icmp eq i32 %sub40.us.us, %6
br i1 %cmp44.us.us, label %land.lhs.true.us.us, label %lor.lhs.false.us.us
land.lhs.true.us.us: ; preds = %for.body36.us.us
%7 = load i32, ptr %Y47.us.us, align 4, !tbaa !13
%sub48.us.us = sub nsw i32 %7, %sub26.us.us
%Y51.us.us = getelementptr inbounds [50 x %struct.st_nums], ptr %nums, i64 0, i64 %indvars.iv136, i32 1
%8 = load i32, ptr %Y51.us.us, align 4, !tbaa !13
%cmp52.us.us = icmp eq i32 %sub48.us.us, %8
br i1 %cmp52.us.us, label %if.then.us.us, label %lor.lhs.false.us.us
lor.lhs.false.us.us: ; preds = %land.lhs.true.us.us, %for.body36.us.us
%cmp60.us.us = icmp eq i32 %add56.us.us, %6
br i1 %cmp60.us.us, label %land.lhs.true61.us.us, label %for.inc70.us.us
land.lhs.true61.us.us: ; preds = %lor.lhs.false.us.us
%9 = load i32, ptr %Y47.us.us, align 4, !tbaa !13
%add65.us.us = add nsw i32 %9, %sub26.us.us
%Y68.us.us = getelementptr inbounds [50 x %struct.st_nums], ptr %nums, i64 0, i64 %indvars.iv136, i32 1
%10 = load i32, ptr %Y68.us.us, align 4, !tbaa !13
%cmp69.us.us = icmp eq i32 %add65.us.us, %10
br i1 %cmp69.us.us, label %if.then.us.us, label %for.inc70.us.us
if.then.us.us: ; preds = %land.lhs.true61.us.us, %land.lhs.true.us.us
%dec.us.us = add nsw i32 %cost.1115.us.us, -1
br label %for.inc70.us.us
for.inc70.us.us: ; preds = %if.then.us.us, %land.lhs.true61.us.us, %lor.lhs.false.us.us
%cost.2.us.us = phi i32 [ %dec.us.us, %if.then.us.us ], [ %cost.1115.us.us, %land.lhs.true61.us.us ], [ %cost.1115.us.us, %lor.lhs.false.us.us ]
%indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
%exitcond.not = icmp eq i64 %indvars.iv.next137, %wide.trip.count149
br i1 %exitcond.not, label %for.cond27.loopexit.us.us, label %for.body36.us.us, !llvm.loop !14
for.cond27.loopexit.us.us: ; preds = %for.inc70.us.us, %for.body31.us.us
%cost.1.lcssa.us.us = phi i32 [ %cost.0119.us.us, %for.body31.us.us ], [ %cost.2.us.us, %for.inc70.us.us ]
%indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 1
%exitcond143.not = icmp eq i64 %indvars.iv.next140, %wide.trip.count154
br i1 %exitcond143.not, label %for.cond27.for.cond.cleanup30_crit_edge.us.us, label %for.body31.us.us, !llvm.loop !15
for.body36.lr.ph.us.us: ; preds = %for.body31.us.us
%arrayidx38.us.us = getelementptr inbounds [50 x %struct.st_nums], ptr %nums, i64 0, i64 %indvars.iv139
%11 = load i32, ptr %arrayidx38.us.us, align 8, !tbaa !11
%sub40.us.us = sub nsw i32 %11, %sub19.us.us
%Y47.us.us = getelementptr inbounds [50 x %struct.st_nums], ptr %nums, i64 0, i64 %indvars.iv139, i32 1
%add56.us.us = add nsw i32 %11, %sub19.us.us
br label %for.body36.us.us
for.cond27.for.cond.cleanup30_crit_edge.us.us: ; preds = %for.cond27.loopexit.us.us
%cond.us.us = call i32 @llvm.smin.i32(i32 %minCost.1123.us.us, i32 %cost.1.lcssa.us.us)
%indvars.iv.next147 = add nuw nsw i64 %indvars.iv146, 1
%exitcond150.not = icmp eq i64 %indvars.iv.next147, %wide.trip.count149
br i1 %exitcond150.not, label %for.cond5.loopexit.us, label %for.body12.us.us, !llvm.loop !16
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x %struct.st_nums], ptr %nums, i64 0, i64 %indvars.iv
%Y = getelementptr inbounds [50 x %struct.st_nums], ptr %nums, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %Y)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%12 = load i32, ptr %N, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp = icmp slt i64 %indvars.iv.next, %13
br i1 %cmp, label %for.body, label %for.cond5.preheader, !llvm.loop !17
for.cond.cleanup7: ; preds = %for.cond5.loopexit.us, %entry, %for.cond5.preheader
%minCost.0.lcssa = phi i32 [ %12, %for.cond5.preheader ], [ %0, %entry ], [ %minCost.1.lcssa.us, %for.cond5.loopexit.us ]
%call83 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %minCost.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %nums) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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"}
!11 = !{!12, !6, i64 0}
!12 = !{!"", !6, i64 0, !6, i64 4}
!13 = !{!12, !6, i64 4}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
int main(void){
char s[100001];
scanf("%s", s);
int len = strlen(s);
int t = 0;
for(int i = 1; i < len; i++){
if(s[i] == s[i-1]){
t = 1;
printf("%d %d\n", i, i + 1);
break;
}
}
if(t == 0){
for(int i = 0; i < len - 2; i++){
if(s[i] == s[i + 2]){
t = 1;
printf("%d %d\n", i+1, i+3);
break;
}
}
}
if(t == 0){
printf("-1 -1\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177000/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177000/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
@str = private unnamed_addr constant [6 x i8] c"-1 -1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100001, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%conv = trunc i64 %call2 to i32
%cmp.not62 = icmp sgt i32 %conv, 1
br i1 %cmp.not62, label %for.body.preheader, label %if.then42
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call2, 4294967295
%.pre = load i8, ptr %s, align 16, !tbaa !5
br label %for.body
for.cond15.preheader: ; preds = %for.inc
%cmp17.not64 = icmp sgt i32 %conv, 2
br i1 %cmp17.not64, label %for.body20.preheader, label %if.then42
for.body20.preheader: ; preds = %for.cond15.preheader
%sub16 = add i64 %call2, 4294967294
%wide.trip.count74 = and i64 %sub16, 4294967295
br label %for.body20
for.body: ; preds = %for.body.preheader, %for.inc
%0 = phi i8 [ %.pre, %for.body.preheader ], [ %1, %for.inc ]
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%arrayidx = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp8 = icmp eq i8 %1, %0
br i1 %cmp8, label %if.then, label %for.inc
if.then: ; preds = %for.body
%2 = trunc i64 %indvars.iv to i32
%add = add nuw nsw i32 %2, 1
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2, i32 noundef %add)
br label %if.end44
for.inc: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond15.preheader, label %for.body, !llvm.loop !8
for.body20: ; preds = %for.body20.preheader, %for.inc35
%indvars.iv70 = phi i64 [ 0, %for.body20.preheader ], [ %indvars.iv.next71, %for.inc35 ]
%arrayidx22 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv70
%3 = load i8, ptr %arrayidx22, align 1, !tbaa !5
%4 = add nuw nsw i64 %indvars.iv70, 2
%arrayidx26 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %4
%5 = load i8, ptr %arrayidx26, align 1, !tbaa !5
%cmp28 = icmp eq i8 %3, %5
br i1 %cmp28, label %if.then30, label %for.inc35
if.then30: ; preds = %for.body20
%6 = trunc i64 %indvars.iv70 to i32
%add31 = add nuw nsw i32 %6, 1
%add32 = add nuw nsw i32 %6, 3
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add31, i32 noundef %add32)
br label %if.end44
for.inc35: ; preds = %for.body20
%indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
%exitcond75.not = icmp eq i64 %indvars.iv.next71, %wide.trip.count74
br i1 %exitcond75.not, label %if.then42, label %for.body20, !llvm.loop !10
if.then42: ; preds = %for.inc35, %entry, %for.cond15.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end44
if.end44: ; preds = %if.then30, %if.then, %if.then42
call void @llvm.lifetime.end.p0(i64 100001, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #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"}
!10 = distinct !{!10, !9}
|
#include <stdio.h>
#include <stdbool.h>
void sort(long n, long s[]);
bool search(long n, long from[], long target);
int main(void)
{
long i;
long n;
scanf("%ld", &n);
long from[n];
for (i = 0; i < n; i++) {
scanf("%ld", &from[i]);
}
sort(n, from);
long q;
scanf("%ld", &q);
long target;
int cnt = 0;
bool exist;
for (i = 0; i < q; i++) {
scanf("%ld", &target);
exist = search(n, from, target);
if (exist == true) {
cnt++;
}
}
printf("%d\n", cnt);
return 0;
}
void sort(long n, long s[])
{
int i, j;
long gap;
int tmp;
for (gap = n / 2; gap > 0; gap /= 2) {
for (i = gap; i < n; i++) {
for (j = i - gap;
j >= 0 && s[j] > s[j + gap];
j -= gap) {
tmp = s[j];
s[j] = s[j + gap];
s[j + gap] = tmp;
}
}
}
}
bool search(long n, long from[], long target)
{
long low, middle, high;
low = 0;
high = n - 1;
while (low <= high){
middle = (low + high) / 2;
if (target < from[middle]) {
high = middle - 1;
} else if (target > from[middle]) {
low = middle + 1;
} else {
return true;
}
}
return false;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177044/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177044/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.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 i64, align 8
%q = alloca i64, align 8
%target = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %0, align 16
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp23 = icmp sgt i64 %2, 0
br i1 %cmp23, label %for.body, label %sort.exit
for.body: ; preds = %entry, %for.body
%i.024 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.024
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.024, 1
%3 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp66.i = icmp sgt i64 %3, 1
br i1 %cmp66.i, label %for.body.i, label %sort.exit
for.body.i: ; preds = %for.end, %for.inc33.i
%gap.067.in.i = phi i64 [ %gap.067.i, %for.inc33.i ], [ %3, %for.end ]
%gap.067.i = lshr i64 %gap.067.in.i, 1
%conv.i = trunc i64 %gap.067.i to i32
%sext68.i = shl i64 %gap.067.i, 32
%conv263.i = ashr exact i64 %sext68.i, 32
%cmp364.i = icmp slt i64 %conv263.i, %3
br i1 %cmp364.i, label %for.cond8.preheader.lr.ph.i, label %for.inc33.i
for.cond8.preheader.lr.ph.i: ; preds = %for.body.i
%4 = getelementptr i64, ptr %vla, i64 %gap.067.i
br label %for.cond8.preheader.i
for.cond8.preheader.i: ; preds = %for.inc31.i, %for.cond8.preheader.lr.ph.i
%indvars.iv.i = phi i64 [ %conv263.i, %for.cond8.preheader.lr.ph.i ], [ %indvars.iv.next.i, %for.inc31.i ]
%5 = trunc i64 %indvars.iv.i to i32
%j.060.i = sub i32 %5, %conv.i
%cmp961.i = icmp sgt i32 %j.060.i, -1
br i1 %cmp961.i, label %land.rhs.i, label %for.inc31.i
land.rhs.i: ; preds = %for.cond8.preheader.i, %for.body15.i
%j.062.i = phi i32 [ %j.0.i, %for.body15.i ], [ %j.060.i, %for.cond8.preheader.i ]
%idxprom.i = zext i32 %j.062.i to i64
%arrayidx.i = getelementptr inbounds i64, ptr %vla, i64 %idxprom.i
%6 = load i64, ptr %arrayidx.i, align 8, !tbaa !5
%arrayidx12.i = getelementptr i64, ptr %4, i64 %idxprom.i
%7 = load i64, ptr %arrayidx12.i, align 8, !tbaa !5
%cmp13.i = icmp sgt i64 %6, %7
br i1 %cmp13.i, label %for.body15.i, label %for.inc31.i
for.body15.i: ; preds = %land.rhs.i
store i64 %7, ptr %arrayidx.i, align 8, !tbaa !5
%sext.i = shl i64 %6, 32
%conv24.i = ashr exact i64 %sext.i, 32
store i64 %conv24.i, ptr %arrayidx12.i, align 8, !tbaa !5
%j.0.i = sub i32 %j.062.i, %conv.i
%cmp9.i = icmp sgt i32 %j.0.i, -1
br i1 %cmp9.i, label %land.rhs.i, label %for.inc31.i, !llvm.loop !11
for.inc31.i: ; preds = %for.body15.i, %land.rhs.i, %for.cond8.preheader.i
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, 1
%exitcond.not = icmp eq i64 %indvars.iv.next.i, %3
br i1 %exitcond.not, label %for.inc33.i, label %for.cond8.preheader.i, !llvm.loop !12
for.inc33.i: ; preds = %for.inc31.i, %for.body.i
%cmp.not.i = icmp ult i64 %gap.067.in.i, 4
br i1 %cmp.not.i, label %sort.exit, label %for.body.i, !llvm.loop !13
sort.exit: ; preds = %for.inc33.i, %entry, %for.end
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %q) #6
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %target) #6
%8 = load i64, ptr %q, align 8, !tbaa !5
%cmp425 = icmp sgt i64 %8, 0
br i1 %cmp425, label %for.body5, label %for.end13
for.body5: ; preds = %sort.exit, %search.exit.thread
%cnt.027 = phi i32 [ %13, %search.exit.thread ], [ 0, %sort.exit ]
%i.126 = phi i64 [ %inc12, %search.exit.thread ], [ 0, %sort.exit ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %target)
%9 = load i64, ptr %n, align 8, !tbaa !5
%10 = load i64, ptr %target, align 8, !tbaa !5
%cmp.not18.i = icmp sgt i64 %9, 0
br i1 %cmp.not18.i, label %while.body.preheader.i, label %search.exit.thread
while.body.preheader.i: ; preds = %for.body5
%sub.i = add nsw i64 %9, -1
br label %while.body.i
while.body.i: ; preds = %if.end8.i, %while.body.preheader.i
%high.020.i = phi i64 [ %high.1.i, %if.end8.i ], [ %sub.i, %while.body.preheader.i ]
%low.019.i = phi i64 [ %low.1.i, %if.end8.i ], [ 0, %while.body.preheader.i ]
%add.i = add nsw i64 %low.019.i, %high.020.i
%div.i = sdiv i64 %add.i, 2
%arrayidx.i20 = getelementptr inbounds i64, ptr %vla, i64 %div.i
%11 = load i64, ptr %arrayidx.i20, align 8, !tbaa !5
%cmp1.i = icmp sgt i64 %11, %10
br i1 %cmp1.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %while.body.i
%sub2.i = add nsw i64 %div.i, -1
br label %if.end8.i
if.else.i: ; preds = %while.body.i
%cmp4.i = icmp slt i64 %11, %10
br i1 %cmp4.i, label %if.then5.i, label %12
if.then5.i: ; preds = %if.else.i
%add6.i = add nsw i64 %div.i, 1
br label %if.end8.i
if.end8.i: ; preds = %if.then5.i, %if.then.i
%low.1.i = phi i64 [ %low.019.i, %if.then.i ], [ %add6.i, %if.then5.i ]
%high.1.i = phi i64 [ %sub2.i, %if.then.i ], [ %high.020.i, %if.then5.i ]
%cmp.not.not.i = icmp sgt i64 %low.1.i, %high.1.i
br i1 %cmp.not.not.i, label %search.exit.thread, label %while.body.i, !llvm.loop !14
12: ; preds = %if.else.i
%inc10 = add nsw i32 %cnt.027, 1
br label %search.exit.thread
search.exit.thread: ; preds = %if.end8.i, %for.body5, %12
%13 = phi i32 [ %inc10, %12 ], [ %cnt.027, %for.body5 ], [ %cnt.027, %if.end8.i ]
%inc12 = add nuw nsw i64 %i.126, 1
%14 = load i64, ptr %q, align 8, !tbaa !5
%cmp4 = icmp slt i64 %inc12, %14
br i1 %cmp4, label %for.body5, label %for.end13, !llvm.loop !15
for.end13: ; preds = %search.exit.thread, %sort.exit
%cnt.0.lcssa = phi i32 [ 0, %sort.exit ], [ %13, %search.exit.thread ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %target) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %q) #6
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, 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 norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @sort(i64 noundef %n, ptr nocapture noundef %s) local_unnamed_addr #4 {
entry:
%cmp66 = icmp sgt i64 %n, 1
br i1 %cmp66, label %for.body, label %for.end35
for.body: ; preds = %entry, %for.inc33
%gap.067.in = phi i64 [ %gap.067, %for.inc33 ], [ %n, %entry ]
%gap.067 = lshr i64 %gap.067.in, 1
%conv = trunc i64 %gap.067 to i32
%sext68 = shl i64 %gap.067, 32
%conv263 = ashr exact i64 %sext68, 32
%cmp364 = icmp slt i64 %conv263, %n
br i1 %cmp364, label %for.cond8.preheader.lr.ph, label %for.inc33
for.cond8.preheader.lr.ph: ; preds = %for.body
%0 = getelementptr i64, ptr %s, i64 %gap.067
br label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.cond8.preheader.lr.ph, %for.inc31
%indvars.iv = phi i64 [ %conv263, %for.cond8.preheader.lr.ph ], [ %indvars.iv.next, %for.inc31 ]
%1 = trunc i64 %indvars.iv to i32
%j.060 = sub i32 %1, %conv
%cmp961 = icmp sgt i32 %j.060, -1
br i1 %cmp961, label %land.rhs, label %for.inc31
land.rhs: ; preds = %for.cond8.preheader, %for.body15
%j.062 = phi i32 [ %j.0, %for.body15 ], [ %j.060, %for.cond8.preheader ]
%idxprom = zext i32 %j.062 to i64
%arrayidx = getelementptr inbounds i64, ptr %s, i64 %idxprom
%2 = load i64, ptr %arrayidx, align 8, !tbaa !5
%arrayidx12 = getelementptr i64, ptr %0, i64 %idxprom
%3 = load i64, ptr %arrayidx12, align 8, !tbaa !5
%cmp13 = icmp sgt i64 %2, %3
br i1 %cmp13, label %for.body15, label %for.inc31
for.body15: ; preds = %land.rhs
store i64 %3, ptr %arrayidx, align 8, !tbaa !5
%sext = shl i64 %2, 32
%conv24 = ashr exact i64 %sext, 32
store i64 %conv24, ptr %arrayidx12, align 8, !tbaa !5
%j.0 = sub i32 %j.062, %conv
%cmp9 = icmp sgt i32 %j.0, -1
br i1 %cmp9, label %land.rhs, label %for.inc31, !llvm.loop !11
for.inc31: ; preds = %for.body15, %land.rhs, %for.cond8.preheader
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%cmp3 = icmp slt i64 %indvars.iv.next, %n
br i1 %cmp3, label %for.cond8.preheader, label %for.inc33, !llvm.loop !12
for.inc33: ; preds = %for.inc31, %for.body
%cmp.not = icmp ult i64 %gap.067.in, 4
br i1 %cmp.not, label %for.end35, label %for.body, !llvm.loop !13
for.end35: ; preds = %for.inc33, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local zeroext i1 @search(i64 noundef %n, ptr nocapture noundef readonly %from, i64 noundef %target) local_unnamed_addr #5 {
entry:
%cmp.not18 = icmp sgt i64 %n, 0
br i1 %cmp.not18, label %while.body.preheader, label %cleanup
while.body.preheader: ; preds = %entry
%sub = add nsw i64 %n, -1
br label %while.body
while.body: ; preds = %while.body.preheader, %if.end8
%high.020 = phi i64 [ %high.1, %if.end8 ], [ %sub, %while.body.preheader ]
%low.019 = phi i64 [ %low.1, %if.end8 ], [ 0, %while.body.preheader ]
%add = add nsw i64 %high.020, %low.019
%div = sdiv i64 %add, 2
%arrayidx = getelementptr inbounds i64, ptr %from, i64 %div
%0 = load i64, ptr %arrayidx, align 8, !tbaa !5
%cmp1 = icmp sgt i64 %0, %target
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %while.body
%sub2 = add nsw i64 %div, -1
br label %if.end8
if.else: ; preds = %while.body
%cmp4 = icmp slt i64 %0, %target
br i1 %cmp4, label %if.then5, label %cleanup
if.then5: ; preds = %if.else
%add6 = add nsw i64 %div, 1
br label %if.end8
if.end8: ; preds = %if.then5, %if.then
%low.1 = phi i64 [ %low.019, %if.then ], [ %add6, %if.then5 ]
%high.1 = phi i64 [ %sub2, %if.then ], [ %high.020, %if.then5 ]
%cmp.not.not = icmp sgt i64 %low.1, %high.1
br i1 %cmp.not.not, label %cleanup, label %while.body, !llvm.loop !14
cleanup: ; preds = %if.else, %if.end8, %entry
%cmp.not.lcssa = phi i1 [ false, %entry ], [ false, %if.end8 ], [ true, %if.else ]
ret i1 %cmp.not.lcssa
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree norecurse nosync nounwind memory(argmem: 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 #5 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!"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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
/*
??????????????????????????¢????????????????????????http://simd.jugem.jp/?eid=114
*/
#include <stdio.h>
#include <stdlib.h>
int countTable[10000001] = { 0 };
int comp(const void *c1, const void *c2)
{
int tmp1 = *(int *)c1;
int tmp2 = *(int *)c2;
if (tmp1 < tmp2) return -1;
if (tmp1 == tmp2) return 0;
if (tmp1 > tmp2) return 1;
}
int main()
{
int i, k, indexS, indexT;
int n, q;
int low, high, mid, target;
int count = 0;
scanf("%d", &n);
int S[n];
for (i = 0; i < n; ++i) {
scanf("%d", &S[i]);
}
scanf("%d", &q);
int T[q];
for (i = 0; i < q; ++i) {
scanf("%d", &T[i]);
}
//?????????????????????
qsort(S, n, sizeof(int), comp);
//????????¢?´¢
for (indexT = 0; indexT < q; ++indexT) {
low = 0;
high = n - 1;
target = T[indexT];
while (1) {
mid = (low + high) / 2;
if (S[mid] == target) {
++countTable[target];
break;
}
else if (S[mid] < target) {
low = mid + 1;
}
else {
high = mid - 1;
}
if (high < low) {
break;
}
}
}
for (i = 0; i < 10000001; ++i)
{
if (countTable[i] != 0)
{
++count;
}
}
printf("%d\n", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177095/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177095/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"
@countTable = dso_local local_unnamed_addr global [10000001 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @comp(ptr nocapture noundef readonly %c1, ptr nocapture noundef readonly %c2) #0 {
entry:
%0 = load i32, ptr %c1, align 4, !tbaa !5
%1 = load i32, ptr %c2, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%spec.select = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %spec.select
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7
%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
%cmp76 = icmp sgt i32 %3, 0
br i1 %cmp76, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%6 = load i32, ptr %q, align 4, !tbaa !5
%7 = zext i32 %6 to i64
%vla3 = alloca i32, i64 %7, align 16
%cmp578 = icmp sgt i32 %6, 0
br i1 %cmp578, label %for.body6, label %for.end12
for.body6: ; preds = %for.end, %for.body6
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.body6 ], [ 0, %for.end ]
%arrayidx8 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv85
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8)
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp5 = icmp slt i64 %indvars.iv.next86, %9
br i1 %cmp5, label %for.body6, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.body6, %for.end
%10 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %10 to i64
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv, i64 noundef 4, ptr noundef nonnull @comp) #7
%11 = load i32, ptr %q, align 4, !tbaa !5
%cmp1480 = icmp sgt i32 %11, 0
br i1 %cmp1480, label %for.body16.lr.ph, label %vector.body.preheader
for.body16.lr.ph: ; preds = %for.end12
%12 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %12, -1
%wide.trip.count = zext i32 %11 to i64
br label %for.body16
vector.body: ; preds = %vector.body, %vector.body.preheader
%index = phi i64 [ 0, %vector.body.preheader ], [ %index.next.1, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.body.preheader ], [ %27, %vector.body ]
%vec.phi95 = phi <4 x i32> [ zeroinitializer, %vector.body.preheader ], [ %28, %vector.body ]
%13 = getelementptr inbounds [10000001 x i32], ptr @countTable, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %13, align 16, !tbaa !5
%14 = getelementptr inbounds i32, ptr %13, i64 4
%wide.load96 = load <4 x i32>, ptr %14, align 16, !tbaa !5
%15 = icmp ne <4 x i32> %wide.load, zeroinitializer
%16 = icmp ne <4 x i32> %wide.load96, zeroinitializer
%17 = zext <4 x i1> %15 to <4 x i32>
%18 = zext <4 x i1> %16 to <4 x i32>
%19 = add <4 x i32> %vec.phi, %17
%20 = add <4 x i32> %vec.phi95, %18
%index.next = or i64 %index, 8
%21 = getelementptr inbounds [10000001 x i32], ptr @countTable, i64 0, i64 %index.next
%wide.load.1 = load <4 x i32>, ptr %21, align 16, !tbaa !5
%22 = getelementptr inbounds i32, ptr %21, i64 4
%wide.load96.1 = load <4 x i32>, ptr %22, align 16, !tbaa !5
%23 = icmp ne <4 x i32> %wide.load.1, zeroinitializer
%24 = icmp ne <4 x i32> %wide.load96.1, zeroinitializer
%25 = zext <4 x i1> %23 to <4 x i32>
%26 = zext <4 x i1> %24 to <4 x i32>
%27 = add <4 x i32> %19, %25
%28 = add <4 x i32> %20, %26
%index.next.1 = add nuw nsw i64 %index, 16
%29 = icmp eq i64 %index.next.1, 10000000
br i1 %29, label %for.body45, label %vector.body, !llvm.loop !12
for.body16: ; preds = %for.body16.lr.ph, %for.inc39
%indvars.iv88 = phi i64 [ 0, %for.body16.lr.ph ], [ %indvars.iv.next89, %for.inc39 ]
%arrayidx18 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv88
%30 = load i32, ptr %arrayidx18, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %if.else, %for.body16
%high.0 = phi i32 [ %sub, %for.body16 ], [ %high.1, %if.else ]
%low.0 = phi i32 [ 0, %for.body16 ], [ %low.1, %if.else ]
%add = add nsw i32 %low.0, %high.0
%div = sdiv i32 %add, 2
%idxprom19 = sext i32 %div to i64
%arrayidx20 = getelementptr inbounds i32, ptr %vla, i64 %idxprom19
%31 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21 = icmp eq i32 %31, %30
br i1 %cmp21, label %if.then, label %if.else
if.then: ; preds = %while.cond
%idxprom23 = sext i32 %30 to i64
%arrayidx24 = getelementptr inbounds [10000001 x i32], ptr @countTable, i64 0, i64 %idxprom23
%32 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%inc25 = add nsw i32 %32, 1
store i32 %inc25, ptr %arrayidx24, align 4, !tbaa !5
br label %for.inc39
if.else: ; preds = %while.cond
%cmp28 = icmp slt i32 %31, %30
%add31 = add nsw i32 %div, 1
%sub33 = add nsw i32 %div, -1
%high.1 = select i1 %cmp28, i32 %high.0, i32 %sub33
%low.1 = select i1 %cmp28, i32 %add31, i32 %low.0
%cmp35 = icmp slt i32 %high.1, %low.1
br i1 %cmp35, label %for.inc39, label %while.cond
for.inc39: ; preds = %if.else, %if.then
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%exitcond.not = icmp eq i64 %indvars.iv.next89, %wide.trip.count
br i1 %exitcond.not, label %vector.body.preheader, label %for.body16, !llvm.loop !15
vector.body.preheader: ; preds = %for.inc39, %for.end12
br label %vector.body
for.body45: ; preds = %vector.body
%bin.rdx = add <4 x i32> %28, %27
%33 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%34 = load i32, ptr getelementptr inbounds ([10000001 x i32], ptr @countTable, i64 0, i64 10000000), align 16, !tbaa !5
%cmp48.not = icmp ne i32 %34, 0
%inc51 = zext i1 %cmp48.not to i32
%spec.select = add nuw nsw i32 %33, %inc51
%call56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #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
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #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 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!"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, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#include <stdlib.h>
const int max = 200000;
int compare_int(const void *a, const void *b)
{
return *(int*)a - *(int*)b;
}
int mybsearch(int array[], int n, int target)
{
int low = 0, high = n-1, mid = 0;
while(low <= high) {
mid = (low + high) / 2;
if(array[mid]==target)
return 1;
else if(array[mid]>target)
high=mid-1;
else
low=mid+1;
}
return 0;
}
int main()
{
int m = 0,n = 0;
int i,j;
int count = 0;
int s[max], t[max];
scanf("%d", &m);
for(i=0;i<m;i++)
scanf("%d", &s[i]);
scanf("%d", &n);
for(j=0;j<n;j++)
scanf("%d", &t[j]);
qsort(s,m,sizeof(int), compare_int);
qsort(t,n,sizeof(int), compare_int);
for(i=0;i<n;i++)
if(mybsearch(s,m,t[i]))
count++;
printf("%d\n", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177138/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177138/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"
@max = dso_local local_unnamed_addr constant i32 200000, align 4
@.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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_int(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @mybsearch(ptr nocapture noundef readonly %array, i32 noundef %n, i32 noundef %target) local_unnamed_addr #1 {
entry:
%cmp.not19 = icmp slt i32 %n, 1
br i1 %cmp.not19, label %cleanup, label %while.body.preheader
while.body.preheader: ; preds = %entry
%sub = add nsw i32 %n, -1
br label %while.body
while.body: ; preds = %while.body.preheader, %if.else
%high.021 = phi i32 [ %high.1, %if.else ], [ %sub, %while.body.preheader ]
%low.020 = phi i32 [ %low.1, %if.else ], [ 0, %while.body.preheader ]
%add = add nsw i32 %high.021, %low.020
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %0, %target
br i1 %cmp1, label %cleanup, label %if.else
if.else: ; preds = %while.body
%cmp4 = icmp sgt i32 %0, %target
%sub6 = add nsw i32 %div, -1
%add8 = add nsw i32 %div, 1
%low.1 = select i1 %cmp4, i32 %low.020, i32 %add8
%high.1 = select i1 %cmp4, i32 %sub6, i32 %high.021
%cmp.not = icmp sgt i32 %low.1, %high.1
br i1 %cmp.not, label %cleanup, label %while.body, !llvm.loop !9
cleanup: ; preds = %while.body, %if.else, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%m = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #7
store i32 0, ptr %m, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
store i32 0, ptr %n, align 4, !tbaa !5
%0 = tail call ptr @llvm.stacksave.p0()
%vla34 = alloca [200000 x i32], align 16
%vla135 = alloca [200000 x i32], align 16
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%1 = load i32, ptr %m, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %1, 0
br i1 %cmp39, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla34, 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
%2 = load i32, ptr %m, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp541 = icmp sgt i32 %4, 0
br i1 %cmp541, label %for.body6, label %for.end12
for.body6: ; preds = %for.end, %for.body6
%indvars.iv48 = phi i64 [ %indvars.iv.next49, %for.body6 ], [ 0, %for.end ]
%arrayidx8 = getelementptr inbounds i32, ptr %vla135, i64 %indvars.iv48
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8)
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp5 = icmp slt i64 %indvars.iv.next49, %6
br i1 %cmp5, label %for.body6, label %for.end12, !llvm.loop !12
for.end12: ; preds = %for.body6, %for.end
%7 = load i32, ptr %m, align 4, !tbaa !5
%conv = sext i32 %7 to i64
call void @qsort(ptr noundef nonnull %vla34, i64 noundef %conv, i64 noundef 4, ptr noundef nonnull @compare_int) #7
%8 = load i32, ptr %n, align 4, !tbaa !5
%conv13 = sext i32 %8 to i64
call void @qsort(ptr noundef nonnull %vla135, i64 noundef %conv13, i64 noundef 4, ptr noundef nonnull @compare_int) #7
%9 = load i32, ptr %n, align 4, !tbaa !5
%cmp1543 = icmp sgt i32 %9, 0
br i1 %cmp1543, label %for.body17.lr.ph, label %for.end24
for.body17.lr.ph: ; preds = %for.end12
%10 = load i32, ptr %m, align 4, !tbaa !5
%cmp.not19.i = icmp slt i32 %10, 1
%sub.i = add nsw i32 %10, -1
br i1 %cmp.not19.i, label %for.end24, label %for.body17.preheader
for.body17.preheader: ; preds = %for.body17.lr.ph
%wide.trip.count = zext i32 %9 to i64
br label %for.body17
for.body17: ; preds = %for.body17.preheader, %for.cond14
%indvars.iv51 = phi i64 [ 0, %for.body17.preheader ], [ %indvars.iv.next52, %for.cond14 ]
%count.045 = phi i32 [ 0, %for.body17.preheader ], [ %13, %for.cond14 ]
%arrayidx19 = getelementptr inbounds i32, ptr %vla135, i64 %indvars.iv51
%11 = load i32, ptr %arrayidx19, align 4, !tbaa !5
br label %while.body.i
while.body.i: ; preds = %if.else.i, %for.body17
%high.021.i = phi i32 [ %high.1.i, %if.else.i ], [ %sub.i, %for.body17 ]
%low.020.i = phi i32 [ %low.1.i, %if.else.i ], [ 0, %for.body17 ]
%add.i = add nsw i32 %low.020.i, %high.021.i
%div.i = sdiv i32 %add.i, 2
%idxprom.i = sext i32 %div.i to i64
%arrayidx.i = getelementptr inbounds i32, ptr %vla34, i64 %idxprom.i
%12 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp eq i32 %12, %11
br i1 %cmp1.i, label %mybsearch.exit, label %if.else.i
if.else.i: ; preds = %while.body.i
%cmp4.i = icmp sgt i32 %12, %11
%sub6.i = add nsw i32 %div.i, -1
%add8.i = add nsw i32 %div.i, 1
%low.1.i = select i1 %cmp4.i, i32 %low.020.i, i32 %add8.i
%high.1.i = select i1 %cmp4.i, i32 %sub6.i, i32 %high.021.i
%cmp.not.i = icmp sgt i32 %low.1.i, %high.1.i
br i1 %cmp.not.i, label %for.cond14, label %while.body.i, !llvm.loop !9
mybsearch.exit: ; preds = %while.body.i
%inc21 = add nsw i32 %count.045, 1
br label %for.cond14
for.cond14: ; preds = %if.else.i, %mybsearch.exit
%13 = phi i32 [ %inc21, %mybsearch.exit ], [ %count.045, %if.else.i ]
%indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
%exitcond.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count
br i1 %exitcond.not, label %for.end24, label %for.body17, !llvm.loop !13
for.end24: ; preds = %for.cond14, %for.body17.lr.ph, %for.end12
%count.0.lcssa = phi i32 [ 0, %for.end12 ], [ 0, %for.body17.lr.ph ], [ %13, %for.cond14 ]
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
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 norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <stdlib.h>
int qq(const void *a, const void *b)
{
return *(int*)a - *(int*)b;
}
int main()
{
int i,j;
int count=0;
int n,q;
int n1[100001]={0},q1[50001]={0};
scanf("%d",&n);
for(i=0; i<n; i++){
scanf("%d",&n1[i]);
}
qsort(n1,n,sizeof(int),qq);
scanf("%d",&q);
for(i=0; i<q; i++){
scanf("%d",&q1[i]);
}
qsort(q1,q,sizeof(int),qq);
i=0;
j=0;
while (i < n && j < q){
if (n1[i] == q1[j]){
count++;
i++;
j++;
}
else if (n1[i] < q1[j]){
i++;
}
else if (n1[i] > q1[j]){
j++;
}
}
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177202/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177202/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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @qq(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%n1 = alloca [100001 x i32], align 16
%q1 = alloca [50001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #6
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %n1) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400004) %n1, i8 0, i64 400004, i1 false)
call void @llvm.lifetime.start.p0(i64 200004, ptr nonnull %q1) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(200004) %q1, i8 0, i64 200004, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp69 = icmp sgt i32 %0, 0
br i1 %cmp69, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100001 x i32], ptr %n1, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %2, %for.body ]
call void @qsort(ptr noundef nonnull %n1, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @qq) #6
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp471 = icmp sgt i32 %3, 0
br i1 %cmp471, label %for.body6, label %for.end.for.end12_crit_edge
for.end.for.end12_crit_edge: ; preds = %for.end
%.pre86 = sext i32 %3 to i64
br label %for.end12
for.body6: ; preds = %for.end, %for.body6
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.body6 ], [ 0, %for.end ]
%arrayidx8 = getelementptr inbounds [50001 x i32], ptr %q1, i64 0, i64 %indvars.iv83
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8)
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%4 = load i32, ptr %q, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp4 = icmp slt i64 %indvars.iv.next84, %5
br i1 %cmp4, label %for.body6, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.body6, %for.end.for.end12_crit_edge
%conv14.pre-phi = phi i64 [ %.pre86, %for.end.for.end12_crit_edge ], [ %5, %for.body6 ]
call void @qsort(ptr noundef nonnull %q1, i64 noundef %conv14.pre-phi, i64 noundef 4, ptr noundef nonnull @qq) #6
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = load i32, ptr %q, align 4
%cmp1574 = icmp sgt i32 %6, 0
%cmp1775 = icmp sgt i32 %7, 0
%8 = select i1 %cmp1574, i1 %cmp1775, i1 false
br i1 %8, label %while.body, label %while.end
while.body: ; preds = %for.end12, %if.end46
%count.078 = phi i32 [ %count.1, %if.end46 ], [ 0, %for.end12 ]
%j.077 = phi i32 [ %j.1, %if.end46 ], [ 0, %for.end12 ]
%i.276 = phi i32 [ %i.3, %if.end46 ], [ 0, %for.end12 ]
%idxprom19 = sext i32 %i.276 to i64
%arrayidx20 = getelementptr inbounds [100001 x i32], ptr %n1, i64 0, i64 %idxprom19
%9 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%idxprom21 = sext i32 %j.077 to i64
%arrayidx22 = getelementptr inbounds [50001 x i32], ptr %q1, i64 0, i64 %idxprom21
%10 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp eq i32 %9, %10
br i1 %cmp23, label %if.then, label %if.else
if.then: ; preds = %while.body
%inc25 = add nsw i32 %count.078, 1
%inc26 = add nsw i32 %i.276, 1
%inc27 = add nsw i32 %j.077, 1
br label %if.end46
if.else: ; preds = %while.body
%cmp32 = icmp slt i32 %9, %10
br i1 %cmp32, label %if.then34, label %if.else36
if.then34: ; preds = %if.else
%inc35 = add nsw i32 %i.276, 1
br label %if.end46
if.else36: ; preds = %if.else
%cmp41 = icmp sgt i32 %9, %10
%inc44 = zext i1 %cmp41 to i32
%spec.select = add nsw i32 %j.077, %inc44
br label %if.end46
if.end46: ; preds = %if.else36, %if.then34, %if.then
%i.3 = phi i32 [ %inc26, %if.then ], [ %inc35, %if.then34 ], [ %i.276, %if.else36 ]
%j.1 = phi i32 [ %inc27, %if.then ], [ %j.077, %if.then34 ], [ %spec.select, %if.else36 ]
%count.1 = phi i32 [ %inc25, %if.then ], [ %count.078, %if.then34 ], [ %count.078, %if.else36 ]
%cmp15 = icmp slt i32 %i.3, %6
%cmp17 = icmp slt i32 %j.1, %7
%11 = select i1 %cmp15, i1 %cmp17, i1 false
br i1 %11, label %while.body, label %while.end, !llvm.loop !12
while.end: ; preds = %if.end46, %for.end12
%count.0.lcssa = phi i32 [ 0, %for.end12 ], [ %count.1, %if.end46 ]
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 200004, ptr nonnull %q1) #6
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %n1) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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) #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; 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) #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = distinct !{!12, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
int main(){
int n,k,r,s,p;
scanf("%d %d",&n,&k);
scanf("%d %d %d",&r,&s,&p);
char t[n];
scanf("%s",t);
char s1[k][n/k+1];
for(int i=0;i<n;i++){
s1[i%k][i/k]=t[i];
//printf("%d %d %d %c\n",i%k,i/k,i,t[i]);
}
int sum=0;
int l;
for(int i=0;i<k;i++){
if(n%k>i){
l=n/k+1;
}
else{
l=n/k;
}
for(int j=0;j<l;j++){
//printf("1:%c %d,",s1[i][j],sum);
//printf("%c\n",s1[i][j]);
if(j==0 || s1[i][j]!=s1[i][j-1]){
if(s1[i][j]=='r'){
sum+=p;
}
else if(s1[i][j]=='s'){
sum+=r;
}
else{
sum+=s;
}
}
else{
s1[i][j]='k';
}
//printf("2:%c %d %d %d\n",s1[i][j],sum,i,j);
}
}
printf("%d\n",sum);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177253/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177253/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 [9 x i8] c"%d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%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
%k = alloca i32, align 4
%r = alloca i32, align 4
%s = alloca i32, align 4
%p = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %r, ptr noundef nonnull %s, ptr noundef nonnull %p)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i8, i64 %1, align 16
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %vla)
%3 = load i32, ptr %k, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%5 = load i32, ptr %n, align 4, !tbaa !5
%div = sdiv i32 %5, %3
%rem14 = srem i32 %5, %3
%add = add nsw i32 %div, 1
%6 = zext i32 %add to i64
%7 = mul nuw i64 %6, %4
%vla3 = alloca i8, i64 %7, align 16
%cmp93 = icmp sgt i32 %5, 0
br i1 %cmp93, label %for.body.preheader, label %for.cond10.preheader
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %5 to i64
br label %for.body
for.cond10.preheader: ; preds = %for.body, %entry
%cmp1198 = icmp sgt i32 %3, 0
br i1 %cmp1198, label %for.body13.lr.ph, label %for.cond.cleanup12
for.body13.lr.ph: ; preds = %for.cond10.preheader
%8 = load i32, ptr %r, align 4
%9 = load i32, ptr %p, align 4
%10 = load i32, ptr %s, align 4
%11 = sext i32 %rem14 to i64
br label %for.body13
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv
%12 = load i8, ptr %arrayidx, align 1, !tbaa !9
%13 = trunc i64 %indvars.iv to i32
%rem = srem i32 %13, %3
%idxprom4 = zext i32 %rem to i64
%14 = mul nuw nsw i64 %idxprom4, %6
%arrayidx5 = getelementptr inbounds i8, ptr %vla3, i64 %14
%div6 = sdiv i32 %13, %3
%idxprom7 = sext i32 %div6 to i64
%arrayidx8 = getelementptr inbounds i8, ptr %arrayidx5, i64 %idxprom7
store i8 %12, ptr %arrayidx8, align 1, !tbaa !9
%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.cond10.preheader, label %for.body, !llvm.loop !10
for.cond.cleanup12: ; preds = %for.cond.cleanup21, %for.cond10.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond10.preheader ], [ %sum.1.lcssa, %for.cond.cleanup21 ]
%call71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %sum.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body13: ; preds = %for.body13.lr.ph, %for.cond.cleanup21
%indvars.iv110 = phi i64 [ 0, %for.body13.lr.ph ], [ %indvars.iv.next111, %for.cond.cleanup21 ]
%sum.099 = phi i32 [ 0, %for.body13.lr.ph ], [ %sum.1.lcssa, %for.cond.cleanup21 ]
%cmp15 = icmp slt i64 %indvars.iv110, %11
%spec.select = select i1 %cmp15, i32 %add, i32 %div
%cmp2095 = icmp sgt i32 %spec.select, 0
br i1 %cmp2095, label %if.then35.peel, label %for.cond.cleanup21
if.then35.peel: ; preds = %for.body13
%15 = mul nuw nsw i64 %indvars.iv110, %6
%arrayidx25 = getelementptr inbounds i8, ptr %vla3, i64 %15
%wide.trip.count107 = zext i32 %spec.select to i64
%.pre = load i8, ptr %arrayidx25, align 1, !tbaa !9
switch i8 %.pre, label %if.else55.peel [
i8 114, label %if.then43.peel
i8 115, label %for.inc65.peel
]
if.then43.peel: ; preds = %if.then35.peel
br label %for.inc65.peel
if.else55.peel: ; preds = %if.then35.peel
br label %for.inc65.peel
for.inc65.peel: ; preds = %if.then35.peel, %if.else55.peel, %if.then43.peel
%.pn = phi i32 [ %9, %if.then43.peel ], [ %10, %if.else55.peel ], [ %8, %if.then35.peel ]
%sum.2.peel = add nsw i32 %.pn, %sum.099
%exitcond108.peel.not = icmp eq i32 %spec.select, 1
br i1 %exitcond108.peel.not, label %for.cond.cleanup21, label %for.body22.peel.next
for.body22.peel.next: ; preds = %for.inc65.peel
%invariant.gep = getelementptr i8, ptr %arrayidx25, i64 -1
br label %lor.lhs.false
for.cond.cleanup21: ; preds = %for.inc65, %for.inc65.peel, %for.body13
%sum.1.lcssa = phi i32 [ %sum.099, %for.body13 ], [ %sum.2.peel, %for.inc65.peel ], [ %sum.2, %for.inc65 ]
%indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
%exitcond114.not = icmp eq i64 %indvars.iv.next111, %4
br i1 %exitcond114.not, label %for.cond.cleanup12, label %for.body13, !llvm.loop !12
lor.lhs.false: ; preds = %for.inc65, %for.body22.peel.next
%indvars.iv103 = phi i64 [ 1, %for.body22.peel.next ], [ %indvars.iv.next104, %for.inc65 ]
%sum.196 = phi i32 [ %sum.2.peel, %for.body22.peel.next ], [ %sum.2, %for.inc65 ]
%arrayidx27 = getelementptr inbounds i8, ptr %arrayidx25, i64 %indvars.iv103
%16 = load i8, ptr %arrayidx27, align 1, !tbaa !9
%gep = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv103
%17 = load i8, ptr %gep, align 1, !tbaa !9
%cmp33.not = icmp eq i8 %16, %17
br i1 %cmp33.not, label %if.else59, label %if.then35
if.then35: ; preds = %lor.lhs.false
switch i8 %16, label %if.else55 [
i8 114, label %if.then43
i8 115, label %if.then53
]
if.then43: ; preds = %if.then35
%add44 = add nsw i32 %9, %sum.196
br label %for.inc65
if.then53: ; preds = %if.then35
%add54 = add nsw i32 %8, %sum.196
br label %for.inc65
if.else55: ; preds = %if.then35
%add56 = add nsw i32 %10, %sum.196
br label %for.inc65
if.else59: ; preds = %lor.lhs.false
store i8 107, ptr %arrayidx27, align 1, !tbaa !9
br label %for.inc65
for.inc65: ; preds = %if.else59, %if.then53, %if.else55, %if.then43
%sum.2 = phi i32 [ %add44, %if.then43 ], [ %add54, %if.then53 ], [ %add56, %if.else55 ], [ %sum.196, %if.else59 ]
%indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
%exitcond108.not = icmp eq i64 %indvars.iv.next104, %wide.trip.count107
br i1 %exitcond108.not, label %for.cond.cleanup21, label %lor.lhs.false, !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
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11, !14}
!14 = !{!"llvm.loop.peeled.count", i32 1}
|
/* Coached by Dukkha */
#include <stdio.h>
#include <stdlib.h>
#define N 100
int aa[N], bb[N], cc[N], dd[N];
int compare_i(const void *a, const void *b) {
int i = *(int *) a;
int j = *(int *) b;
return aa[j] - aa[i];
}
int compare_j(const void *a, const void *b) {
int i = *(int *) a;
int j = *(int *) b;
return dd[i] - dd[j];
}
int main() {
static char used[N];
static int ii[N], jj[N];
int n, i, j, cnt;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d%d", &aa[i], &bb[i]);
ii[i] = i;
}
for (j = 0; j < n; j++) {
scanf("%d%d", &cc[j], &dd[j]);
jj[j] = j;
}
qsort(ii, n, sizeof *ii, compare_i);
qsort(jj, n, sizeof *jj, compare_j);
cnt = 0;
for (j = 0; j < n; j++) {
int j_ = jj[j], c = cc[j_], d = dd[j_];
for (i = 0; i < n; i++) {
int i_ = ii[i], a = aa[i_], b = bb[i_];
if (!used[i_] && a < c && b < d) {
used[i_] = 1;
cnt++;
break;
}
}
}
printf("%d\n", cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177310/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177310/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"
@aa = dso_local global [100 x i32] zeroinitializer, align 16
@dd = dso_local global [100 x i32] zeroinitializer, align 16
@main.used = internal unnamed_addr global [100 x i8] zeroinitializer, align 16
@main.ii = internal global [100 x i32] zeroinitializer, align 16
@main.jj = internal global [100 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@bb = dso_local global [100 x i32] zeroinitializer, align 16
@cc = dso_local global [100 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @compare_i(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @aa, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom1 = sext i32 %0 to i64
%arrayidx2 = getelementptr inbounds [100 x i32], ptr @aa, i64 0, i64 %idxprom1
%3 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%sub = sub nsw i32 %2, %3
ret i32 %sub
}
; 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 norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @compare_j(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @dd, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom1 = sext i32 %1 to i64
%arrayidx2 = getelementptr inbounds [100 x i32], ptr @dd, i64 0, i64 %idxprom1
%3 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%sub = sub nsw i32 %2, %3
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
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
%cmp88 = icmp sgt i32 %0, 0
br i1 %cmp88, label %for.body, label %for.cond6.preheader.for.end18_crit_edge
for.cond6.preheader: ; preds = %for.body
%cmp790 = icmp sgt i32 %3, 0
br i1 %cmp790, label %for.body8, label %for.cond6.preheader.for.end18_crit_edge
for.cond6.preheader.for.end18_crit_edge: ; preds = %entry, %for.cond6.preheader
%1 = phi i32 [ %3, %for.cond6.preheader ], [ %0, %entry ]
%.pre = sext i32 %1 to i64
br label %for.end18
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr @aa, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [100 x i32], ptr @bb, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%arrayidx5 = getelementptr inbounds [100 x i32], ptr @main.ii, i64 0, i64 %indvars.iv
%2 = trunc i64 %indvars.iv to i32
store i32 %2, ptr %arrayidx5, align 4, !tbaa !5
%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.cond6.preheader, !llvm.loop !9
for.body8: ; preds = %for.cond6.preheader, %for.body8
%indvars.iv101 = phi i64 [ %indvars.iv.next102, %for.body8 ], [ 0, %for.cond6.preheader ]
%arrayidx10 = getelementptr inbounds [100 x i32], ptr @cc, i64 0, i64 %indvars.iv101
%arrayidx12 = getelementptr inbounds [100 x i32], ptr @dd, i64 0, i64 %indvars.iv101
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx10, ptr noundef nonnull %arrayidx12)
%arrayidx15 = getelementptr inbounds [100 x i32], ptr @main.jj, i64 0, i64 %indvars.iv101
%5 = trunc i64 %indvars.iv101 to i32
store i32 %5, ptr %arrayidx15, align 4, !tbaa !5
%indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp7 = icmp slt i64 %indvars.iv.next102, %7
br i1 %cmp7, label %for.body8, label %for.end18, !llvm.loop !11
for.end18: ; preds = %for.body8, %for.cond6.preheader.for.end18_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %for.cond6.preheader.for.end18_crit_edge ], [ %7, %for.body8 ]
call void @qsort(ptr noundef nonnull @main.ii, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @compare_i) #5
%8 = load i32, ptr %n, align 4, !tbaa !5
%conv19 = sext i32 %8 to i64
call void @qsort(ptr noundef nonnull @main.jj, i64 noundef %conv19, i64 noundef 4, ptr noundef nonnull @compare_j) #5
%9 = load i32, ptr %n, align 4, !tbaa !5
%cmp2194 = icmp sgt i32 %9, 0
br i1 %cmp2194, label %for.body23.us.preheader, label %for.end57
for.body23.us.preheader: ; preds = %for.end18
%wide.trip.count110 = zext i32 %9 to i64
br label %for.body23.us
for.body23.us: ; preds = %for.body23.us.preheader, %for.end54.us
%indvars.iv107 = phi i64 [ 0, %for.body23.us.preheader ], [ %indvars.iv.next108, %for.end54.us ]
%cnt.095.us = phi i32 [ 0, %for.body23.us.preheader ], [ %cnt.3.us, %for.end54.us ]
%arrayidx25.us = getelementptr inbounds [100 x i32], ptr @main.jj, i64 0, i64 %indvars.iv107
%10 = load i32, ptr %arrayidx25.us, align 4, !tbaa !5
%idxprom26.us = sext i32 %10 to i64
%arrayidx27.us = getelementptr inbounds [100 x i32], ptr @cc, i64 0, i64 %idxprom26.us
%11 = load i32, ptr %arrayidx27.us, align 4, !tbaa !5
%arrayidx29.us = getelementptr inbounds [100 x i32], ptr @dd, i64 0, i64 %idxprom26.us
%12 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
br label %for.body33.us
for.body33.us: ; preds = %for.body23.us, %for.inc52.us
%indvars.iv104 = phi i64 [ 0, %for.body23.us ], [ %indvars.iv.next105, %for.inc52.us ]
%arrayidx35.us = getelementptr inbounds [100 x i32], ptr @main.ii, i64 0, i64 %indvars.iv104
%13 = load i32, ptr %arrayidx35.us, align 4, !tbaa !5
%idxprom36.us = sext i32 %13 to i64
%arrayidx41.us = getelementptr inbounds [100 x i8], ptr @main.used, i64 0, i64 %idxprom36.us
%14 = load i8, ptr %arrayidx41.us, align 1, !tbaa !12
%tobool.not.us = icmp eq i8 %14, 0
br i1 %tobool.not.us, label %land.lhs.true.us, label %for.inc52.us
land.lhs.true.us: ; preds = %for.body33.us
%arrayidx39.us = getelementptr inbounds [100 x i32], ptr @bb, i64 0, i64 %idxprom36.us
%15 = load i32, ptr %arrayidx39.us, align 4, !tbaa !5
%arrayidx37.us = getelementptr inbounds [100 x i32], ptr @aa, i64 0, i64 %idxprom36.us
%16 = load i32, ptr %arrayidx37.us, align 4, !tbaa !5
%cmp42.us = icmp slt i32 %16, %11
%cmp45.us = icmp slt i32 %15, %12
%or.cond.us = select i1 %cmp42.us, i1 %cmp45.us, i1 false
br i1 %or.cond.us, label %cleanup.us, label %for.inc52.us
for.inc52.us: ; preds = %land.lhs.true.us, %for.body33.us
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%exitcond.not = icmp eq i64 %indvars.iv.next105, %wide.trip.count110
br i1 %exitcond.not, label %for.end54.us, label %for.body33.us, !llvm.loop !13
cleanup.us: ; preds = %land.lhs.true.us
%arrayidx41.us.le = getelementptr inbounds [100 x i8], ptr @main.used, i64 0, i64 %idxprom36.us
store i8 1, ptr %arrayidx41.us.le, align 1, !tbaa !12
%inc49.us = add nsw i32 %cnt.095.us, 1
br label %for.end54.us
for.end54.us: ; preds = %for.inc52.us, %cleanup.us
%cnt.3.us = phi i32 [ %inc49.us, %cleanup.us ], [ %cnt.095.us, %for.inc52.us ]
%indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
%exitcond111.not = icmp eq i64 %indvars.iv.next108, %wide.trip.count110
br i1 %exitcond111.not, label %for.end57, label %for.body23.us, !llvm.loop !14
for.end57: ; preds = %for.end54.us, %for.end18
%cnt.0.lcssa = phi i32 [ 0, %for.end18 ], [ %cnt.3.us, %for.end54.us ]
%call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#define min(x,y) ((x) < (y) ? (x) : (y))
int main(){
int ch,a,b,c,d,e,f,g;
a=b=c=d=0;
while((ch=getchar())!=EOF){
switch(ch){
case 'K':a++;
break;
case 'U':b++;
break;
case 'P':c++;
break;
case 'C':d++;
break;
default:
break;
}
}
e=min(a,b);
f=min(c,d);
g=min(e,f);
printf("%d\n",g);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177361/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177361/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
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
br label %while.cond.outer
while.cond.outer: ; preds = %sw.bb5, %entry
%d.0.ph = phi i32 [ %inc6, %sw.bb5 ], [ 0, %entry ]
%c.0.ph = phi i32 [ %c.0.ph30, %sw.bb5 ], [ 0, %entry ]
%b.0.ph = phi i32 [ %b.0.ph34, %sw.bb5 ], [ 0, %entry ]
%a.0.ph = phi i32 [ %a.0.ph37, %sw.bb5 ], [ 0, %entry ]
br label %while.cond.outer29
while.cond.outer29: ; preds = %while.cond.outer, %sw.bb3
%c.0.ph30 = phi i32 [ %c.0.ph, %while.cond.outer ], [ %inc4, %sw.bb3 ]
%b.0.ph31 = phi i32 [ %b.0.ph, %while.cond.outer ], [ %b.0.ph34, %sw.bb3 ]
%a.0.ph32 = phi i32 [ %a.0.ph, %while.cond.outer ], [ %a.0.ph37, %sw.bb3 ]
br label %while.cond.outer33
while.cond.outer33: ; preds = %while.cond.outer29, %sw.bb1
%b.0.ph34 = phi i32 [ %b.0.ph31, %while.cond.outer29 ], [ %inc2, %sw.bb1 ]
%a.0.ph35 = phi i32 [ %a.0.ph32, %while.cond.outer29 ], [ %a.0.ph37, %sw.bb1 ]
br label %while.cond.outer36
while.cond.outer36: ; preds = %while.cond.outer33, %sw.bb
%a.0.ph37 = phi i32 [ %a.0.ph35, %while.cond.outer33 ], [ %inc, %sw.bb ]
br label %while.cond
while.cond: ; preds = %while.cond.outer36, %while.cond
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = tail call i32 @getc(ptr noundef %0)
switch i32 %call.i, label %while.cond [
i32 -1, label %while.end
i32 75, label %sw.bb
i32 85, label %sw.bb1
i32 80, label %sw.bb3
i32 67, label %sw.bb5
], !llvm.loop !9
sw.bb: ; preds = %while.cond
%inc = add nsw i32 %a.0.ph37, 1
br label %while.cond.outer36, !llvm.loop !9
sw.bb1: ; preds = %while.cond
%inc2 = add nsw i32 %b.0.ph34, 1
br label %while.cond.outer33, !llvm.loop !9
sw.bb3: ; preds = %while.cond
%inc4 = add nsw i32 %c.0.ph30, 1
br label %while.cond.outer29, !llvm.loop !9
sw.bb5: ; preds = %while.cond
%inc6 = add nuw nsw i32 %d.0.ph, 1
br label %while.cond.outer, !llvm.loop !9
while.end: ; preds = %while.cond
%cond = tail call i32 @llvm.smin.i32(i32 %a.0.ph37, i32 %b.0.ph34)
%cond12 = tail call i32 @llvm.smin.i32(i32 %c.0.ph30, i32 %d.0.ph)
%cond17 = tail call i32 @llvm.smin.i32(i32 %cond, i32 %cond12)
%call18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %cond17)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int a,b;
scanf("%d%d", &a, &b);
if(a > 0){
puts("Positive");
}else if(b >= 0){
puts("Zero");
}else if((b-a)%2==0){
puts("Negative");
}else{
puts("Positive");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177404/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177404/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 [9 x i8] c"Positive\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"Zero\00", align 1
@.str.3 = private unnamed_addr constant [9 x i8] c"Negative\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 0
br i1 %cmp, label %if.end12, label %if.else
if.else: ; preds = %entry
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp2 = icmp sgt i32 %1, -1
br i1 %cmp2, label %if.end12, label %if.else5
if.else5: ; preds = %if.else
%sub = sub nsw i32 %1, %0
%2 = and i32 %sub, 1
%cmp6 = icmp eq i32 %2, 0
%.str.3..str.1 = select i1 %cmp6, ptr @.str.3, ptr @.str.1
br label %if.end12
if.end12: ; preds = %if.else5, %if.else, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.2, %if.else ], [ %.str.3..str.1, %if.else5 ]
%call4 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int a,b,n;
scanf("%d %d",&a,&b);
if(a>0)puts("Positive");
else if(a<=0&&b>=0)puts("Zero");
else{
n=b-a+1;
if(n%2)puts("Negative");
else puts("Positive");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177448/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177448/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 [9 x i8] c"Positive\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"Zero\00", align 1
@.str.3 = private unnamed_addr constant [9 x i8] c"Negative\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 0
br i1 %cmp, label %if.end12, label %if.else
if.else: ; preds = %entry
%1 = load i32, ptr %b, align 4
%cmp3 = icmp sgt i32 %1, -1
br i1 %cmp3, label %if.end12, label %if.else6
if.else6: ; preds = %if.else
%sub = sub nsw i32 %1, %0
%2 = and i32 %sub, 1
%tobool.not.not = icmp eq i32 %2, 0
%.str.3..str.1 = select i1 %tobool.not.not, ptr @.str.3, ptr @.str.1
br label %if.end12
if.end12: ; preds = %if.else6, %if.else, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.2, %if.else ], [ %.str.3..str.1, %if.else6 ]
%call5 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(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;
while( scanf("%d %d", &a, &b) != EOF ){
printf("%d\n", a + b);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177491/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177491/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not3 = icmp eq i32 %call2, -1
br i1 %cmp.not3, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int a, b;
while( scanf("%d %d", &a, &b) != EOF ){
printf("%d\n", a + b);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177534/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177534/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not3 = icmp eq i32 %call2, -1
br i1 %cmp.not3, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int a, b;
while( scanf("%d %d", &a, &b) != EOF ){
printf("%d\n", a + b);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177578/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177578/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not3 = icmp eq i32 %call2, -1
br i1 %cmp.not3, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int A,B;
while(1){
scanf("%d %d",&A,&B);
if(feof(stdin))break;
printf("%d\n",A+B);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177620/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177620/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
@stdin = external local_unnamed_addr global ptr, align 8
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call14 = call i32 @feof(ptr noundef %0) #3
%tobool.not5 = icmp eq i32 %call14, 0
br i1 %tobool.not5, label %if.end, label %while.end
if.end: ; preds = %entry, %if.end
%1 = load i32, ptr %A, align 4, !tbaa !9
%2 = load i32, ptr %B, align 4, !tbaa !9
%add = add nsw i32 %2, %1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%3 = load ptr, ptr @stdin, align 8, !tbaa !5
%call1 = call i32 @feof(ptr noundef %3) #3
%tobool.not = icmp eq i32 %call1, 0
br i1 %tobool.not, label %if.end, label %while.end
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @feof(ptr nocapture noundef) 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 = !{!"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(){
int a, b;
while(scanf("%d %d",&a,&b) != EOF){
printf("%d\n",a + b);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177686/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177686/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not3 = icmp eq i32 %call2, -1
br i1 %cmp.not3, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int a, b;
while( scanf("%d %d", &a, &b) != EOF ){
printf("%d\n", a + b);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177736/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177736/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not3 = icmp eq i32 %call2, -1
br i1 %cmp.not3, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main ()
{
int a, b;
while (scanf("%d %d", &a, &b) == 2)
printf ("%d\n", a + b);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177787/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177787/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp3 = icmp eq i32 %call2, 2
br i1 %cmp3, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp = icmp eq i32 %call, 2
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int a, b;
while( scanf("%d %d", &a, &b) != EOF ){
printf("%d\n", a + b);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177837/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177837/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not3 = icmp eq i32 %call2, -1
br i1 %cmp.not3, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
int main(void) {
int h, w;
scanf("%d %d", &h, &w);
char s[101];
char a[h][101];
for (int i = 0; i < h; i++) {
scanf("%s", s);
strcpy(a[i], s);
}
for (int i = 0; i < w + 2; i++) {
printf("%c", '#');
}
printf("\n");
for (int j = 0; j < h; j++) {
printf("#%s#\n", a[j]);
}
for (int i = 0; i < w + 2; i++) {
printf("%c", '#');
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177880/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177880/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.4 = private unnamed_addr constant [6 x i8] c"#%s#\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%s = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %s) #6
%0 = load i32, ptr %h, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca [101 x i8], i64 %1, align 16
%3 = load i32, ptr %h, align 4, !tbaa !5
%cmp44 = icmp sgt i32 %3, 0
br i1 %cmp44, label %for.body, label %for.cond6.preheader
for.cond6.preheader: ; preds = %for.body, %entry
%4 = load i32, ptr %w, align 4, !tbaa !5
%cmp747 = icmp sgt i32 %4, -2
br i1 %cmp747, label %for.body9, label %for.cond.cleanup8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%arrayidx = getelementptr inbounds [101 x i8], ptr %vla, i64 %indvars.iv
%call4 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %s) #6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %h, 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.cond6.preheader, !llvm.loop !9
for.cond.cleanup8: ; preds = %for.body9, %for.cond6.preheader
%putchar = call i32 @putchar(i32 10)
%7 = load i32, ptr %h, align 4, !tbaa !5
%cmp1649 = icmp sgt i32 %7, 0
br i1 %cmp1649, label %for.body18, label %for.cond27.preheader
for.body9: ; preds = %for.cond6.preheader, %for.body9
%i5.048 = phi i32 [ %inc12, %for.body9 ], [ 0, %for.cond6.preheader ]
%putchar43 = call i32 @putchar(i32 35)
%inc12 = add nuw nsw i32 %i5.048, 1
%8 = load i32, ptr %w, align 4, !tbaa !5
%cmp7.not = icmp sgt i32 %i5.048, %8
br i1 %cmp7.not, label %for.cond.cleanup8, label %for.body9, !llvm.loop !11
for.cond27.preheader: ; preds = %for.body18, %for.cond.cleanup8
%9 = load i32, ptr %w, align 4, !tbaa !5
%cmp2952 = icmp sgt i32 %9, -2
br i1 %cmp2952, label %for.body31, label %for.cond.cleanup30
for.body18: ; preds = %for.cond.cleanup8, %for.body18
%indvars.iv55 = phi i64 [ %indvars.iv.next56, %for.body18 ], [ 0, %for.cond.cleanup8 ]
%arrayidx20 = getelementptr inbounds [101 x i8], ptr %vla, i64 %indvars.iv55
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef nonnull %arrayidx20)
%indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
%10 = load i32, ptr %h, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp16 = icmp slt i64 %indvars.iv.next56, %11
br i1 %cmp16, label %for.body18, label %for.cond27.preheader, !llvm.loop !12
for.cond.cleanup30: ; preds = %for.body31, %for.cond27.preheader
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %s) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #6
ret i32 0
for.body31: ; preds = %for.cond27.preheader, %for.body31
%i26.053 = phi i32 [ %inc34, %for.body31 ], [ 0, %for.cond27.preheader ]
%putchar42 = call i32 @putchar(i32 35)
%inc34 = add nuw nsw i32 %i26.053, 1
%12 = load i32, ptr %w, align 4, !tbaa !5
%cmp29.not = icmp sgt i32 %i26.053, %12
br i1 %cmp29.not, label %for.cond.cleanup30, label %for.body31, !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
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias 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
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @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 = { 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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main(){
int a, b, i, j;
char s[100][101];
scanf("%d %d", &a, &b);
for(i = 0; i < a; ++i){
scanf("%s", s[i]);
}
for(i = 0; i < b + 2; ++i) printf("#");
puts("");
for(i = 0; i < a; ++i) printf("#%s#\n", s[i]);
for(i = 0; i < b + 2; ++i) printf("#");
puts("");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177930/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177930/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.4 = private unnamed_addr constant [6 x i8] c"#%s#\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
%s = alloca [100 x [101 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 10100, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp41 = icmp sgt i32 %0, 0
br i1 %cmp41, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp344 = icmp sgt i32 %1, -2
br i1 %cmp344, label %for.body4, label %for.end8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x [101 x i8]], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %a, 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.body4: ; preds = %for.cond2.preheader, %for.body4
%i.145 = phi i32 [ %inc7, %for.body4 ], [ 0, %for.cond2.preheader ]
%putchar40 = call i32 @putchar(i32 35)
%inc7 = add nuw nsw i32 %i.145, 1
%4 = load i32, ptr %b, align 4, !tbaa !5
%cmp3.not = icmp sgt i32 %i.145, %4
br i1 %cmp3.not, label %for.end8, label %for.body4, !llvm.loop !11
for.end8: ; preds = %for.body4, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
%5 = load i32, ptr %a, align 4, !tbaa !5
%cmp1146 = icmp sgt i32 %5, 0
br i1 %cmp1146, label %for.body12, label %for.cond20.preheader
for.cond20.preheader: ; preds = %for.body12, %for.end8
%6 = load i32, ptr %b, align 4, !tbaa !5
%cmp2249 = icmp sgt i32 %6, -2
br i1 %cmp2249, label %for.body23, label %for.end27
for.body12: ; preds = %for.end8, %for.body12
%indvars.iv52 = phi i64 [ %indvars.iv.next53, %for.body12 ], [ 0, %for.end8 ]
%arrayidx14 = getelementptr inbounds [100 x [101 x i8]], ptr %s, i64 0, i64 %indvars.iv52
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef nonnull %arrayidx14)
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%7 = load i32, ptr %a, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp11 = icmp slt i64 %indvars.iv.next53, %8
br i1 %cmp11, label %for.body12, label %for.cond20.preheader, !llvm.loop !12
for.body23: ; preds = %for.cond20.preheader, %for.body23
%i.350 = phi i32 [ %inc26, %for.body23 ], [ 0, %for.cond20.preheader ]
%putchar39 = call i32 @putchar(i32 35)
%inc26 = add nuw nsw i32 %i.350, 1
%9 = load i32, ptr %b, align 4, !tbaa !5
%cmp22.not = icmp sgt i32 %i.350, %9
br i1 %cmp22.not, label %for.end27, label %for.body23, !llvm.loop !13
for.end27: ; preds = %for.body23, %for.cond20.preheader
%putchar38 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 10100, ptr nonnull %s) #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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main()
{
int h,w,i,j;
char a[103][103];
scanf("%d %d",&h,&w);
for(i=0;i<h;i++)
{
for(j=0;j<w;j++)
{
scanf(" %c",&a[i][j]);
}
}
for(i=0;i<w+2;i++)
{
printf("#");
}
printf("\n");
for(i=0;i<h;i++)
{
printf("#");
for(j=0;j<w;j++)
{
printf("%c",a[i][j]);
}
printf("#\n");
}
for(i=0;i<w+2;i++)
{
printf("#");
}
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_177974/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_177974/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c" %c\00", align 1
@str = private unnamed_addr constant [2 x i8] c"#\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
%a = alloca [103 x [103 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 10609, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp68 = icmp sgt i32 %0, 0
%.pre91 = load i32, ptr %w, align 4, !tbaa !5
%1 = icmp sgt i32 %.pre91, 0
%or.cond = select i1 %cmp68, i1 %1, i1 false
br i1 %or.cond, label %for.cond1.preheader, label %for.cond10.preheader
for.cond1.preheader: ; preds = %entry, %for.inc7
%2 = phi i32 [ %7, %for.inc7 ], [ %0, %entry ]
%3 = phi i32 [ %8, %for.inc7 ], [ %.pre91, %entry ]
%indvars.iv82 = phi i64 [ %indvars.iv.next83, %for.inc7 ], [ 0, %entry ]
%cmp266 = icmp sgt i32 %3, 0
br i1 %cmp266, label %for.body3, label %for.inc7
for.cond10.preheader: ; preds = %for.inc7, %entry
%4 = phi i32 [ %.pre91, %entry ], [ %8, %for.inc7 ]
%cmp1171 = icmp sgt i32 %4, -2
br i1 %cmp1171, label %for.body12, label %for.end16
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 0, %for.cond1.preheader ]
%arrayidx5 = getelementptr inbounds [103 x [103 x i8]], ptr %a, i64 0, i64 %indvars.iv82, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %w, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp2, label %for.body3, label %for.inc7.loopexit, !llvm.loop !9
for.inc7.loopexit: ; preds = %for.body3
%.pre = load i32, ptr %h, align 4, !tbaa !5
br label %for.inc7
for.inc7: ; preds = %for.inc7.loopexit, %for.cond1.preheader
%7 = phi i32 [ %.pre, %for.inc7.loopexit ], [ %2, %for.cond1.preheader ]
%8 = phi i32 [ %5, %for.inc7.loopexit ], [ %3, %for.cond1.preheader ]
%indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
%9 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next83, %9
br i1 %cmp, label %for.cond1.preheader, label %for.cond10.preheader, !llvm.loop !11
for.body12: ; preds = %for.cond10.preheader, %for.body12
%i.172 = phi i32 [ %inc15, %for.body12 ], [ 0, %for.cond10.preheader ]
%putchar65 = call i32 @putchar(i32 35)
%inc15 = add nuw nsw i32 %i.172, 1
%10 = load i32, ptr %w, align 4, !tbaa !5
%cmp11.not = icmp sgt i32 %i.172, %10
br i1 %cmp11.not, label %for.end16, label %for.body12, !llvm.loop !13
for.end16: ; preds = %for.body12, %for.cond10.preheader
%putchar = call i32 @putchar(i32 10)
%11 = load i32, ptr %h, align 4, !tbaa !5
%cmp1975 = icmp sgt i32 %11, 0
br i1 %cmp1975, label %for.body20, label %for.cond37.preheader
for.cond37.preheader: ; preds = %for.end32, %for.end16
%12 = load i32, ptr %w, align 4, !tbaa !5
%cmp3978 = icmp sgt i32 %12, -2
br i1 %cmp3978, label %for.body41, label %for.end45
for.body20: ; preds = %for.end16, %for.end32
%indvars.iv88 = phi i64 [ %indvars.iv.next89, %for.end32 ], [ 0, %for.end16 ]
%putchar63 = call i32 @putchar(i32 35)
%13 = load i32, ptr %w, align 4, !tbaa !5
%cmp2373 = icmp sgt i32 %13, 0
br i1 %cmp2373, label %for.body24, label %for.end32
for.body24: ; preds = %for.body20, %for.body24
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.body24 ], [ 0, %for.body20 ]
%arrayidx28 = getelementptr inbounds [103 x [103 x i8]], ptr %a, i64 0, i64 %indvars.iv88, i64 %indvars.iv85
%14 = load i8, ptr %arrayidx28, align 1, !tbaa !14
%conv = sext i8 %14 to i32
%putchar64 = call i32 @putchar(i32 %conv)
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%15 = load i32, ptr %w, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp23 = icmp slt i64 %indvars.iv.next86, %16
br i1 %cmp23, label %for.body24, label %for.end32, !llvm.loop !15
for.end32: ; preds = %for.body24, %for.body20
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%17 = load i32, ptr %h, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp19 = icmp slt i64 %indvars.iv.next89, %18
br i1 %cmp19, label %for.body20, label %for.cond37.preheader, !llvm.loop !16
for.body41: ; preds = %for.cond37.preheader, %for.body41
%i.379 = phi i32 [ %inc44, %for.body41 ], [ 0, %for.cond37.preheader ]
%putchar62 = call i32 @putchar(i32 35)
%inc44 = add nuw nsw i32 %i.379, 1
%19 = load i32, ptr %w, align 4, !tbaa !5
%cmp39.not = icmp sgt i32 %i.379, %19
br i1 %cmp39.not, label %for.end45, label %for.body41, !llvm.loop !17
for.end45: ; preds = %for.body41, %for.cond37.preheader
%putchar61 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 10609, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
int main(void){
long long n;
long long t;
long long count,ans;
scanf("%lld",&t);
while(t--){
scanf("%lld",&n);
ans=0;
if(n%2050!=0){
printf("-1\n");
}
else{
count=n/2050;
while(count){
ans+=count%10;
count/=10;
}
printf("%lld\n",ans);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_17806/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_17806/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.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%t = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i64, ptr %t, align 8, !tbaa !5
%dec16 = add nsw i64 %0, -1
store i64 %dec16, ptr %t, align 8, !tbaa !5
%tobool.not17 = icmp eq i64 %0, 0
br i1 %tobool.not17, label %while.end9, label %while.body
while.body: ; preds = %entry, %if.end
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i64, ptr %n, align 8, !tbaa !5
%rem = srem i64 %1, 2050
%div = sdiv i64 %1, 2050
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %if.else, label %if.then
if.then: ; preds = %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.else: ; preds = %while.body
%.off = add i64 %1, 2049
%tobool4.not13 = icmp ult i64 %.off, 4099
br i1 %tobool4.not13, label %while.end, label %while.body5
while.body5: ; preds = %if.else, %while.body5
%ans.015 = phi i64 [ %add, %while.body5 ], [ 0, %if.else ]
%count.014 = phi i64 [ %div7, %while.body5 ], [ %div, %if.else ]
%rem6 = srem i64 %count.014, 10
%add = add nsw i64 %ans.015, %rem6
%div7 = sdiv i64 %count.014, 10
%count.014.off = add nsw i64 %count.014, 9
%tobool4.not = icmp ult i64 %count.014.off, 19
br i1 %tobool4.not, label %while.end, label %while.body5, !llvm.loop !9
while.end: ; preds = %while.body5, %if.else
%ans.0.lcssa = phi i64 [ 0, %if.else ], [ %add, %while.body5 ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
br label %if.end
if.end: ; preds = %while.end, %if.then
%2 = load i64, ptr %t, align 8, !tbaa !5
%dec = add nsw i64 %2, -1
store i64 %dec, ptr %t, align 8, !tbaa !5
%tobool.not = icmp eq i64 %2, 0
br i1 %tobool.not, label %while.end9, label %while.body, !llvm.loop !11
while.end9: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #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: 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 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}
|
#include <stdio.h>
int main(void){
int h, w;
scanf("%d%d", &h, &w);
for(int i = 0; i < w+2; i++){
printf("#");
}
printf("\n");
char pic[w];
for(int i = 0; i < h; i++){
scanf("%s", &pic[0]);
printf("#%s#\n", pic);
}
for(int i = 0; i < w+2; i++){
printf("#");
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_178102/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_178102/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.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"#%s#\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %w, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, -2
br i1 %cmp31, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%putchar = call i32 @putchar(i32 10)
%1 = load i32, ptr %w, align 4, !tbaa !5
%2 = zext i32 %1 to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca i8, i64 %2, align 16
%4 = load i32, ptr %h, align 4, !tbaa !5
%cmp533 = icmp sgt i32 %4, 0
br i1 %cmp533, label %for.body7, label %for.cond14.preheader
for.body: ; preds = %entry, %for.body
%i.032 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%putchar29 = call i32 @putchar(i32 35)
%inc = add nuw nsw i32 %i.032, 1
%5 = load i32, ptr %w, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %i.032, %5
br i1 %cmp.not, label %for.cond.cleanup, label %for.body, !llvm.loop !9
for.cond14.preheader: ; preds = %for.body7, %for.cond.cleanup
%6 = load i32, ptr %w, align 4, !tbaa !5
%cmp1636 = icmp sgt i32 %6, -2
br i1 %cmp1636, label %for.body18, label %for.cond.cleanup17
for.body7: ; preds = %for.cond.cleanup, %for.body7
%i3.034 = phi i32 [ %inc11, %for.body7 ], [ 0, %for.cond.cleanup ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %vla)
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef nonnull %vla)
%inc11 = add nuw nsw i32 %i3.034, 1
%7 = load i32, ptr %h, align 4, !tbaa !5
%cmp5 = icmp slt i32 %inc11, %7
br i1 %cmp5, label %for.body7, label %for.cond14.preheader, !llvm.loop !11
for.cond.cleanup17: ; preds = %for.body18, %for.cond14.preheader
%putchar27 = call i32 @putchar(i32 10)
call void @llvm.stackrestore.p0(ptr %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
ret i32 0
for.body18: ; preds = %for.cond14.preheader, %for.body18
%i13.037 = phi i32 [ %inc21, %for.body18 ], [ 0, %for.cond14.preheader ]
%putchar28 = call i32 @putchar(i32 35)
%inc21 = add nuw nsw i32 %i13.037, 1
%8 = load i32, ptr %w, align 4, !tbaa !5
%cmp16.not = icmp sgt i32 %i13.037, %8
br i1 %cmp16.not, label %for.cond.cleanup17, label %for.body18, !llvm.loop !12
}
; 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: 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(void)
{
int h, w, i;
scanf("%d%d", &h, &w);
char a[101][101];
for(i=0; i<h; i++){
scanf("%s", a[i]);
}
for(i=0; i<w+2; i++)
putchar('#');
putchar('\n');
for(i=0; i<h; i++)
printf("#%s#\n", a[i]);
for(i=0; i<w+2; i++)
putchar('#');
putchar('\n');
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_178153/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_178153/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"%s\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"#%s#\0A\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:
%h = alloca i32, align 4
%w = alloca i32, align 4
%a = alloca [101 x [101 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
call void @llvm.lifetime.start.p0(i64 10201, ptr nonnull %a) #3
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp41 = icmp sgt i32 %0, 0
br i1 %cmp41, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%1 = load i32, ptr %w, align 4, !tbaa !5
%cmp344 = icmp sgt i32 %1, -2
br i1 %cmp344, label %for.body4, label %for.end8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 x [101 x i8]], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %h, 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.body4: ; preds = %for.cond2.preheader, %for.body4
%i.145 = phi i32 [ %inc7, %for.body4 ], [ 0, %for.cond2.preheader ]
%4 = load ptr, ptr @stdout, align 8, !tbaa !11
%call.i = call i32 @putc(i32 noundef 35, ptr noundef %4)
%inc7 = add nuw nsw i32 %i.145, 1
%5 = load i32, ptr %w, align 4, !tbaa !5
%cmp3.not = icmp sgt i32 %i.145, %5
br i1 %cmp3.not, label %for.end8, label %for.body4, !llvm.loop !13
for.end8: ; preds = %for.body4, %for.cond2.preheader
%6 = load ptr, ptr @stdout, align 8, !tbaa !11
%call.i38 = call i32 @putc(i32 noundef 10, ptr noundef %6)
%7 = load i32, ptr %h, align 4, !tbaa !5
%cmp1146 = icmp sgt i32 %7, 0
br i1 %cmp1146, label %for.body12, label %for.cond20.preheader
for.cond20.preheader: ; preds = %for.body12, %for.end8
%8 = load i32, ptr %w, align 4, !tbaa !5
%cmp2249 = icmp sgt i32 %8, -2
br i1 %cmp2249, label %for.body23, label %for.end27
for.body12: ; preds = %for.end8, %for.body12
%indvars.iv52 = phi i64 [ %indvars.iv.next53, %for.body12 ], [ 0, %for.end8 ]
%arrayidx14 = getelementptr inbounds [101 x [101 x i8]], ptr %a, i64 0, i64 %indvars.iv52
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %arrayidx14)
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%9 = load i32, ptr %h, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp11 = icmp slt i64 %indvars.iv.next53, %10
br i1 %cmp11, label %for.body12, label %for.cond20.preheader, !llvm.loop !14
for.body23: ; preds = %for.cond20.preheader, %for.body23
%i.350 = phi i32 [ %inc26, %for.body23 ], [ 0, %for.cond20.preheader ]
%11 = load ptr, ptr @stdout, align 8, !tbaa !11
%call.i39 = call i32 @putc(i32 noundef 35, ptr noundef %11)
%inc26 = add nuw nsw i32 %i.350, 1
%12 = load i32, ptr %w, align 4, !tbaa !5
%cmp22.not = icmp sgt i32 %i.350, %12
br i1 %cmp22.not, label %for.end27, label %for.body23, !llvm.loop !15
for.end27: ; preds = %for.body23, %for.cond20.preheader
%13 = load ptr, ptr @stdout, align 8, !tbaa !11
%call.i40 = call i32 @putc(i32 noundef 10, ptr noundef %13)
call void @llvm.lifetime.end.p0(i64 10201, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
int main()
{
int i,j;
long long int N,K;
scanf("%lld%lld",&N,&K);
long long int a[N-1];
for(i=0; i<N; i++)
{
scanf("%lld",&a[i]);
}
int temp,sum=0;
for(i=0; i<N; i++)
{
for(j=i+1; j<N; j++)
{
if(a[i]>a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
for(i=0; i<K; i=i+1)
{
sum=sum+a[i];
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_178197/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_178197/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"%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca 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
%sub = add nsw i64 %0, -1
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %sub, align 16
%2 = load i64, ptr %N, align 8, !tbaa !5
%cmp66 = icmp sgt i64 %2, 0
br i1 %cmp66, label %for.body, label %for.cond35.preheader
for.cond3.preheader: ; preds = %for.body
%cmp573 = icmp sgt i64 %3, 0
br i1 %cmp573, label %for.body7, label %for.cond35.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i64, ptr %N, align 8, !tbaa !5
%cmp = icmp sgt i64 %3, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond3.loopexit: ; preds = %for.inc29, %for.body7
%indvars.iv.next84 = add nuw i64 %indvars.iv83, 1
%exitcond.not = icmp eq i64 %indvars.iv.next89, %3
br i1 %exitcond.not, label %for.cond35.preheader, label %for.body7, !llvm.loop !11
for.cond35.preheader: ; preds = %for.cond3.loopexit, %entry, %for.cond3.preheader
%4 = load i64, ptr %K, align 8, !tbaa !5
%cmp3776 = icmp sgt i64 %4, 0
br i1 %cmp3776, label %for.body39.preheader, label %for.end47
for.body39.preheader: ; preds = %for.cond35.preheader
%min.iters.check = icmp ult i64 %4, 4
br i1 %min.iters.check, label %for.body39.preheader99, label %vector.ph
vector.ph: ; preds = %for.body39.preheader
%n.vec = and i64 %4, -4
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 i32> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%vec.phi97 = phi <2 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%5 = getelementptr inbounds i64, ptr %vla, i64 %index
%wide.load = load <2 x i64>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i64, ptr %5, i64 2
%wide.load98 = load <2 x i64>, ptr %6, align 16, !tbaa !5
%7 = trunc <2 x i64> %wide.load to <2 x i32>
%8 = trunc <2 x i64> %wide.load98 to <2 x i32>
%9 = add <2 x i32> %vec.phi, %7
%10 = add <2 x i32> %vec.phi97, %8
%index.next = add nuw i64 %index, 4
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i32> %10, %9
%12 = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %4, %n.vec
br i1 %cmp.n, label %for.end47, label %for.body39.preheader99
for.body39.preheader99: ; preds = %for.body39.preheader, %middle.block
%indvars.iv91.ph = phi i64 [ 0, %for.body39.preheader ], [ %n.vec, %middle.block ]
%sum.078.ph = phi i32 [ 0, %for.body39.preheader ], [ %12, %middle.block ]
br label %for.body39
for.body7: ; preds = %for.cond3.preheader, %for.cond3.loopexit
%indvars.iv88 = phi i64 [ %indvars.iv.next89, %for.cond3.loopexit ], [ 0, %for.cond3.preheader ]
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %for.cond3.loopexit ], [ 1, %for.cond3.preheader ]
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%cmp1070 = icmp sgt i64 %3, %indvars.iv.next89
br i1 %cmp1070, label %for.body12.lr.ph, label %for.cond3.loopexit
for.body12.lr.ph: ; preds = %for.body7
%arrayidx14 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv88
br label %for.body12
for.body12: ; preds = %for.body12.lr.ph, %for.inc29
%indvars.iv85 = phi i64 [ %indvars.iv83, %for.body12.lr.ph ], [ %indvars.iv.next86, %for.inc29 ]
%13 = load i64, ptr %arrayidx14, align 8, !tbaa !5
%arrayidx16 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv85
%14 = load i64, ptr %arrayidx16, align 8, !tbaa !5
%cmp17 = icmp sgt i64 %13, %14
br i1 %cmp17, label %if.then, label %for.inc29
if.then: ; preds = %for.body12
store i64 %14, ptr %arrayidx14, align 8, !tbaa !5
%sext = shl i64 %13, 32
%conv26 = ashr exact i64 %sext, 32
store i64 %conv26, ptr %arrayidx16, align 8, !tbaa !5
br label %for.inc29
for.inc29: ; preds = %for.body12, %if.then
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%cmp10 = icmp sgt i64 %3, %indvars.iv.next86
br i1 %cmp10, label %for.body12, label %for.cond3.loopexit, !llvm.loop !15
for.body39: ; preds = %for.body39.preheader99, %for.body39
%indvars.iv91 = phi i64 [ %indvars.iv.next92, %for.body39 ], [ %indvars.iv91.ph, %for.body39.preheader99 ]
%sum.078 = phi i32 [ %conv44, %for.body39 ], [ %sum.078.ph, %for.body39.preheader99 ]
%arrayidx42 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv91
%15 = load i64, ptr %arrayidx42, align 8, !tbaa !5
%16 = trunc i64 %15 to i32
%conv44 = add i32 %sum.078, %16
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
%exitcond94.not = icmp eq i64 %indvars.iv.next92, %4
br i1 %exitcond94.not, label %for.end47, label %for.body39, !llvm.loop !16
for.end47: ; preds = %for.body39, %middle.block, %for.cond35.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond35.preheader ], [ %12, %middle.block ], [ %conv44, %for.body39 ]
%call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sum.0.lcssa)
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: 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 i32 @llvm.vector.reduce.add.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 = !{!"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 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !14, !13}
|
#include<stdio.h>
int he(long long int a)
{
int c=0;
while(a){
c=c+a%10;
a/=10;
}
return c;
}
int main()
{
int t,i;
scanf("%d",&t);
for(i=0;i<t;i++){
long long int n,a;
scanf("%lld",&n);
if(n%2050!=0){
printf("-1\n");
}
else{
a=n/2050;
printf("%d\n",he(a));
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_17824/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_17824/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.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @he(i64 noundef %a) local_unnamed_addr #0 {
entry:
%tobool.not5 = icmp eq i64 %a, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%c.07 = phi i32 [ %conv1, %while.body ], [ 0, %entry ]
%a.addr.06 = phi i64 [ %div, %while.body ], [ %a, %entry ]
%rem = srem i64 %a.addr.06, 10
%0 = trunc i64 %rem to i32
%conv1 = add i32 %c.07, %0
%div = sdiv i64 %a.addr.06, 10
%a.addr.06.off = add i64 %a.addr.06, 9
%tobool.not = icmp ult i64 %a.addr.06.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%c.0.lcssa = phi i32 [ 0, %entry ], [ %conv1, %while.body ]
ret i32 %c.0.lcssa
}
; 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:
%t = alloca i32, align 4
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !7
%cmp7 = icmp sgt i32 %0, 0
br i1 %cmp7, label %for.body, label %for.end
for.body: ; preds = %entry, %if.end
%i.08 = phi i32 [ %inc, %if.end ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%1 = load i64, ptr %n, align 8, !tbaa !11
%rem = srem i64 %1, 2050
%div = sdiv i64 %1, 2050
%cmp2.not = icmp eq i64 %rem, 0
br i1 %cmp2.not, label %if.else, label %if.then
if.then: ; preds = %for.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.else: ; preds = %for.body
%.off = add i64 %1, 2049
%tobool.not5.i = icmp ult i64 %.off, 4099
br i1 %tobool.not5.i, label %he.exit, label %while.body.i
while.body.i: ; preds = %if.else, %while.body.i
%c.07.i = phi i32 [ %conv1.i, %while.body.i ], [ 0, %if.else ]
%a.addr.06.i = phi i64 [ %div.i, %while.body.i ], [ %div, %if.else ]
%rem.i = srem i64 %a.addr.06.i, 10
%2 = trunc i64 %rem.i to i32
%conv1.i = add i32 %c.07.i, %2
%div.i = sdiv i64 %a.addr.06.i, 10
%a.addr.06.off.i = add nsw i64 %a.addr.06.i, 9
%tobool.not.i = icmp ult i64 %a.addr.06.off.i, 19
br i1 %tobool.not.i, label %he.exit, label %while.body.i, !llvm.loop !5
he.exit: ; preds = %while.body.i, %if.else
%c.0.lcssa.i = phi i32 [ 0, %if.else ], [ %conv1.i, %while.body.i ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %c.0.lcssa.i)
br label %if.end
if.end: ; preds = %he.exit, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
%inc = add nuw nsw i32 %i.08, 1
%3 = load i32, ptr %t, align 4, !tbaa !7
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
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 #4
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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !9, i64 0}
!13 = distinct !{!13, !6}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.