Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
int main(void)
{
int N, T;
int min = 1001;
scanf("%d%d", &N, &T);
for(int i = 0; i < N; i++){
int c, t;
scanf("%d%d", &c, &t);
if(t <= T && c < min) min = c;
}
if(1000 < min) printf("TLE\n");
else printf("%d\n", min);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188248/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188248/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [4 x i8] c"TLE\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%T = alloca i32, align 4
%c = alloca i32, align 4
%t = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %T)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %0, 0
br i1 %cmp12, label %for.body, label %if.then5
for.cond.cleanup: ; preds = %for.body
%cmp4 = icmp sgt i32 %min.1, 1000
br i1 %cmp4, label %if.then5, label %if.else
for.body: ; preds = %entry, %for.body
%i.014 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%min.013 = phi i32 [ %min.1, %for.body ], [ 1001, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c, ptr noundef nonnull %t)
%1 = load i32, ptr %t, align 4, !tbaa !5
%2 = load i32, ptr %T, align 4, !tbaa !5
%cmp2.not = icmp sgt i32 %1, %2
%3 = load i32, ptr %c, align 4
%spec.select = call i32 @llvm.smin.i32(i32 %3, i32 %min.013)
%min.1 = select i1 %cmp2.not, i32 %min.013, i32 %spec.select
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
%inc = add nuw nsw i32 %i.014, 1
%4 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
if.then5: ; preds = %entry, %for.cond.cleanup
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end8
if.else: ; preds = %for.cond.cleanup
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %min.1)
br label %if.end8
if.end8: ; preds = %if.else, %if.then5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int n;
int t;
int c[100];
int ti[100];
int i;
int num=100000;
int a=0;
scanf("%d", &n);
scanf("%d", &t);
for (i = 0; i < n; i++) {
scanf("%d", &c[i]);
scanf("%d", &ti[i]);
}
for (i = 0; i < n; i++) {
if (ti[i] <= t) {
a++;
if (c[i] <=num) {
num = c[i];
}
}
}
if (a != 0 ) {
printf("%d",num);
}
else {
printf("TLE");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188299/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188299/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"TLE\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%t = alloca i32, align 4
%c = alloca [100 x i32], align 16
%ti = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %ti) #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 %t)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp38 = icmp sgt i32 %0, 0
br i1 %cmp38, label %for.body, label %if.else
for.cond6.preheader: ; preds = %for.body
%cmp740 = icmp sgt i32 %3, 0
br i1 %cmp740, label %for.body8.lr.ph, label %if.else
for.body8.lr.ph: ; preds = %for.cond6.preheader
%1 = load i32, ptr %t, align 4, !tbaa !5
%wide.trip.count = zext i32 %3 to i64
%xtraiter = and i64 %wide.trip.count, 1
%2 = icmp eq i32 %3, 1
br i1 %2, label %for.end22.unr-lcssa, label %for.body8.lr.ph.new
for.body8.lr.ph.new: ; preds = %for.body8.lr.ph
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %c, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%arrayidx4 = getelementptr inbounds [100 x i32], ptr %ti, i64 0, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx4)
%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.inc20.1, %for.body8.lr.ph.new
%indvars.iv48 = phi i64 [ 0, %for.body8.lr.ph.new ], [ %indvars.iv.next49.1, %for.inc20.1 ]
%a.043 = phi i32 [ 0, %for.body8.lr.ph.new ], [ %a.1.1, %for.inc20.1 ]
%num.042 = phi i32 [ 100000, %for.body8.lr.ph.new ], [ %num.1.1, %for.inc20.1 ]
%niter = phi i64 [ 0, %for.body8.lr.ph.new ], [ %niter.next.1, %for.inc20.1 ]
%arrayidx10 = getelementptr inbounds [100 x i32], ptr %ti, i64 0, i64 %indvars.iv48
%5 = load i32, ptr %arrayidx10, align 8, !tbaa !5
%cmp11.not = icmp sgt i32 %5, %1
br i1 %cmp11.not, label %for.inc20, label %if.then
if.then: ; preds = %for.body8
%inc12 = add nsw i32 %a.043, 1
%arrayidx14 = getelementptr inbounds [100 x i32], ptr %c, i64 0, i64 %indvars.iv48
%6 = load i32, ptr %arrayidx14, align 8, !tbaa !5
%spec.select = call i32 @llvm.smin.i32(i32 %6, i32 %num.042)
br label %for.inc20
for.inc20: ; preds = %if.then, %for.body8
%num.1 = phi i32 [ %num.042, %for.body8 ], [ %spec.select, %if.then ]
%a.1 = phi i32 [ %a.043, %for.body8 ], [ %inc12, %if.then ]
%indvars.iv.next49 = or i64 %indvars.iv48, 1
%arrayidx10.1 = getelementptr inbounds [100 x i32], ptr %ti, i64 0, i64 %indvars.iv.next49
%7 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%cmp11.not.1 = icmp sgt i32 %7, %1
br i1 %cmp11.not.1, label %for.inc20.1, label %if.then.1
if.then.1: ; preds = %for.inc20
%inc12.1 = add nsw i32 %a.1, 1
%arrayidx14.1 = getelementptr inbounds [100 x i32], ptr %c, i64 0, i64 %indvars.iv.next49
%8 = load i32, ptr %arrayidx14.1, align 4, !tbaa !5
%spec.select.1 = call i32 @llvm.smin.i32(i32 %8, i32 %num.1)
br label %for.inc20.1
for.inc20.1: ; preds = %if.then.1, %for.inc20
%num.1.1 = phi i32 [ %num.1, %for.inc20 ], [ %spec.select.1, %if.then.1 ]
%a.1.1 = phi i32 [ %a.1, %for.inc20 ], [ %inc12.1, %if.then.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.unr-lcssa, label %for.body8, !llvm.loop !11
for.end22.unr-lcssa: ; preds = %for.inc20.1, %for.body8.lr.ph
%num.1.lcssa.ph = phi i32 [ undef, %for.body8.lr.ph ], [ %num.1.1, %for.inc20.1 ]
%a.1.lcssa.ph = phi i32 [ undef, %for.body8.lr.ph ], [ %a.1.1, %for.inc20.1 ]
%indvars.iv48.unr = phi i64 [ 0, %for.body8.lr.ph ], [ %indvars.iv.next49.1, %for.inc20.1 ]
%a.043.unr = phi i32 [ 0, %for.body8.lr.ph ], [ %a.1.1, %for.inc20.1 ]
%num.042.unr = phi i32 [ 100000, %for.body8.lr.ph ], [ %num.1.1, %for.inc20.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end22, label %for.body8.epil
for.body8.epil: ; preds = %for.end22.unr-lcssa
%arrayidx10.epil = getelementptr inbounds [100 x i32], ptr %ti, i64 0, i64 %indvars.iv48.unr
%9 = load i32, ptr %arrayidx10.epil, align 4, !tbaa !5
%cmp11.not.epil = icmp sgt i32 %9, %1
br i1 %cmp11.not.epil, label %for.end22, label %if.then.epil
if.then.epil: ; preds = %for.body8.epil
%inc12.epil = add nsw i32 %a.043.unr, 1
%arrayidx14.epil = getelementptr inbounds [100 x i32], ptr %c, i64 0, i64 %indvars.iv48.unr
%10 = load i32, ptr %arrayidx14.epil, align 4, !tbaa !5
%spec.select.epil = call i32 @llvm.smin.i32(i32 %10, i32 %num.042.unr)
br label %for.end22
for.end22: ; preds = %for.body8.epil, %if.then.epil, %for.end22.unr-lcssa
%num.1.lcssa = phi i32 [ %num.1.lcssa.ph, %for.end22.unr-lcssa ], [ %num.042.unr, %for.body8.epil ], [ %spec.select.epil, %if.then.epil ]
%a.1.lcssa = phi i32 [ %a.1.lcssa.ph, %for.end22.unr-lcssa ], [ %a.043.unr, %for.body8.epil ], [ %inc12.epil, %if.then.epil ]
%11 = icmp eq i32 %a.1.lcssa, 0
br i1 %11, label %if.else, label %if.then24
if.then24: ; preds = %for.end22
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %num.1.lcssa)
br label %if.end27
if.else: ; preds = %entry, %for.cond6.preheader, %for.end22
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end27
if.end27: ; preds = %if.else, %if.then24
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %ti) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+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>
int main()
{
int N,T,i,m=0,cost;
scanf("%d %d",&N,&T);
int c[N],t[N];
for (i=0;i<N;i++)
scanf("%d %d",&c[i],&t[i]);
cost = c[0];
for (i=0;i<N;i++)
if ((t[i]<=T)&&(c[i]<=cost)){
cost = c[i];
m++;
}
if (m==0)printf("TLE\n");
else printf("%d\n",cost);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188341/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188341/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [4 x i8] c"TLE\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%T = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %T)
%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
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%cmp37 = icmp sgt i32 %3, 0
br i1 %cmp37, label %for.body, label %if.then22
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
%arrayidx3 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %N, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp739 = icmp sgt i32 %5, 0
br i1 %cmp739, label %for.body8.lr.ph, label %if.then22
for.body8.lr.ph: ; preds = %for.end
%.pre = load i32, ptr %vla, align 16, !tbaa !5
%7 = load i32, ptr %T, align 4, !tbaa !5
%wide.trip.count = zext i32 %5 to i64
%xtraiter = and i64 %wide.trip.count, 1
%8 = icmp eq i32 %5, 1
br i1 %8, label %for.end20.unr-lcssa, label %for.body8.lr.ph.new
for.body8.lr.ph.new: ; preds = %for.body8.lr.ph
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body8
for.body8: ; preds = %for.inc18.1, %for.body8.lr.ph.new
%indvars.iv47 = phi i64 [ 0, %for.body8.lr.ph.new ], [ %indvars.iv.next48.1, %for.inc18.1 ]
%m.041 = phi i32 [ 0, %for.body8.lr.ph.new ], [ %m.1.1, %for.inc18.1 ]
%cost.040 = phi i32 [ %.pre, %for.body8.lr.ph.new ], [ %cost.1.1, %for.inc18.1 ]
%niter = phi i64 [ 0, %for.body8.lr.ph.new ], [ %niter.next.1, %for.inc18.1 ]
%arrayidx10 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv47
%9 = load i32, ptr %arrayidx10, align 8, !tbaa !5
%cmp11.not = icmp sgt i32 %9, %7
br i1 %cmp11.not, label %for.inc18, label %land.lhs.true
land.lhs.true: ; preds = %for.body8
%arrayidx13 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv47
%10 = load i32, ptr %arrayidx13, align 8, !tbaa !5
%cmp14.not = icmp sle i32 %10, %cost.040
%spec.select = call i32 @llvm.smin.i32(i32 %10, i32 %cost.040)
%inc17 = zext i1 %cmp14.not to i32
%spec.select36 = add nsw i32 %m.041, %inc17
br label %for.inc18
for.inc18: ; preds = %land.lhs.true, %for.body8
%cost.1 = phi i32 [ %cost.040, %for.body8 ], [ %spec.select, %land.lhs.true ]
%m.1 = phi i32 [ %m.041, %for.body8 ], [ %spec.select36, %land.lhs.true ]
%indvars.iv.next48 = or i64 %indvars.iv47, 1
%arrayidx10.1 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv.next48
%11 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%cmp11.not.1 = icmp sgt i32 %11, %7
br i1 %cmp11.not.1, label %for.inc18.1, label %land.lhs.true.1
land.lhs.true.1: ; preds = %for.inc18
%arrayidx13.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next48
%12 = load i32, ptr %arrayidx13.1, align 4, !tbaa !5
%cmp14.not.1 = icmp sle i32 %12, %cost.1
%spec.select.1 = call i32 @llvm.smin.i32(i32 %12, i32 %cost.1)
%inc17.1 = zext i1 %cmp14.not.1 to i32
%spec.select36.1 = add nsw i32 %m.1, %inc17.1
br label %for.inc18.1
for.inc18.1: ; preds = %land.lhs.true.1, %for.inc18
%cost.1.1 = phi i32 [ %cost.1, %for.inc18 ], [ %spec.select.1, %land.lhs.true.1 ]
%m.1.1 = phi i32 [ %m.1, %for.inc18 ], [ %spec.select36.1, %land.lhs.true.1 ]
%indvars.iv.next48.1 = add nuw nsw i64 %indvars.iv47, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end20.unr-lcssa, label %for.body8, !llvm.loop !11
for.end20.unr-lcssa: ; preds = %for.inc18.1, %for.body8.lr.ph
%cost.1.lcssa.ph = phi i32 [ undef, %for.body8.lr.ph ], [ %cost.1.1, %for.inc18.1 ]
%m.1.lcssa.ph = phi i32 [ undef, %for.body8.lr.ph ], [ %m.1.1, %for.inc18.1 ]
%indvars.iv47.unr = phi i64 [ 0, %for.body8.lr.ph ], [ %indvars.iv.next48.1, %for.inc18.1 ]
%m.041.unr = phi i32 [ 0, %for.body8.lr.ph ], [ %m.1.1, %for.inc18.1 ]
%cost.040.unr = phi i32 [ %.pre, %for.body8.lr.ph ], [ %cost.1.1, %for.inc18.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end20, label %for.body8.epil
for.body8.epil: ; preds = %for.end20.unr-lcssa
%arrayidx10.epil = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv47.unr
%13 = load i32, ptr %arrayidx10.epil, align 4, !tbaa !5
%cmp11.not.epil = icmp sgt i32 %13, %7
br i1 %cmp11.not.epil, label %for.end20, label %land.lhs.true.epil
land.lhs.true.epil: ; preds = %for.body8.epil
%arrayidx13.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv47.unr
%14 = load i32, ptr %arrayidx13.epil, align 4, !tbaa !5
%cmp14.not.epil = icmp sle i32 %14, %cost.040.unr
%spec.select.epil = call i32 @llvm.smin.i32(i32 %14, i32 %cost.040.unr)
%inc17.epil = zext i1 %cmp14.not.epil to i32
%spec.select36.epil = add nsw i32 %m.041.unr, %inc17.epil
br label %for.end20
for.end20: ; preds = %for.body8.epil, %land.lhs.true.epil, %for.end20.unr-lcssa
%cost.1.lcssa = phi i32 [ %cost.1.lcssa.ph, %for.end20.unr-lcssa ], [ %cost.040.unr, %for.body8.epil ], [ %spec.select.epil, %land.lhs.true.epil ]
%m.1.lcssa = phi i32 [ %m.1.lcssa.ph, %for.end20.unr-lcssa ], [ %m.041.unr, %for.body8.epil ], [ %spec.select36.epil, %land.lhs.true.epil ]
%15 = icmp eq i32 %m.1.lcssa, 0
br i1 %15, label %if.then22, label %if.else
if.then22: ; preds = %entry, %for.end, %for.end20
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end25
if.else: ; preds = %for.end20
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cost.1.lcssa)
br label %if.end25
if.end25: ; preds = %if.else, %if.then22
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void){
int N,T,c[101],t[101],i,w=1001;
t[0]=1001;
scanf("%d %d",&N,&T);
for(i=1;i<=N;i++){
scanf("%d %d",&c[i],&t[i]);
if(t[i]<=T){
if(c[i]<w){
w=c[i];
}
}
}
if(w==1001){
puts("TLE");
}else{
printf("%d",w);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188392/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188392/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"TLE\00", align 1
@.str.2 = 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
%T = alloca i32, align 4
%c = alloca [101 x i32], align 16
%t = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #4
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %t) #4
store i32 1001, ptr %t, align 16, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %T)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not28 = icmp slt i32 %0, 1
br i1 %cmp.not28, label %if.then16, label %for.body
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %entry ]
%w.030 = phi i32 [ %w.1, %for.inc ], [ 1001, %entry ]
%arrayidx1 = getelementptr inbounds [101 x i32], ptr %c, i64 0, i64 %indvars.iv
%arrayidx3 = getelementptr inbounds [101 x i32], ptr %t, i64 0, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx3)
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%2 = load i32, ptr %T, align 4, !tbaa !5
%cmp7.not = icmp sgt i32 %1, %2
br i1 %cmp7.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%3 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%spec.select = call i32 @llvm.smin.i32(i32 %3, i32 %w.030)
br label %for.inc
for.inc: ; preds = %if.then, %for.body
%w.1 = phi i32 [ %w.030, %for.body ], [ %spec.select, %if.then ]
%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.not.not = icmp slt i64 %indvars.iv, %5
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc
%cmp15 = icmp eq i32 %w.1, 1001
br i1 %cmp15, label %if.then16, label %if.else
if.then16: ; preds = %entry, %for.end
%call17 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end19
if.else: ; preds = %for.end
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %w.1)
br label %if.end19
if.end19: ; preds = %if.else, %if.then16
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #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 @puts(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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(void){
int N,T;
scanf("%d %d", &N, &T);
int *A, *B;
A = (int*)malloc(N*sizeof(int));
B = (int*)malloc(N*sizeof(int));
for(int i=0; i<N; i++){
scanf("%d %d", &A[i], &B[i]);
}
int ans=1001;
for(int i=0; i<N; i++){
if(B[i]<=T && A[i]<ans){
ans = A[i];
}
}
if(ans==1001){
printf("TLE\n");
}else{
printf("%d\n", ans);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188435/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188435/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [4 x i8] c"TLE\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%T = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %T)
%0 = load i32, ptr %N, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #7
%call4 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp46 = icmp sgt i32 %0, 0
br i1 %cmp46, label %for.body, label %if.then30
for.cond10.preheader: ; preds = %for.body
%cmp1148 = icmp sgt i32 %3, 0
br i1 %cmp1148, label %for.body14.lr.ph, label %if.then30
for.body14.lr.ph: ; preds = %for.cond10.preheader
%1 = load i32, ptr %T, align 4, !tbaa !5
%wide.trip.count = zext i32 %3 to i64
%xtraiter = and i64 %wide.trip.count, 1
%2 = icmp eq i32 %3, 1
br i1 %2, label %for.cond.cleanup13.unr-lcssa, label %for.body14.lr.ph.new
for.body14.lr.ph.new: ; preds = %for.body14.lr.ph
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body14
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
%arrayidx7 = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx, ptr noundef %arrayidx7)
%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.cond10.preheader, !llvm.loop !9
for.cond.cleanup13.unr-lcssa: ; preds = %for.inc25.1, %for.body14.lr.ph
%ans.1.lcssa.ph = phi i32 [ undef, %for.body14.lr.ph ], [ %ans.1.1, %for.inc25.1 ]
%indvars.iv54.unr = phi i64 [ 0, %for.body14.lr.ph ], [ %indvars.iv.next55.1, %for.inc25.1 ]
%ans.049.unr = phi i32 [ 1001, %for.body14.lr.ph ], [ %ans.1.1, %for.inc25.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup13, label %for.body14.epil
for.body14.epil: ; preds = %for.cond.cleanup13.unr-lcssa
%arrayidx16.epil = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv54.unr
%5 = load i32, ptr %arrayidx16.epil, align 4, !tbaa !5
%cmp17.not.epil = icmp sgt i32 %5, %1
br i1 %cmp17.not.epil, label %for.cond.cleanup13, label %land.lhs.true.epil
land.lhs.true.epil: ; preds = %for.body14.epil
%arrayidx20.epil = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv54.unr
%6 = load i32, ptr %arrayidx20.epil, align 4, !tbaa !5
%spec.select.epil = call i32 @llvm.smin.i32(i32 %6, i32 %ans.049.unr)
br label %for.cond.cleanup13
for.cond.cleanup13: ; preds = %for.body14.epil, %land.lhs.true.epil, %for.cond.cleanup13.unr-lcssa
%ans.1.lcssa = phi i32 [ %ans.1.lcssa.ph, %for.cond.cleanup13.unr-lcssa ], [ %ans.049.unr, %for.body14.epil ], [ %spec.select.epil, %land.lhs.true.epil ]
%cmp28 = icmp eq i32 %ans.1.lcssa, 1001
br i1 %cmp28, label %if.then30, label %if.else
for.body14: ; preds = %for.inc25.1, %for.body14.lr.ph.new
%indvars.iv54 = phi i64 [ 0, %for.body14.lr.ph.new ], [ %indvars.iv.next55.1, %for.inc25.1 ]
%ans.049 = phi i32 [ 1001, %for.body14.lr.ph.new ], [ %ans.1.1, %for.inc25.1 ]
%niter = phi i64 [ 0, %for.body14.lr.ph.new ], [ %niter.next.1, %for.inc25.1 ]
%arrayidx16 = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv54
%7 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%cmp17.not = icmp sgt i32 %7, %1
br i1 %cmp17.not, label %for.inc25, label %land.lhs.true
land.lhs.true: ; preds = %for.body14
%arrayidx20 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv54
%8 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%spec.select = call i32 @llvm.smin.i32(i32 %8, i32 %ans.049)
br label %for.inc25
for.inc25: ; preds = %land.lhs.true, %for.body14
%ans.1 = phi i32 [ %ans.049, %for.body14 ], [ %spec.select, %land.lhs.true ]
%indvars.iv.next55 = or i64 %indvars.iv54, 1
%arrayidx16.1 = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv.next55
%9 = load i32, ptr %arrayidx16.1, align 4, !tbaa !5
%cmp17.not.1 = icmp sgt i32 %9, %1
br i1 %cmp17.not.1, label %for.inc25.1, label %land.lhs.true.1
land.lhs.true.1: ; preds = %for.inc25
%arrayidx20.1 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next55
%10 = load i32, ptr %arrayidx20.1, align 4, !tbaa !5
%spec.select.1 = call i32 @llvm.smin.i32(i32 %10, i32 %ans.1)
br label %for.inc25.1
for.inc25.1: ; preds = %land.lhs.true.1, %for.inc25
%ans.1.1 = phi i32 [ %ans.1, %for.inc25 ], [ %spec.select.1, %land.lhs.true.1 ]
%indvars.iv.next55.1 = add nuw nsw i64 %indvars.iv54, 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.cond.cleanup13.unr-lcssa, label %for.body14, !llvm.loop !11
if.then30: ; preds = %entry, %for.cond10.preheader, %for.cond.cleanup13
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end33
if.else: ; preds = %for.cond.cleanup13
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.1.lcssa)
br label %if.end33
if.end33: ; preds = %if.else, %if.then30
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %T) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
/* 全体でO((N+Q)√N) */
int main() {
long N, L, Q, B;
long x[100001];
long i, j, k;
long a, b, tmp;
long move1day[100001];
long moveBday[100001] = {0};
long right;
long ans[100001] = {0};
scanf("%ld", &N);
B = sqrt(N);
for(i=1;i<=N;i++) scanf("%ld", &x[i]);
scanf("%ld", &L);
scanf("%ld", &Q);
/* 各ホテルから1日でどこまでいけるか計算 O(N) */
right = 2;
for(i=1;i<=N;i++) {
for(j=right;j<=N;j++) {
if(x[j] - x[i] > L) {
j--;
break;
}
}
move1day[i] = j;
right = j;
}
/* 各ホテルから√N日でどこまでいけるか計算 O(N√N) */
for(i=1;i<=N;i++) {
k = i;
for(j=0;j<B;j++) {
if(k >= N) break;
k = move1day[k];
}
if(j == B) moveBday[i] = k;
}
/* O(Q√N) */
for(i=1;i<=Q;i++) {
scanf("%ld %ld", &a, &b);
if(a > b) { tmp = a; a = b; b = tmp; }
/* まず√N日ずつ移動 */
j = a;
while(moveBday[j] > 0 && moveBday[j] < b) {
j = moveBday[j];
ans[i] += B;
}
/* 次に1日ずつ移動 */
while(j < b) {
j = move1day[j];
ans[i]++;
}
}
for(i=1;i<=Q;i++) printf("%ld\n", ans[i]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188529/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188529/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [8 x i8] c"%ld %ld\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
%L = alloca i64, align 8
%Q = alloca i64, align 8
%x = alloca [100001 x i64], align 16
%a = alloca i64, align 8
%b = alloca i64, align 8
%move1day = alloca [100001 x i64], align 16
%moveBday = alloca [100001 x i64], align 16
%ans = alloca [100001 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %L) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %Q) #5
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %move1day) #5
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %moveBday) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800008) %moveBday, i8 0, i64 800008, i1 false)
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %ans) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800008) %ans, i8 0, i64 800008, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !5
%conv = sitofp i64 %0 to double
%call1 = call double @sqrt(double noundef %conv) #5
%conv2 = fptosi double %call1 to i64
%conv2.fr = freeze i64 %conv2
%1 = load i64, ptr %N, align 8, !tbaa !5
%cmp.not126 = icmp slt i64 %1, 1
br i1 %cmp.not126, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%i.0127 = phi i64 [ %inc, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100001 x i64], ptr %x, i64 0, i64 %i.0127
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.0127, 1
%2 = load i64, ptr %N, align 8, !tbaa !5
%cmp.not.not = icmp slt i64 %i.0127, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %L)
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %Q)
%3 = load i64, ptr %N, align 8
%cmp8.not130 = icmp slt i64 %3, 1
br i1 %cmp8.not130, label %for.cond50.preheader, label %for.cond11.preheader.lr.ph
for.cond11.preheader.lr.ph: ; preds = %for.end
%4 = load i64, ptr %L, align 8
%5 = add nuw i64 %3, 1
br label %for.cond11.preheader
for.cond11.preheader: ; preds = %for.cond11.preheader.lr.ph, %for.end21
%right.0133 = phi i64 [ 2, %for.cond11.preheader.lr.ph ], [ %j.1, %for.end21 ]
%i.1131 = phi i64 [ 1, %for.cond11.preheader.lr.ph ], [ %inc24, %for.end21 ]
%cmp12.not128 = icmp sgt i64 %right.0133, %3
br i1 %cmp12.not128, label %for.end21, label %for.body14.lr.ph
for.body14.lr.ph: ; preds = %for.cond11.preheader
%arrayidx16 = getelementptr inbounds [100001 x i64], ptr %x, i64 0, i64 %i.1131
%6 = load i64, ptr %arrayidx16, align 8, !tbaa !5
br label %for.body14
for.cond26.preheader: ; preds = %for.end21
br i1 %cmp8.not130, label %for.cond50.preheader, label %for.cond30.preheader.lr.ph
for.cond30.preheader.lr.ph: ; preds = %for.cond26.preheader
%cmp31135 = icmp sgt i64 %conv2.fr, 0
br i1 %cmp31135, label %for.cond30.preheader, label %for.cond30.preheader.lr.ph.split.us
for.cond30.preheader.lr.ph.split.us: ; preds = %for.cond30.preheader.lr.ph
%cmp42.us = icmp eq i64 %conv2.fr, 0
br i1 %cmp42.us, label %for.cond30.preheader.us.us.preheader, label %for.cond50.preheader
for.cond30.preheader.us.us.preheader: ; preds = %for.cond30.preheader.lr.ph.split.us
%min.iters.check = icmp ult i64 %3, 4
br i1 %min.iters.check, label %for.cond30.preheader.us.us.preheader177, label %vector.ph
vector.ph: ; preds = %for.cond30.preheader.us.us.preheader
%n.vec = and i64 %3, -4
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <2 x i64> [ <i64 1, i64 2>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <2 x i64> %vec.ind, <i64 2, i64 2>
%offset.idx = or i64 %index, 1
%7 = getelementptr inbounds [100001 x i64], ptr %moveBday, i64 0, i64 %offset.idx
store <2 x i64> %vec.ind, ptr %7, align 8, !tbaa !5
%8 = getelementptr inbounds i64, ptr %7, i64 2
store <2 x i64> %step.add, ptr %8, align 8, !tbaa !5
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
%9 = icmp eq i64 %index.next, %n.vec
br i1 %9, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %3, %n.vec
br i1 %cmp.n, label %for.cond50.preheader, label %for.cond30.preheader.us.us.preheader177
for.cond30.preheader.us.us.preheader177: ; preds = %for.cond30.preheader.us.us.preheader, %middle.block
%i.2143.us.us.ph = phi i64 [ 1, %for.cond30.preheader.us.us.preheader ], [ %ind.end, %middle.block ]
br label %for.cond30.preheader.us.us
for.cond30.preheader.us.us: ; preds = %for.cond30.preheader.us.us.preheader177, %for.cond30.preheader.us.us
%i.2143.us.us = phi i64 [ %inc48.us.us, %for.cond30.preheader.us.us ], [ %i.2143.us.us.ph, %for.cond30.preheader.us.us.preheader177 ]
%arrayidx45.us.us = getelementptr inbounds [100001 x i64], ptr %moveBday, i64 0, i64 %i.2143.us.us
store i64 %i.2143.us.us, ptr %arrayidx45.us.us, align 8, !tbaa !5
%inc48.us.us = add nuw i64 %i.2143.us.us, 1
%exitcond163.not = icmp eq i64 %i.2143.us.us, %3
br i1 %exitcond163.not, label %for.cond50.preheader, label %for.cond30.preheader.us.us, !llvm.loop !14
for.body14: ; preds = %for.body14.lr.ph, %for.inc19
%j.0129 = phi i64 [ %right.0133, %for.body14.lr.ph ], [ %inc20, %for.inc19 ]
%arrayidx15 = getelementptr inbounds [100001 x i64], ptr %x, i64 0, i64 %j.0129
%10 = load i64, ptr %arrayidx15, align 8, !tbaa !5
%sub = sub nsw i64 %10, %6
%cmp17 = icmp sgt i64 %sub, %4
br i1 %cmp17, label %if.then, label %for.inc19
if.then: ; preds = %for.body14
%dec = add nsw i64 %j.0129, -1
br label %for.end21
for.inc19: ; preds = %for.body14
%inc20 = add i64 %j.0129, 1
%exitcond.not = icmp eq i64 %j.0129, %3
br i1 %exitcond.not, label %for.end21, label %for.body14, !llvm.loop !15
for.end21: ; preds = %for.inc19, %for.cond11.preheader, %if.then
%j.1 = phi i64 [ %dec, %if.then ], [ %right.0133, %for.cond11.preheader ], [ %5, %for.inc19 ]
%arrayidx22 = getelementptr inbounds [100001 x i64], ptr %move1day, i64 0, i64 %i.1131
store i64 %j.1, ptr %arrayidx22, align 8, !tbaa !5
%inc24 = add nuw i64 %i.1131, 1
%exitcond162.not = icmp eq i64 %i.1131, %3
br i1 %exitcond162.not, label %for.cond26.preheader, label %for.cond11.preheader, !llvm.loop !16
for.cond30.preheader: ; preds = %for.cond30.preheader.lr.ph, %for.inc47
%i.2143 = phi i64 [ %inc48, %for.inc47 ], [ 1, %for.cond30.preheader.lr.ph ]
%cmp34.not136 = icmp slt i64 %i.2143, %3
br i1 %cmp34.not136, label %if.end37, label %for.end41
for.cond50.preheader: ; preds = %for.cond30.preheader.us.us, %for.inc47, %middle.block, %for.end, %for.cond30.preheader.lr.ph.split.us, %for.cond26.preheader
%11 = load i64, ptr %Q, align 8, !tbaa !5
%cmp51.not154 = icmp slt i64 %11, 1
br i1 %cmp51.not154, label %for.end86, label %for.body53
if.end37: ; preds = %for.cond30.preheader, %if.end37
%k.0139 = phi i64 [ %12, %if.end37 ], [ %i.2143, %for.cond30.preheader ]
%j.2138 = phi i64 [ %inc40, %if.end37 ], [ 0, %for.cond30.preheader ]
%arrayidx38 = getelementptr inbounds [100001 x i64], ptr %move1day, i64 0, i64 %k.0139
%12 = load i64, ptr %arrayidx38, align 8, !tbaa !5
%inc40 = add nuw nsw i64 %j.2138, 1
%cmp31 = icmp slt i64 %inc40, %conv2.fr
%cmp34.not = icmp slt i64 %12, %3
%or.cond = select i1 %cmp31, i1 %cmp34.not, i1 false
br i1 %or.cond, label %if.end37, label %for.end41, !llvm.loop !17
for.end41: ; preds = %if.end37, %for.cond30.preheader
%j.2.lcssa = phi i64 [ 0, %for.cond30.preheader ], [ %inc40, %if.end37 ]
%k.0.lcssa = phi i64 [ %i.2143, %for.cond30.preheader ], [ %12, %if.end37 ]
%cmp42 = icmp eq i64 %j.2.lcssa, %conv2.fr
br i1 %cmp42, label %if.then44, label %for.inc47
if.then44: ; preds = %for.end41
%arrayidx45 = getelementptr inbounds [100001 x i64], ptr %moveBday, i64 0, i64 %i.2143
store i64 %k.0.lcssa, ptr %arrayidx45, align 8, !tbaa !5
br label %for.inc47
for.inc47: ; preds = %for.end41, %if.then44
%inc48 = add nuw i64 %i.2143, 1
%exitcond164.not = icmp eq i64 %i.2143, %3
br i1 %exitcond164.not, label %for.cond50.preheader, label %for.cond30.preheader, !llvm.loop !18
for.cond78.preheader: ; preds = %for.inc75
%13 = icmp slt i64 %22, 1
br i1 %13, label %for.end86, label %for.body81
for.body53: ; preds = %for.cond50.preheader, %for.inc75
%i.3155 = phi i64 [ %inc76, %for.inc75 ], [ 1, %for.cond50.preheader ]
%call54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%14 = load i64, ptr %a, align 8, !tbaa !5
%15 = load i64, ptr %b, align 8
%cmp55 = icmp sgt i64 %14, %15
br i1 %cmp55, label %if.then57, label %if.end58
if.then57: ; preds = %for.body53
store i64 %15, ptr %a, align 8, !tbaa !5
store i64 %14, ptr %b, align 8, !tbaa !5
br label %if.end58
if.end58: ; preds = %if.then57, %for.body53
%16 = phi i64 [ %14, %if.then57 ], [ %15, %for.body53 ]
%17 = phi i64 [ %15, %if.then57 ], [ %14, %for.body53 ]
%arrayidx59144 = getelementptr inbounds [100001 x i64], ptr %moveBday, i64 0, i64 %17
%18 = load i64, ptr %arrayidx59144, align 8, !tbaa !5
%cmp60145 = icmp sgt i64 %18, 0
%cmp63146 = icmp slt i64 %18, %16
%or.cond123147 = and i1 %cmp60145, %cmp63146
br i1 %or.cond123147, label %while.body.lr.ph, label %while.cond67.preheader
while.body.lr.ph: ; preds = %if.end58
%arrayidx66 = getelementptr inbounds [100001 x i64], ptr %ans, i64 0, i64 %i.3155
%arrayidx66.promoted = load i64, ptr %arrayidx66, align 8, !tbaa !5
br label %while.body
while.cond.while.cond67.preheader_crit_edge: ; preds = %while.body
store i64 %add, ptr %arrayidx66, align 8, !tbaa !5
br label %while.cond67.preheader
while.cond67.preheader: ; preds = %while.cond.while.cond67.preheader_crit_edge, %if.end58
%j.3.lcssa = phi i64 [ %19, %while.cond.while.cond67.preheader_crit_edge ], [ %17, %if.end58 ]
%cmp68151 = icmp slt i64 %j.3.lcssa, %16
br i1 %cmp68151, label %while.body70.lr.ph, label %for.inc75
while.body70.lr.ph: ; preds = %while.cond67.preheader
%arrayidx72 = getelementptr inbounds [100001 x i64], ptr %ans, i64 0, i64 %i.3155
%arrayidx72.promoted = load i64, ptr %arrayidx72, align 8, !tbaa !5
br label %while.body70
while.body: ; preds = %while.body.lr.ph, %while.body
%add150 = phi i64 [ %arrayidx66.promoted, %while.body.lr.ph ], [ %add, %while.body ]
%19 = phi i64 [ %18, %while.body.lr.ph ], [ %20, %while.body ]
%add = add nsw i64 %add150, %conv2.fr
%arrayidx59 = getelementptr inbounds [100001 x i64], ptr %moveBday, i64 0, i64 %19
%20 = load i64, ptr %arrayidx59, align 8, !tbaa !5
%cmp60 = icmp sgt i64 %20, 0
%cmp63 = icmp slt i64 %20, %16
%or.cond123 = and i1 %cmp60, %cmp63
br i1 %or.cond123, label %while.body, label %while.cond.while.cond67.preheader_crit_edge, !llvm.loop !19
while.body70: ; preds = %while.body70.lr.ph, %while.body70
%inc73153 = phi i64 [ %arrayidx72.promoted, %while.body70.lr.ph ], [ %inc73, %while.body70 ]
%j.4152 = phi i64 [ %j.3.lcssa, %while.body70.lr.ph ], [ %21, %while.body70 ]
%arrayidx71 = getelementptr inbounds [100001 x i64], ptr %move1day, i64 0, i64 %j.4152
%21 = load i64, ptr %arrayidx71, align 8, !tbaa !5
%inc73 = add nsw i64 %inc73153, 1
%cmp68 = icmp slt i64 %21, %16
br i1 %cmp68, label %while.body70, label %while.cond67.for.inc75_crit_edge, !llvm.loop !20
while.cond67.for.inc75_crit_edge: ; preds = %while.body70
store i64 %inc73, ptr %arrayidx72, align 8, !tbaa !5
br label %for.inc75
for.inc75: ; preds = %while.cond67.for.inc75_crit_edge, %while.cond67.preheader
%inc76 = add nuw nsw i64 %i.3155, 1
%22 = load i64, ptr %Q, align 8, !tbaa !5
%cmp51.not.not = icmp slt i64 %i.3155, %22
br i1 %cmp51.not.not, label %for.body53, label %for.cond78.preheader, !llvm.loop !21
for.body81: ; preds = %for.cond78.preheader, %for.body81
%i.4157 = phi i64 [ %inc85, %for.body81 ], [ 1, %for.cond78.preheader ]
%arrayidx82 = getelementptr inbounds [100001 x i64], ptr %ans, i64 0, i64 %i.4157
%23 = load i64, ptr %arrayidx82, align 8, !tbaa !5
%call83 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %23)
%inc85 = add nuw nsw i64 %i.4157, 1
%24 = load i64, ptr %Q, align 8, !tbaa !5
%cmp79.not.not = icmp slt i64 %i.4157, %24
br i1 %cmp79.not.not, label %for.body81, label %for.end86, !llvm.loop !22
for.end86: ; preds = %for.body81, %for.cond50.preheader, %for.cond78.preheader
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %ans) #5
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %moveBday) #5
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %move1day) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %Q) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %L) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: 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 = !{!"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}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
|
#include<stdio.h>
#include<math.h>
int main(){
int a,b,h;
scanf("%d%d%d",&a,&b,&h);
printf("%d",(a+b)*h/2);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188587/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188587/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%h = alloca i32, align 4
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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %h)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %h, align 4, !tbaa !5
%mul = mul nsw i32 %add, %2
%div = sdiv i32 %mul, 2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
int main(void)
{
int n;
char s[55];
scanf("%d",&n);
while(n--)
{
int i = 0;
memset(s,0,sizeof(s[0]));
scanf(" %s",s);
for(i = 0;s[i];i++)
{
if((i%2==0)&&(s[i]!='a'))
{
s[i] = 'a';
}
else if((i%2==0)&&(s[i]=='a'))
{
s[i] = 'b';
}
if((i%2==1)&&(s[i]!='z'))
{
s[i] = 'z';
}
else if((i%2==1)&&(s[i]=='z'))
{
s[i] = 'y';
}
}
printf("%s\n",s);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18863/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18863/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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" %s\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 [55 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 55, 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
%dec68 = add nsw i32 %0, -1
store i32 %dec68, ptr %n, align 4, !tbaa !5
%tobool.not69 = icmp eq i32 %0, 0
br i1 %tobool.not69, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
store i8 0, ptr %s, align 16
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%1 = load i8, ptr %s, align 16, !tbaa !9
%tobool3.not65 = icmp eq i8 %1, 0
br i1 %tobool3.not65, label %for.end, label %for.body
for.body: ; preds = %while.body, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %while.body ]
%2 = phi i8 [ %3, %for.inc ], [ %1, %while.body ]
%arrayidx67 = phi ptr [ %arrayidx, %for.inc ], [ %s, %while.body ]
%rem70 = and i64 %indvars.iv, 1
%cmp = icmp ne i64 %rem70, 0
%cmp6.not = icmp eq i8 %2, 97
%or.cond = or i1 %cmp, %cmp6.not
br i1 %or.cond, label %if.else, label %for.inc.sink.split
if.else: ; preds = %for.body
br i1 %cmp, label %land.lhs.true26, label %land.lhs.true13
land.lhs.true13: ; preds = %if.else
br i1 %cmp6.not, label %for.inc.sink.split, label %for.inc
land.lhs.true26: ; preds = %if.else
%cmp30.not = icmp eq i8 %2, 122
%. = select i1 %cmp30.not, i8 121, i8 122
br label %for.inc.sink.split
for.inc.sink.split: ; preds = %land.lhs.true26, %land.lhs.true13, %for.body
%.sink = phi i8 [ 97, %for.body ], [ 98, %land.lhs.true13 ], [ %., %land.lhs.true26 ]
store i8 %.sink, ptr %arrayidx67, align 1, !tbaa !9
br label %for.inc
for.inc: ; preds = %for.inc.sink.split, %land.lhs.true13
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [55 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx, align 1, !tbaa !9
%tobool3.not = icmp eq i8 %3, 0
br i1 %tobool3.not, label %for.end, label %for.body, !llvm.loop !10
for.end: ; preds = %for.inc, %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %s)
%4 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 55, 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include<stdio.h>
int main()
{
int a,b,h;
int s;
scanf("%d\n%d\n%d",&a,&b,&h);
s=(a+b)*h/2;
printf("%d",s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188673/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188673/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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\0A%d\0A%d\00", align 1
@.str.1 = 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:
%a = alloca i32, align 4
%b = alloca i32, align 4
%h = 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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %h)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %h, align 4, !tbaa !5
%mul = mul nsw i32 %add, %2
%div = sdiv i32 %mul, 2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int a,b,h,S=0;
scanf("%d%d%d",&a,&b,&h);
S=(a+b)*h/2;
printf("%d",S);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188716/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188716/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%h = alloca i32, align 4
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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %h)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %h, align 4, !tbaa !5
%mul = mul nsw i32 %add, %2
%div = sdiv i32 %mul, 2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int a, b, h;
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &h);
printf("%d\n", (a + b) * h / 2);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188767/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188767/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%h = 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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %h, align 4, !tbaa !5
%mul = mul nsw i32 %add, %2
%div = sdiv i32 %mul, 2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int a,b,h;
scanf("%d%d%d",&a,&b,&h);
printf("%d",(a+b)*h/2);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188860/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188860/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%h = alloca i32, align 4
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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %h)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %h, align 4, !tbaa !5
%mul = mul nsw i32 %add, %2
%div = sdiv i32 %mul, 2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int a, b, h;
scanf("%d%d%d", &a, &b, &h);
printf("%d\n", (a + b) * h / 2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188910/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188910/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%h = 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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %h)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %h, align 4, !tbaa !5
%mul = mul nsw i32 %add, %2
%div = sdiv i32 %mul, 2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
int i;
int atai[3];
for (i = 0; i < 3; i++) {
char num[5];
scanf("%s",&num);
atai[i] = atoi(num);
}
int ans;
ans = (atai[0] + atai[1]) * atai[2] / 2;
printf("%d\n",ans);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_188961/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_188961/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%num = alloca [5 x i8], align 1
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %num) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %num, ptr noundef null, i32 noundef 10) #4
%conv.i = trunc i64 %call.i to i32
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %num) #4
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %num) #4
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%call.i.1 = call i64 @strtol(ptr nocapture noundef nonnull %num, ptr noundef null, i32 noundef 10) #4
%conv.i.1 = trunc i64 %call.i.1 to i32
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %num) #4
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %num) #4
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%call.i.2 = call i64 @strtol(ptr nocapture noundef nonnull %num, ptr noundef null, i32 noundef 10) #4
%conv.i.2 = trunc i64 %call.i.2 to i32
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %num) #4
%add = add nsw i32 %conv.i.1, %conv.i
%mul = mul nsw i32 %add, %conv.i.2
%div = sdiv i32 %mul, 2
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
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: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, 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 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main(void){
int a, b, h;
scanf("%d %d %d", &a, &b, &h);
int s = ((a + b) * h ) / 2.0;
printf("%d", s);
putchar('\n');
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189010/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189010/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%h = 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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %h)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %h, align 4, !tbaa !5
%mul = mul nsw i32 %add, %2
%conv = sitofp i32 %mul to double
%div = fmul double %conv, 5.000000e-01
%conv1 = fptosi double %div to i32
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv1)
%3 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i = call i32 @putc(i32 noundef 10, ptr noundef %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
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
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
char *flag;
int head,rear;
int *que;
int factorial[10];
int cal_factorial(int n) {
if(n == 0) return 1;
return cal_factorial(n-1)*n;
}
int stotag(char *s) {
int tag = 0;
int i;
for(i = 0; i < 9; i++) {
int t,j;
t = 0;
for(j = 0; j < i; j++) {
if(s[j] < s[i]) t++;
}
tag += factorial[8-i]*(s[i]-'0'-t);
}
return tag;
}
char *tagtos(int tag) {
int i;
char *s;
s = (char*)malloc(sizeof(char)*10);
for(i = 0; i < 9; i++) {
s[i] = tag%factorial[9-i]/factorial[8-i] + '0';
}
s[9] = '\0';
for(i = 7; i >= 0; i--) {
int j;
for(j = 8; j > i; j--) {
if(s[i] <= s[j]) s[j]++;
}
}
return s;
}
char *move_up(char s[], int x) {
if(x < 3) return NULL;
char *s_new;
s_new = (char*)malloc(sizeof(char)*10);
strcpy(s_new,s);
s_new[x] = s[x-3];
s_new[x-3] = s[x];
return s_new;
}
char *move_left(char s[], int x) {
if(x%3 == 0) return NULL;
char *s_new;
s_new = (char*)malloc(sizeof(char)*10);
strcpy(s_new,s);
s_new[x] = s[x-1];
s_new[x-1] = s[x];
return s_new;
}
char *move_right(char s[], int x) {
if(x%3 == 2) return NULL;
char *s_new;
s_new = (char*)malloc(sizeof(char)*10);
strcpy(s_new,s);
s_new[x] = s[x+1];
s_new[x+1] = s[x];
return s_new;
}
char *move_down(char s[], int x) {
if(x > 5) return NULL;
char *s_new;
s_new = (char*)malloc(sizeof(char)*10);
strcpy(s_new,s);
s_new[x] = s[x+3];
s_new[x+3] = s[x];
return s_new;
}
int create(char s[], int t) {
if(strcmp(s,"123456780") == 0) return t;
int tag = stotag(s);
if(flag[tag]) return 0;
flag[tag] = t;
que[rear] = tag;
rear++;
return 0;
}
int distance(char *s_new) {
char s[] = "123456780";
int i;
int sum = 0;
for(i = 0; i < 9; i++) {
int a = 0;
int b = 0;
while(s[a]-'0' != i) a++;
while(s_new[b]-'0' != i) b++;
sum += abs(a/3-b/3) + abs(a%3-b%3);
}
return sum;
}
int check_x(char *s) {
int i = 0;
while(s[i] != '0') i++;
return i;
}
int cal() {
char *s_right,*s_left,*s_up,*s_down;
int right,left,up,down,min;
int k,tag;
tag = que[head];
char *s = tagtos(tag);
int x = check_x(s);
if((s_right = move_right(s, x)) != NULL) {
right = distance(s_right);
if((k = create(s_right,flag[tag]+1))) return k;
}else{
right = INT_MAX;
}
if((s_left = move_left(s, x)) != NULL) {
left = distance(s_left);
if((k = create(s_left,flag[tag]+1))) return k;
}else{
left = INT_MAX;
}
if ((s_up = move_up(s, x)) != NULL) {
up = distance(s_up);
if((k = create(s_up,flag[tag]+1))) return k;
}else{
up = INT_MAX;
}
if((s_down = move_down(s, x)) != NULL) {
down = distance(s_down);
if((k = create(s_down,flag[tag]+1))) return k;
}else{
down = INT_MAX;
}
/*
min = right;
if(min > left) min = left;
if(min > up) min = up;
if(min > down) min = down;
if(right == min) {
if((k = create(s_right,flag[tag]+1))) return k;
}
if(left == min) {
if((k = create(s_left,flag[tag]+1))) return k;
}
if(up == min) {
if((k = create(s_up,flag[tag]+1))) return k;
}
if(down == min) {
if((k = create(s_down,flag[tag]+1))) return k;
}
*/
free(s);
if(s_right != NULL) free(s_right);
if(s_left != NULL) free(s_left);
if(s_up != NULL) free(s_up);
if(s_down != NULL) free(s_down);
head++;
return 0;
}
int solve(char s0[]) {
int k;
if((k = create(s0,1))) return k;
while(!(k = cal())) {
if(head == rear) break;
}
return k;
}
int main()
{
int i,d;
char s[10];
for(i = 0; i < 10; i++) factorial[i] = cal_factorial(i);
flag = (char*)malloc(sizeof(char)*factorial[9]);
memset(flag , 0, factorial[9]);
que = (int*)malloc(sizeof(int)*factorial[9]);
head = 0;
rear = 0;
for (i = 0; i < 9; i++) {
scanf("%d", &d);
s[i] = d+'0';
}
s[9] = '\0';
printf("%d\n",solve(s)-1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189054/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189054/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@factorial = dso_local local_unnamed_addr global [10 x i32] zeroinitializer, align 16
@flag = dso_local local_unnamed_addr global ptr null, align 8
@que = dso_local local_unnamed_addr global ptr null, align 8
@rear = dso_local local_unnamed_addr global i32 0, align 4
@__const.distance.s = private unnamed_addr constant [10 x i8] c"123456780\00", align 1
@head = dso_local local_unnamed_addr global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @cal_factorial(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp3 = icmp eq i32 %n, 0
br i1 %cmp3, label %return, label %if.end.preheader
if.end.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %if.end.preheader8, label %vector.ph
vector.ph: ; preds = %if.end.preheader
%n.vec = and i32 %n, -8
%ind.end = and i32 %n, 7
%.splatinsert = insertelement <4 x i32> poison, i32 %n, i64 0
%.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%induction = add <4 x i32> %.splat, <i32 0, i32 -1, i32 -2, i32 -3>
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ %induction, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi7 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 -4, i32 -4, i32 -4, i32 -4>
%0 = mul <4 x i32> %vec.ind, %vec.phi
%1 = mul <4 x i32> %step.add, %vec.phi7
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 -8, i32 -8, i32 -8, i32 -8>
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !5
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %n
br i1 %cmp.n, label %return, label %if.end.preheader8
if.end.preheader8: ; preds = %if.end.preheader, %middle.block
%n.tr5.ph = phi i32 [ %n, %if.end.preheader ], [ %ind.end, %middle.block ]
%accumulator.tr4.ph = phi i32 [ 1, %if.end.preheader ], [ %3, %middle.block ]
br label %if.end
if.end: ; preds = %if.end.preheader8, %if.end
%n.tr5 = phi i32 [ %sub, %if.end ], [ %n.tr5.ph, %if.end.preheader8 ]
%accumulator.tr4 = phi i32 [ %mul, %if.end ], [ %accumulator.tr4.ph, %if.end.preheader8 ]
%sub = add nsw i32 %n.tr5, -1
%mul = mul nsw i32 %n.tr5, %accumulator.tr4
%cmp = icmp eq i32 %sub, 0
br i1 %cmp, label %return, label %if.end, !llvm.loop !8
return: ; preds = %if.end, %middle.block, %entry
%accumulator.tr.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %if.end ]
ret i32 %accumulator.tr.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @stotag(ptr nocapture noundef readonly %s) local_unnamed_addr #1 {
for.end.8:
%0 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 8), align 16, !tbaa !9
%1 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 7), align 4, !tbaa !9
%2 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 6), align 8, !tbaa !9
%3 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 5), align 4, !tbaa !9
%4 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 4), align 16, !tbaa !9
%5 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 3), align 4, !tbaa !9
%6 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 2), align 8, !tbaa !9
%7 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 1), align 4, !tbaa !9
%arrayidx5.8 = getelementptr inbounds i8, ptr %s, i64 8
%8 = load i8, ptr %arrayidx5.8, align 1, !tbaa !13
%9 = load <8 x i8>, ptr %s, align 1, !tbaa !13
%10 = insertelement <8 x i8> poison, i8 %8, i64 0
%11 = shufflevector <8 x i8> %10, <8 x i8> poison, <8 x i32> zeroinitializer
%12 = icmp slt <8 x i8> %9, %11
%13 = extractelement <8 x i8> %9, i64 0
%14 = extractelement <8 x i8> %9, i64 7
%cmp7.7 = icmp slt i8 %13, %14
%inc.7.neg = sext i1 %cmp7.7 to i32
%15 = extractelement <8 x i8> %9, i64 1
%cmp7.7.1 = icmp slt i8 %15, %14
%inc.7.1.neg = sext i1 %cmp7.7.1 to i32
%spec.select.7.1.neg = add nsw i32 %inc.7.neg, %inc.7.1.neg
%16 = extractelement <8 x i8> %9, i64 2
%cmp7.7.2 = icmp slt i8 %16, %14
%inc.7.2.neg = sext i1 %cmp7.7.2 to i32
%spec.select.7.2.neg = add nsw i32 %spec.select.7.1.neg, %inc.7.2.neg
%17 = extractelement <8 x i8> %9, i64 3
%cmp7.7.3 = icmp slt i8 %17, %14
%inc.7.3.neg = sext i1 %cmp7.7.3 to i32
%spec.select.7.3.neg = add nsw i32 %spec.select.7.2.neg, %inc.7.3.neg
%18 = extractelement <8 x i8> %9, i64 4
%cmp7.7.4 = icmp slt i8 %18, %14
%inc.7.4.neg = sext i1 %cmp7.7.4 to i32
%spec.select.7.4.neg = add nsw i32 %spec.select.7.3.neg, %inc.7.4.neg
%19 = extractelement <8 x i8> %9, i64 5
%cmp7.7.5 = icmp slt i8 %19, %14
%inc.7.5.neg = sext i1 %cmp7.7.5 to i32
%spec.select.7.5.neg = add nsw i32 %spec.select.7.4.neg, %inc.7.5.neg
%20 = extractelement <8 x i8> %9, i64 6
%cmp7.7.6 = icmp slt i8 %20, %14
%inc.7.6.neg = sext i1 %cmp7.7.6 to i32
%spec.select.7.6.neg = add nsw i32 %spec.select.7.5.neg, %inc.7.6.neg
%conv14.7 = sext i8 %14 to i32
%reass.sub.7 = add nsw i32 %spec.select.7.6.neg, %conv14.7
%sub16.7 = add nsw i32 %reass.sub.7, -48
%mul.7 = mul nsw i32 %sub16.7, %7
%cmp7.6 = icmp slt i8 %13, %20
%inc.6.neg = sext i1 %cmp7.6 to i32
%cmp7.6.1 = icmp slt i8 %15, %20
%inc.6.1.neg = sext i1 %cmp7.6.1 to i32
%spec.select.6.1.neg = add nsw i32 %inc.6.neg, %inc.6.1.neg
%cmp7.6.2 = icmp slt i8 %16, %20
%inc.6.2.neg = sext i1 %cmp7.6.2 to i32
%spec.select.6.2.neg = add nsw i32 %spec.select.6.1.neg, %inc.6.2.neg
%cmp7.6.3 = icmp slt i8 %17, %20
%inc.6.3.neg = sext i1 %cmp7.6.3 to i32
%spec.select.6.3.neg = add nsw i32 %spec.select.6.2.neg, %inc.6.3.neg
%cmp7.6.4 = icmp slt i8 %18, %20
%inc.6.4.neg = sext i1 %cmp7.6.4 to i32
%spec.select.6.4.neg = add nsw i32 %spec.select.6.3.neg, %inc.6.4.neg
%cmp7.6.5 = icmp slt i8 %19, %20
%inc.6.5.neg = sext i1 %cmp7.6.5 to i32
%spec.select.6.5.neg = add nsw i32 %spec.select.6.4.neg, %inc.6.5.neg
%conv14.6 = sext i8 %20 to i32
%reass.sub.6 = add nsw i32 %spec.select.6.5.neg, %conv14.6
%sub16.6 = add nsw i32 %reass.sub.6, -48
%mul.6 = mul nsw i32 %sub16.6, %6
%cmp7.5 = icmp slt i8 %13, %19
%inc.5.neg = sext i1 %cmp7.5 to i32
%cmp7.5.1 = icmp slt i8 %15, %19
%inc.5.1.neg = sext i1 %cmp7.5.1 to i32
%spec.select.5.1.neg = add nsw i32 %inc.5.neg, %inc.5.1.neg
%cmp7.5.2 = icmp slt i8 %16, %19
%inc.5.2.neg = sext i1 %cmp7.5.2 to i32
%spec.select.5.2.neg = add nsw i32 %spec.select.5.1.neg, %inc.5.2.neg
%cmp7.5.3 = icmp slt i8 %17, %19
%inc.5.3.neg = sext i1 %cmp7.5.3 to i32
%spec.select.5.3.neg = add nsw i32 %spec.select.5.2.neg, %inc.5.3.neg
%cmp7.5.4 = icmp slt i8 %18, %19
%inc.5.4.neg = sext i1 %cmp7.5.4 to i32
%spec.select.5.4.neg = add nsw i32 %spec.select.5.3.neg, %inc.5.4.neg
%conv14.5 = sext i8 %19 to i32
%reass.sub.5 = add nsw i32 %spec.select.5.4.neg, %conv14.5
%sub16.5 = add nsw i32 %reass.sub.5, -48
%mul.5 = mul nsw i32 %sub16.5, %5
%cmp7.4 = icmp slt i8 %13, %18
%inc.4.neg = sext i1 %cmp7.4 to i32
%cmp7.4.1 = icmp slt i8 %15, %18
%inc.4.1.neg = sext i1 %cmp7.4.1 to i32
%spec.select.4.1.neg = add nsw i32 %inc.4.neg, %inc.4.1.neg
%cmp7.4.2 = icmp slt i8 %16, %18
%inc.4.2.neg = sext i1 %cmp7.4.2 to i32
%spec.select.4.2.neg = add nsw i32 %spec.select.4.1.neg, %inc.4.2.neg
%cmp7.4.3 = icmp slt i8 %17, %18
%inc.4.3.neg = sext i1 %cmp7.4.3 to i32
%spec.select.4.3.neg = add nsw i32 %spec.select.4.2.neg, %inc.4.3.neg
%conv14.4 = sext i8 %18 to i32
%reass.sub.4 = add nsw i32 %spec.select.4.3.neg, %conv14.4
%sub16.4 = add nsw i32 %reass.sub.4, -48
%mul.4 = mul nsw i32 %sub16.4, %4
%cmp7.3 = icmp slt i8 %13, %17
%inc.3.neg = sext i1 %cmp7.3 to i32
%cmp7.3.1 = icmp slt i8 %15, %17
%inc.3.1.neg = sext i1 %cmp7.3.1 to i32
%spec.select.3.1.neg = add nsw i32 %inc.3.neg, %inc.3.1.neg
%cmp7.3.2 = icmp slt i8 %16, %17
%inc.3.2.neg = sext i1 %cmp7.3.2 to i32
%spec.select.3.2.neg = add nsw i32 %spec.select.3.1.neg, %inc.3.2.neg
%conv14.3 = sext i8 %17 to i32
%reass.sub.3 = add nsw i32 %spec.select.3.2.neg, %conv14.3
%sub16.3 = add nsw i32 %reass.sub.3, -48
%mul.3 = mul nsw i32 %sub16.3, %3
%cmp7.2 = icmp slt i8 %13, %16
%inc.2.neg = sext i1 %cmp7.2 to i32
%cmp7.2.1 = icmp slt i8 %15, %16
%inc.2.1.neg = sext i1 %cmp7.2.1 to i32
%spec.select.2.1.neg = add nsw i32 %inc.2.neg, %inc.2.1.neg
%conv14.2 = sext i8 %16 to i32
%reass.sub.2 = add nsw i32 %spec.select.2.1.neg, %conv14.2
%sub16.2 = add nsw i32 %reass.sub.2, -48
%mul.2 = mul nsw i32 %sub16.2, %2
%cmp7.1 = icmp slt i8 %13, %15
%inc.1.neg = sext i1 %cmp7.1 to i32
%conv14.1 = sext i8 %15 to i32
%reass.sub.1 = add nsw i32 %inc.1.neg, %conv14.1
%sub16.1 = add nsw i32 %reass.sub.1, -48
%mul.1 = mul nsw i32 %sub16.1, %1
%conv14 = sext i8 %13 to i32
%sub16 = add nsw i32 %conv14, -48
%mul = mul nsw i32 %sub16, %0
%add.1 = add nsw i32 %mul.1, %mul
%add.2 = add nsw i32 %mul.2, %add.1
%add.3 = add nsw i32 %mul.3, %add.2
%add.4 = add nsw i32 %mul.4, %add.3
%add.5 = add nsw i32 %mul.5, %add.4
%add.6 = add nsw i32 %mul.6, %add.5
%add.7 = add nsw i32 %mul.7, %add.6
%21 = load i32, ptr @factorial, align 16, !tbaa !9
%conv14.8 = sext i8 %8 to i32
%22 = bitcast <8 x i1> %12 to i8
%23 = tail call i8 @llvm.ctpop.i8(i8 %22), !range !14
%24 = zext i8 %23 to i32
%reass.sub = sub nsw i32 %conv14.8, %24
%op.rdx50 = add nsw i32 %reass.sub, -48
%mul.8 = mul nsw i32 %op.rdx50, %21
%add.8 = add nsw i32 %mul.8, %add.7
ret i32 %add.8
}
; 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: mustprogress nofree nounwind willreturn memory(readwrite, argmem: none) uwtable
define dso_local noalias ptr @tagtos(i32 noundef %tag) local_unnamed_addr #3 {
for.body14.lr.ph:
%call = tail call noalias dereferenceable_or_null(10) ptr @malloc(i64 noundef 10) #18
%0 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 9), align 4, !tbaa !9
%rem = srem i32 %tag, %0
%1 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 8), align 16, !tbaa !9
%div = sdiv i32 %rem, %1
%2 = trunc i32 %div to i8
%conv = add i8 %2, 48
store i8 %conv, ptr %call, align 1, !tbaa !13
%rem.1 = srem i32 %tag, %1
%3 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 7), align 4, !tbaa !9
%div.1 = sdiv i32 %rem.1, %3
%4 = trunc i32 %div.1 to i8
%conv.1 = add i8 %4, 48
%arrayidx5.1 = getelementptr inbounds i8, ptr %call, i64 1
store i8 %conv.1, ptr %arrayidx5.1, align 1, !tbaa !13
%rem.2 = srem i32 %tag, %3
%5 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 6), align 8, !tbaa !9
%div.2 = sdiv i32 %rem.2, %5
%6 = trunc i32 %div.2 to i8
%conv.2 = add i8 %6, 48
%arrayidx5.2 = getelementptr inbounds i8, ptr %call, i64 2
store i8 %conv.2, ptr %arrayidx5.2, align 1, !tbaa !13
%rem.3 = srem i32 %tag, %5
%7 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 5), align 4, !tbaa !9
%div.3 = sdiv i32 %rem.3, %7
%8 = trunc i32 %div.3 to i8
%conv.3 = add i8 %8, 48
%arrayidx5.3 = getelementptr inbounds i8, ptr %call, i64 3
store i8 %conv.3, ptr %arrayidx5.3, align 1, !tbaa !13
%rem.4 = srem i32 %tag, %7
%9 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 4), align 16, !tbaa !9
%div.4 = sdiv i32 %rem.4, %9
%10 = trunc i32 %div.4 to i8
%conv.4 = add i8 %10, 48
%arrayidx5.4 = getelementptr inbounds i8, ptr %call, i64 4
store i8 %conv.4, ptr %arrayidx5.4, align 1, !tbaa !13
%rem.5 = srem i32 %tag, %9
%11 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 3), align 4, !tbaa !9
%div.5 = sdiv i32 %rem.5, %11
%12 = trunc i32 %div.5 to i8
%conv.5 = add i8 %12, 48
%arrayidx5.5 = getelementptr inbounds i8, ptr %call, i64 5
store i8 %conv.5, ptr %arrayidx5.5, align 1, !tbaa !13
%rem.6 = srem i32 %tag, %11
%13 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 2), align 8, !tbaa !9
%div.6 = sdiv i32 %rem.6, %13
%14 = trunc i32 %div.6 to i8
%conv.6 = add i8 %14, 48
%arrayidx5.6 = getelementptr inbounds i8, ptr %call, i64 6
store i8 %conv.6, ptr %arrayidx5.6, align 1, !tbaa !13
%rem.7 = srem i32 %tag, %13
%15 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 1), align 4, !tbaa !9
%div.7 = sdiv i32 %rem.7, %15
%16 = trunc i32 %div.7 to i8
%conv.7 = add i8 %16, 48
%arrayidx5.7 = getelementptr inbounds i8, ptr %call, i64 7
store i8 %conv.7, ptr %arrayidx5.7, align 1, !tbaa !13
%rem.8 = srem i32 %tag, %15
%17 = load i32, ptr @factorial, align 16, !tbaa !9
%div.8 = sdiv i32 %rem.8, %17
%18 = trunc i32 %div.8 to i8
%conv.8 = add i8 %18, 48
%arrayidx5.8 = getelementptr inbounds i8, ptr %call, i64 8
store i8 %conv.8, ptr %arrayidx5.8, align 1, !tbaa !13
%arrayidx6 = getelementptr inbounds i8, ptr %call, i64 9
store i8 0, ptr %arrayidx6, align 1, !tbaa !13
%cmp21.not = icmp sle i8 %conv.7, %conv.8
%inc25 = add i8 %18, 49
%19 = select i1 %cmp21.not, i8 %inc25, i8 %conv.8
%cmp21.not.1 = icmp sle i8 %conv.6, %19
%inc25.1 = zext i1 %cmp21.not.1 to i8
%20 = add i8 %19, %inc25.1
%21 = or i1 %cmp21.not, %cmp21.not.1
br i1 %21, label %22, label %23
22: ; preds = %for.body14.lr.ph
store i8 %20, ptr %arrayidx5.8, align 1, !tbaa !13
br label %23
23: ; preds = %for.body14.lr.ph, %22
%cmp21.not.1.1 = icmp sgt i8 %conv.6, %conv.7
br i1 %cmp21.not.1.1, label %for.body14.lr.ph.2, label %if.then.1.1
if.then.1.1: ; preds = %23
%inc25.1.1 = add i8 %16, 49
store i8 %inc25.1.1, ptr %arrayidx5.7, align 1, !tbaa !13
br label %for.body14.lr.ph.2
for.body14.lr.ph.2: ; preds = %if.then.1.1, %23
%24 = phi i8 [ %inc25.1.1, %if.then.1.1 ], [ %conv.7, %23 ]
%cmp21.not.2 = icmp sgt i8 %conv.5, %20
br i1 %cmp21.not.2, label %for.inc26.2, label %if.then.2
if.then.2: ; preds = %for.body14.lr.ph.2
%inc25.2 = add i8 %20, 1
store i8 %inc25.2, ptr %arrayidx5.8, align 1, !tbaa !13
br label %for.inc26.2
for.inc26.2: ; preds = %if.then.2, %for.body14.lr.ph.2
%25 = phi i8 [ %inc25.2, %if.then.2 ], [ %20, %for.body14.lr.ph.2 ]
%cmp21.not.2.1 = icmp sgt i8 %conv.5, %24
br i1 %cmp21.not.2.1, label %for.inc26.2.1, label %if.then.2.1
if.then.2.1: ; preds = %for.inc26.2
%inc25.2.1 = add i8 %24, 1
store i8 %inc25.2.1, ptr %arrayidx5.7, align 1, !tbaa !13
br label %for.inc26.2.1
for.inc26.2.1: ; preds = %if.then.2.1, %for.inc26.2
%26 = phi i8 [ %inc25.2.1, %if.then.2.1 ], [ %24, %for.inc26.2 ]
%cmp21.not.2.2 = icmp sgt i8 %conv.5, %conv.6
br i1 %cmp21.not.2.2, label %for.body14.lr.ph.3, label %if.then.2.2
if.then.2.2: ; preds = %for.inc26.2.1
%inc25.2.2 = add i8 %14, 49
store i8 %inc25.2.2, ptr %arrayidx5.6, align 1, !tbaa !13
br label %for.body14.lr.ph.3
for.body14.lr.ph.3: ; preds = %if.then.2.2, %for.inc26.2.1
%27 = phi i8 [ %inc25.2.2, %if.then.2.2 ], [ %conv.6, %for.inc26.2.1 ]
%cmp21.not.3 = icmp sgt i8 %conv.4, %25
br i1 %cmp21.not.3, label %for.inc26.3, label %if.then.3
if.then.3: ; preds = %for.body14.lr.ph.3
%inc25.3 = add i8 %25, 1
store i8 %inc25.3, ptr %arrayidx5.8, align 1, !tbaa !13
br label %for.inc26.3
for.inc26.3: ; preds = %if.then.3, %for.body14.lr.ph.3
%28 = phi i8 [ %inc25.3, %if.then.3 ], [ %25, %for.body14.lr.ph.3 ]
%cmp21.not.3.1 = icmp sgt i8 %conv.4, %26
br i1 %cmp21.not.3.1, label %for.inc26.3.1, label %if.then.3.1
if.then.3.1: ; preds = %for.inc26.3
%inc25.3.1 = add i8 %26, 1
store i8 %inc25.3.1, ptr %arrayidx5.7, align 1, !tbaa !13
br label %for.inc26.3.1
for.inc26.3.1: ; preds = %if.then.3.1, %for.inc26.3
%29 = phi i8 [ %inc25.3.1, %if.then.3.1 ], [ %26, %for.inc26.3 ]
%cmp21.not.3.2 = icmp sgt i8 %conv.4, %27
br i1 %cmp21.not.3.2, label %for.inc26.3.2, label %if.then.3.2
if.then.3.2: ; preds = %for.inc26.3.1
%inc25.3.2 = add i8 %27, 1
store i8 %inc25.3.2, ptr %arrayidx5.6, align 1, !tbaa !13
br label %for.inc26.3.2
for.inc26.3.2: ; preds = %if.then.3.2, %for.inc26.3.1
%30 = phi i8 [ %inc25.3.2, %if.then.3.2 ], [ %27, %for.inc26.3.1 ]
%cmp21.not.3.3 = icmp sgt i8 %conv.4, %conv.5
br i1 %cmp21.not.3.3, label %for.body14.lr.ph.4, label %if.then.3.3
if.then.3.3: ; preds = %for.inc26.3.2
%inc25.3.3 = add i8 %12, 49
store i8 %inc25.3.3, ptr %arrayidx5.5, align 1, !tbaa !13
br label %for.body14.lr.ph.4
for.body14.lr.ph.4: ; preds = %if.then.3.3, %for.inc26.3.2
%31 = phi i8 [ %inc25.3.3, %if.then.3.3 ], [ %conv.5, %for.inc26.3.2 ]
%cmp21.not.4 = icmp sgt i8 %conv.3, %28
br i1 %cmp21.not.4, label %for.inc26.4, label %if.then.4
if.then.4: ; preds = %for.body14.lr.ph.4
%inc25.4 = add i8 %28, 1
store i8 %inc25.4, ptr %arrayidx5.8, align 1, !tbaa !13
br label %for.inc26.4
for.inc26.4: ; preds = %if.then.4, %for.body14.lr.ph.4
%32 = phi i8 [ %inc25.4, %if.then.4 ], [ %28, %for.body14.lr.ph.4 ]
%cmp21.not.4.1 = icmp sgt i8 %conv.3, %29
br i1 %cmp21.not.4.1, label %for.inc26.4.1, label %if.then.4.1
if.then.4.1: ; preds = %for.inc26.4
%inc25.4.1 = add i8 %29, 1
store i8 %inc25.4.1, ptr %arrayidx5.7, align 1, !tbaa !13
br label %for.inc26.4.1
for.inc26.4.1: ; preds = %if.then.4.1, %for.inc26.4
%33 = phi i8 [ %inc25.4.1, %if.then.4.1 ], [ %29, %for.inc26.4 ]
%cmp21.not.4.2 = icmp sgt i8 %conv.3, %30
br i1 %cmp21.not.4.2, label %for.inc26.4.2, label %if.then.4.2
if.then.4.2: ; preds = %for.inc26.4.1
%inc25.4.2 = add i8 %30, 1
store i8 %inc25.4.2, ptr %arrayidx5.6, align 1, !tbaa !13
br label %for.inc26.4.2
for.inc26.4.2: ; preds = %if.then.4.2, %for.inc26.4.1
%34 = phi i8 [ %inc25.4.2, %if.then.4.2 ], [ %30, %for.inc26.4.1 ]
%cmp21.not.4.3 = icmp sgt i8 %conv.3, %31
br i1 %cmp21.not.4.3, label %for.inc26.4.3, label %if.then.4.3
if.then.4.3: ; preds = %for.inc26.4.2
%inc25.4.3 = add i8 %31, 1
store i8 %inc25.4.3, ptr %arrayidx5.5, align 1, !tbaa !13
br label %for.inc26.4.3
for.inc26.4.3: ; preds = %if.then.4.3, %for.inc26.4.2
%35 = phi i8 [ %inc25.4.3, %if.then.4.3 ], [ %31, %for.inc26.4.2 ]
%cmp21.not.4.4 = icmp sgt i8 %conv.3, %conv.4
br i1 %cmp21.not.4.4, label %for.body14.lr.ph.5, label %if.then.4.4
if.then.4.4: ; preds = %for.inc26.4.3
%inc25.4.4 = add i8 %10, 49
store i8 %inc25.4.4, ptr %arrayidx5.4, align 1, !tbaa !13
br label %for.body14.lr.ph.5
for.body14.lr.ph.5: ; preds = %if.then.4.4, %for.inc26.4.3
%36 = phi i8 [ %inc25.4.4, %if.then.4.4 ], [ %conv.4, %for.inc26.4.3 ]
%cmp21.not.5 = icmp sgt i8 %conv.2, %32
br i1 %cmp21.not.5, label %for.inc26.5, label %if.then.5
if.then.5: ; preds = %for.body14.lr.ph.5
%inc25.5 = add i8 %32, 1
store i8 %inc25.5, ptr %arrayidx5.8, align 1, !tbaa !13
br label %for.inc26.5
for.inc26.5: ; preds = %if.then.5, %for.body14.lr.ph.5
%37 = phi i8 [ %inc25.5, %if.then.5 ], [ %32, %for.body14.lr.ph.5 ]
%cmp21.not.5.1 = icmp sgt i8 %conv.2, %33
br i1 %cmp21.not.5.1, label %for.inc26.5.1, label %if.then.5.1
if.then.5.1: ; preds = %for.inc26.5
%inc25.5.1 = add i8 %33, 1
store i8 %inc25.5.1, ptr %arrayidx5.7, align 1, !tbaa !13
br label %for.inc26.5.1
for.inc26.5.1: ; preds = %if.then.5.1, %for.inc26.5
%38 = phi i8 [ %inc25.5.1, %if.then.5.1 ], [ %33, %for.inc26.5 ]
%cmp21.not.5.2 = icmp sgt i8 %conv.2, %34
br i1 %cmp21.not.5.2, label %for.inc26.5.2, label %if.then.5.2
if.then.5.2: ; preds = %for.inc26.5.1
%inc25.5.2 = add i8 %34, 1
store i8 %inc25.5.2, ptr %arrayidx5.6, align 1, !tbaa !13
br label %for.inc26.5.2
for.inc26.5.2: ; preds = %if.then.5.2, %for.inc26.5.1
%39 = phi i8 [ %inc25.5.2, %if.then.5.2 ], [ %34, %for.inc26.5.1 ]
%cmp21.not.5.3 = icmp sgt i8 %conv.2, %35
br i1 %cmp21.not.5.3, label %for.inc26.5.3, label %if.then.5.3
if.then.5.3: ; preds = %for.inc26.5.2
%inc25.5.3 = add i8 %35, 1
store i8 %inc25.5.3, ptr %arrayidx5.5, align 1, !tbaa !13
br label %for.inc26.5.3
for.inc26.5.3: ; preds = %if.then.5.3, %for.inc26.5.2
%40 = phi i8 [ %inc25.5.3, %if.then.5.3 ], [ %35, %for.inc26.5.2 ]
%cmp21.not.5.4 = icmp sgt i8 %conv.2, %36
br i1 %cmp21.not.5.4, label %for.inc26.5.4, label %if.then.5.4
if.then.5.4: ; preds = %for.inc26.5.3
%inc25.5.4 = add i8 %36, 1
store i8 %inc25.5.4, ptr %arrayidx5.4, align 1, !tbaa !13
br label %for.inc26.5.4
for.inc26.5.4: ; preds = %if.then.5.4, %for.inc26.5.3
%41 = phi i8 [ %inc25.5.4, %if.then.5.4 ], [ %36, %for.inc26.5.3 ]
%cmp21.not.5.5 = icmp sgt i8 %conv.2, %conv.3
br i1 %cmp21.not.5.5, label %for.body14.lr.ph.6, label %if.then.5.5
if.then.5.5: ; preds = %for.inc26.5.4
%inc25.5.5 = add i8 %8, 49
store i8 %inc25.5.5, ptr %arrayidx5.3, align 1, !tbaa !13
br label %for.body14.lr.ph.6
for.body14.lr.ph.6: ; preds = %if.then.5.5, %for.inc26.5.4
%42 = phi i8 [ %inc25.5.5, %if.then.5.5 ], [ %conv.3, %for.inc26.5.4 ]
%cmp21.not.6 = icmp sgt i8 %conv.1, %37
br i1 %cmp21.not.6, label %for.inc26.6, label %if.then.6
if.then.6: ; preds = %for.body14.lr.ph.6
%inc25.6 = add i8 %37, 1
store i8 %inc25.6, ptr %arrayidx5.8, align 1, !tbaa !13
br label %for.inc26.6
for.inc26.6: ; preds = %if.then.6, %for.body14.lr.ph.6
%43 = phi i8 [ %inc25.6, %if.then.6 ], [ %37, %for.body14.lr.ph.6 ]
%cmp21.not.6.1 = icmp sgt i8 %conv.1, %38
br i1 %cmp21.not.6.1, label %for.inc26.6.1, label %if.then.6.1
if.then.6.1: ; preds = %for.inc26.6
%inc25.6.1 = add i8 %38, 1
store i8 %inc25.6.1, ptr %arrayidx5.7, align 1, !tbaa !13
br label %for.inc26.6.1
for.inc26.6.1: ; preds = %if.then.6.1, %for.inc26.6
%44 = phi i8 [ %inc25.6.1, %if.then.6.1 ], [ %38, %for.inc26.6 ]
%cmp21.not.6.2 = icmp sgt i8 %conv.1, %39
br i1 %cmp21.not.6.2, label %for.inc26.6.2, label %if.then.6.2
if.then.6.2: ; preds = %for.inc26.6.1
%inc25.6.2 = add i8 %39, 1
store i8 %inc25.6.2, ptr %arrayidx5.6, align 1, !tbaa !13
br label %for.inc26.6.2
for.inc26.6.2: ; preds = %if.then.6.2, %for.inc26.6.1
%45 = phi i8 [ %inc25.6.2, %if.then.6.2 ], [ %39, %for.inc26.6.1 ]
%cmp21.not.6.3 = icmp sgt i8 %conv.1, %40
br i1 %cmp21.not.6.3, label %for.inc26.6.3, label %if.then.6.3
if.then.6.3: ; preds = %for.inc26.6.2
%inc25.6.3 = add i8 %40, 1
store i8 %inc25.6.3, ptr %arrayidx5.5, align 1, !tbaa !13
br label %for.inc26.6.3
for.inc26.6.3: ; preds = %if.then.6.3, %for.inc26.6.2
%46 = phi i8 [ %inc25.6.3, %if.then.6.3 ], [ %40, %for.inc26.6.2 ]
%cmp21.not.6.4 = icmp sgt i8 %conv.1, %41
br i1 %cmp21.not.6.4, label %for.inc26.6.4, label %if.then.6.4
if.then.6.4: ; preds = %for.inc26.6.3
%inc25.6.4 = add i8 %41, 1
store i8 %inc25.6.4, ptr %arrayidx5.4, align 1, !tbaa !13
br label %for.inc26.6.4
for.inc26.6.4: ; preds = %if.then.6.4, %for.inc26.6.3
%47 = phi i8 [ %inc25.6.4, %if.then.6.4 ], [ %41, %for.inc26.6.3 ]
%cmp21.not.6.5 = icmp sgt i8 %conv.1, %42
br i1 %cmp21.not.6.5, label %for.inc26.6.5, label %if.then.6.5
if.then.6.5: ; preds = %for.inc26.6.4
%inc25.6.5 = add i8 %42, 1
store i8 %inc25.6.5, ptr %arrayidx5.3, align 1, !tbaa !13
br label %for.inc26.6.5
for.inc26.6.5: ; preds = %if.then.6.5, %for.inc26.6.4
%48 = phi i8 [ %inc25.6.5, %if.then.6.5 ], [ %42, %for.inc26.6.4 ]
%cmp21.not.6.6 = icmp sgt i8 %conv.1, %conv.2
br i1 %cmp21.not.6.6, label %for.body14.lr.ph.7, label %if.then.6.6
if.then.6.6: ; preds = %for.inc26.6.5
%inc25.6.6 = add i8 %6, 49
store i8 %inc25.6.6, ptr %arrayidx5.2, align 1, !tbaa !13
br label %for.body14.lr.ph.7
for.body14.lr.ph.7: ; preds = %if.then.6.6, %for.inc26.6.5
%49 = phi i8 [ %inc25.6.6, %if.then.6.6 ], [ %conv.2, %for.inc26.6.5 ]
%cmp21.not.7 = icmp sgt i8 %conv, %43
br i1 %cmp21.not.7, label %for.inc26.7, label %if.then.7
if.then.7: ; preds = %for.body14.lr.ph.7
%inc25.7 = add i8 %43, 1
store i8 %inc25.7, ptr %arrayidx5.8, align 1, !tbaa !13
br label %for.inc26.7
for.inc26.7: ; preds = %if.then.7, %for.body14.lr.ph.7
%cmp21.not.7.1 = icmp sgt i8 %conv, %44
br i1 %cmp21.not.7.1, label %for.inc26.7.1, label %if.then.7.1
if.then.7.1: ; preds = %for.inc26.7
%inc25.7.1 = add i8 %44, 1
store i8 %inc25.7.1, ptr %arrayidx5.7, align 1, !tbaa !13
br label %for.inc26.7.1
for.inc26.7.1: ; preds = %if.then.7.1, %for.inc26.7
%cmp21.not.7.2 = icmp sgt i8 %conv, %45
br i1 %cmp21.not.7.2, label %for.inc26.7.2, label %if.then.7.2
if.then.7.2: ; preds = %for.inc26.7.1
%inc25.7.2 = add i8 %45, 1
store i8 %inc25.7.2, ptr %arrayidx5.6, align 1, !tbaa !13
br label %for.inc26.7.2
for.inc26.7.2: ; preds = %if.then.7.2, %for.inc26.7.1
%cmp21.not.7.3 = icmp sgt i8 %conv, %46
br i1 %cmp21.not.7.3, label %for.inc26.7.3, label %if.then.7.3
if.then.7.3: ; preds = %for.inc26.7.2
%inc25.7.3 = add i8 %46, 1
store i8 %inc25.7.3, ptr %arrayidx5.5, align 1, !tbaa !13
br label %for.inc26.7.3
for.inc26.7.3: ; preds = %if.then.7.3, %for.inc26.7.2
%cmp21.not.7.4 = icmp sgt i8 %conv, %47
br i1 %cmp21.not.7.4, label %for.inc26.7.4, label %if.then.7.4
if.then.7.4: ; preds = %for.inc26.7.3
%inc25.7.4 = add i8 %47, 1
store i8 %inc25.7.4, ptr %arrayidx5.4, align 1, !tbaa !13
br label %for.inc26.7.4
for.inc26.7.4: ; preds = %if.then.7.4, %for.inc26.7.3
%cmp21.not.7.5 = icmp sgt i8 %conv, %48
br i1 %cmp21.not.7.5, label %for.inc26.7.5, label %if.then.7.5
if.then.7.5: ; preds = %for.inc26.7.4
%inc25.7.5 = add i8 %48, 1
store i8 %inc25.7.5, ptr %arrayidx5.3, align 1, !tbaa !13
br label %for.inc26.7.5
for.inc26.7.5: ; preds = %if.then.7.5, %for.inc26.7.4
%cmp21.not.7.6 = icmp sgt i8 %conv, %49
br i1 %cmp21.not.7.6, label %for.inc26.7.6, label %if.then.7.6
if.then.7.6: ; preds = %for.inc26.7.5
%inc25.7.6 = add i8 %49, 1
store i8 %inc25.7.6, ptr %arrayidx5.2, align 1, !tbaa !13
br label %for.inc26.7.6
for.inc26.7.6: ; preds = %if.then.7.6, %for.inc26.7.5
%cmp21.not.7.7 = icmp sgt i8 %conv, %conv.1
br i1 %cmp21.not.7.7, label %for.end27.7, label %if.then.7.7
if.then.7.7: ; preds = %for.inc26.7.6
%inc25.7.7 = add i8 %4, 49
store i8 %inc25.7.7, ptr %arrayidx5.1, align 1, !tbaa !13
br label %for.end27.7
for.end27.7: ; preds = %for.inc26.7.6, %if.then.7.7
ret ptr %call
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn uwtable
define dso_local ptr @move_up(ptr nocapture noundef readonly %s, i32 noundef %x) local_unnamed_addr #5 {
entry:
%cmp = icmp slt i32 %x, 3
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%call = tail call noalias dereferenceable_or_null(10) ptr @malloc(i64 noundef 10) #18
%call1 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %call, ptr noundef nonnull dereferenceable(1) %s) #19
%sub = add nsw i32 %x, -3
%idxprom = zext i32 %sub to i64
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %idxprom
%0 = load i8, ptr %arrayidx, align 1, !tbaa !13
%idxprom2 = zext i32 %x to i64
%arrayidx3 = getelementptr inbounds i8, ptr %call, i64 %idxprom2
store i8 %0, ptr %arrayidx3, align 1, !tbaa !13
%arrayidx5 = getelementptr inbounds i8, ptr %s, i64 %idxprom2
%1 = load i8, ptr %arrayidx5, align 1, !tbaa !13
%arrayidx8 = getelementptr inbounds i8, ptr %call, i64 %idxprom
store i8 %1, ptr %arrayidx8, align 1, !tbaa !13
br label %return
return: ; preds = %entry, %if.end
%retval.0 = phi ptr [ %call, %if.end ], [ null, %entry ]
ret ptr %retval.0
}
; 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 #6
; Function Attrs: mustprogress nofree nounwind willreturn uwtable
define dso_local ptr @move_left(ptr nocapture noundef readonly %s, i32 noundef %x) local_unnamed_addr #5 {
entry:
%rem = srem i32 %x, 3
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%call = tail call noalias dereferenceable_or_null(10) ptr @malloc(i64 noundef 10) #18
%call1 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %call, ptr noundef nonnull dereferenceable(1) %s) #19
%sub = add nsw i32 %x, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %idxprom
%0 = load i8, ptr %arrayidx, align 1, !tbaa !13
%idxprom2 = sext i32 %x to i64
%arrayidx3 = getelementptr inbounds i8, ptr %call, i64 %idxprom2
store i8 %0, ptr %arrayidx3, align 1, !tbaa !13
%arrayidx5 = getelementptr inbounds i8, ptr %s, i64 %idxprom2
%1 = load i8, ptr %arrayidx5, align 1, !tbaa !13
%arrayidx8 = getelementptr inbounds i8, ptr %call, i64 %idxprom
store i8 %1, ptr %arrayidx8, align 1, !tbaa !13
br label %return
return: ; preds = %entry, %if.end
%retval.0 = phi ptr [ %call, %if.end ], [ null, %entry ]
ret ptr %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn uwtable
define dso_local ptr @move_right(ptr nocapture noundef readonly %s, i32 noundef %x) local_unnamed_addr #5 {
entry:
%rem = srem i32 %x, 3
%cmp = icmp eq i32 %rem, 2
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%call = tail call noalias dereferenceable_or_null(10) ptr @malloc(i64 noundef 10) #18
%call1 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %call, ptr noundef nonnull dereferenceable(1) %s) #19
%add = add nsw i32 %x, 1
%idxprom = sext i32 %add to i64
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %idxprom
%0 = load i8, ptr %arrayidx, align 1, !tbaa !13
%idxprom2 = sext i32 %x to i64
%arrayidx3 = getelementptr inbounds i8, ptr %call, i64 %idxprom2
store i8 %0, ptr %arrayidx3, align 1, !tbaa !13
%arrayidx5 = getelementptr inbounds i8, ptr %s, i64 %idxprom2
%1 = load i8, ptr %arrayidx5, align 1, !tbaa !13
%arrayidx8 = getelementptr inbounds i8, ptr %call, i64 %idxprom
store i8 %1, ptr %arrayidx8, align 1, !tbaa !13
br label %return
return: ; preds = %entry, %if.end
%retval.0 = phi ptr [ %call, %if.end ], [ null, %entry ]
ret ptr %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn uwtable
define dso_local ptr @move_down(ptr nocapture noundef readonly %s, i32 noundef %x) local_unnamed_addr #5 {
entry:
%cmp = icmp sgt i32 %x, 5
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%call = tail call noalias dereferenceable_or_null(10) ptr @malloc(i64 noundef 10) #18
%call1 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %call, ptr noundef nonnull dereferenceable(1) %s) #19
%add = add nsw i32 %x, 3
%idxprom = sext i32 %add to i64
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %idxprom
%0 = load i8, ptr %arrayidx, align 1, !tbaa !13
%idxprom2 = sext i32 %x to i64
%arrayidx3 = getelementptr inbounds i8, ptr %call, i64 %idxprom2
store i8 %0, ptr %arrayidx3, align 1, !tbaa !13
%arrayidx5 = getelementptr inbounds i8, ptr %s, i64 %idxprom2
%1 = load i8, ptr %arrayidx5, align 1, !tbaa !13
%arrayidx8 = getelementptr inbounds i8, ptr %call, i64 %idxprom
store i8 %1, ptr %arrayidx8, align 1, !tbaa !13
br label %return
return: ; preds = %entry, %if.end
%retval.0 = phi ptr [ %call, %if.end ], [ null, %entry ]
ret ptr %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @create(ptr nocapture noundef readonly %s, i32 noundef %t) local_unnamed_addr #7 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %s, ptr noundef nonnull dereferenceable(10) @__const.distance.s) #20
%cmp = icmp eq i32 %call, 0
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%call1 = tail call i32 @stotag(ptr noundef %s)
%0 = load ptr, ptr @flag, align 8, !tbaa !15
%idxprom = sext i32 %call1 to i64
%arrayidx = getelementptr inbounds i8, ptr %0, i64 %idxprom
%1 = load i8, ptr %arrayidx, align 1, !tbaa !13
%tobool.not = icmp eq i8 %1, 0
br i1 %tobool.not, label %if.end3, label %return
if.end3: ; preds = %if.end
%conv = trunc i32 %t to i8
store i8 %conv, ptr %arrayidx, align 1, !tbaa !13
%2 = load ptr, ptr @que, align 8, !tbaa !15
%3 = load i32, ptr @rear, align 4, !tbaa !9
%idxprom6 = sext i32 %3 to i64
%arrayidx7 = getelementptr inbounds i32, ptr %2, i64 %idxprom6
store i32 %call1, ptr %arrayidx7, align 4, !tbaa !9
%4 = load i32, ptr @rear, align 4, !tbaa !9
%inc = add nsw i32 %4, 1
store i32 %inc, ptr @rear, align 4, !tbaa !9
br label %return
return: ; preds = %if.end3, %if.end, %entry
%retval.1 = phi i32 [ %t, %entry ], [ 0, %if.end ], [ 0, %if.end3 ]
ret i32 %retval.1
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #8
; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @distance(ptr nocapture noundef readonly %s_new) local_unnamed_addr #9 {
entry:
br label %while.cond.preheader
while.cond.preheader: ; preds = %entry, %while.end12
%sum.030 = phi i32 [ 0, %entry ], [ %add17, %while.end12 ]
%i.029 = phi i32 [ 0, %entry ], [ %inc18, %while.end12 ]
br label %while.cond
while.cond: ; preds = %while.cond, %while.cond.preheader
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %while.cond.preheader ]
%arrayidx = getelementptr inbounds [10 x i8], ptr @__const.distance.s, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !13
%conv = sext i8 %0 to i32
%sub = add nsw i32 %conv, -48
%cmp1.not = icmp eq i32 %sub, %i.029
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp1.not, label %while.cond3, label %while.cond, !llvm.loop !17
while.cond3: ; preds = %while.cond, %while.cond3
%indvars.iv32 = phi i64 [ %indvars.iv.next33, %while.cond3 ], [ 0, %while.cond ]
%arrayidx5 = getelementptr inbounds i8, ptr %s_new, i64 %indvars.iv32
%1 = load i8, ptr %arrayidx5, align 1, !tbaa !13
%conv6 = sext i8 %1 to i32
%sub7 = add nsw i32 %conv6, -48
%cmp8.not = icmp eq i32 %sub7, %i.029
%indvars.iv.next33 = add nuw i64 %indvars.iv32, 1
br i1 %cmp8.not, label %while.end12, label %while.cond3, !llvm.loop !19
while.end12: ; preds = %while.cond3
%2 = trunc i64 %indvars.iv to i32
%3 = trunc i64 %indvars.iv32 to i32
%div = udiv i32 %2, 3
%div13 = udiv i32 %3, 3
%sub14 = sub nsw i32 %div, %div13
%4 = tail call i32 @llvm.abs.i32(i32 %sub14, i1 true)
%rem = urem i32 %2, 3
%rem15 = urem i32 %3, 3
%sub16 = sub nsw i32 %rem, %rem15
%5 = tail call i32 @llvm.abs.i32(i32 %sub16, i1 true)
%add = add i32 %5, %sum.030
%add17 = add i32 %add, %4
%inc18 = add nuw nsw i32 %i.029, 1
%exitcond.not = icmp eq i32 %inc18, 9
br i1 %exitcond.not, label %for.end, label %while.cond.preheader, !llvm.loop !20
for.end: ; preds = %while.end12
ret i32 %add17
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #10
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @check_x(ptr nocapture noundef readonly %s) local_unnamed_addr #11 {
entry:
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !13
%cmp.not = icmp eq i8 %0, 48
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !21
while.end: ; preds = %while.cond
%1 = trunc i64 %indvars.iv to i32
ret i32 %1
}
; Function Attrs: nounwind uwtable
define dso_local i32 @cal() local_unnamed_addr #12 {
entry:
%0 = load ptr, ptr @que, align 8, !tbaa !15
%1 = load i32, ptr @head, align 4, !tbaa !9
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds i32, ptr %0, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !9
%call = tail call ptr @tagtos(i32 noundef %2)
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %entry
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.cond.i ], [ 0, %entry ]
%arrayidx.i = getelementptr inbounds i8, ptr %call, i64 %indvars.iv.i
%3 = load i8, ptr %arrayidx.i, align 1, !tbaa !13
%cmp.not.i = icmp eq i8 %3, 48
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
br i1 %cmp.not.i, label %check_x.exit, label %while.cond.i, !llvm.loop !21
check_x.exit: ; preds = %while.cond.i
%4 = trunc i64 %indvars.iv.i to i32
%rem.i = srem i32 %4, 3
%cmp.i = icmp eq i32 %rem.i, 2
br i1 %cmp.i, label %check_x.exit.move_left.exit_crit_edge, label %while.cond.preheader.i.preheader
check_x.exit.move_left.exit_crit_edge: ; preds = %check_x.exit
%.pre = shl i64 %indvars.iv.i, 32
%.pre344 = ashr exact i64 %.pre, 32
br label %while.cond.preheader.i137.preheader
while.cond.preheader.i.preheader: ; preds = %check_x.exit
%call.i = tail call noalias dereferenceable_or_null(10) ptr @malloc(i64 noundef 10) #18
%call1.i = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %call.i, ptr noundef nonnull dereferenceable(1) %call) #19
%add.i = shl i64 %indvars.iv.i, 32
%sext = add i64 %add.i, 4294967296
%idxprom.i = ashr exact i64 %sext, 32
%arrayidx.i109 = getelementptr inbounds i8, ptr %call, i64 %idxprom.i
%5 = load i8, ptr %arrayidx.i109, align 1, !tbaa !13
%idxprom2.i = ashr exact i64 %add.i, 32
%arrayidx3.i = getelementptr inbounds i8, ptr %call.i, i64 %idxprom2.i
store i8 %5, ptr %arrayidx3.i, align 1, !tbaa !13
%arrayidx5.i = getelementptr inbounds i8, ptr %call, i64 %idxprom2.i
%6 = load i8, ptr %arrayidx5.i, align 1, !tbaa !13
%arrayidx8.i = getelementptr inbounds i8, ptr %call.i, i64 %idxprom.i
store i8 %6, ptr %arrayidx8.i, align 1, !tbaa !13
%7 = load ptr, ptr @flag, align 8, !tbaa !15
%idxprom4 = sext i32 %2 to i64
%arrayidx5 = getelementptr inbounds i8, ptr %7, i64 %idxprom4
%8 = load i8, ptr %arrayidx5, align 1, !tbaa !13
%conv = sext i8 %8 to i32
%add = add nsw i32 %conv, 1
%call.i117 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %call.i, ptr noundef nonnull dereferenceable(10) @__const.distance.s) #20
%cmp.i118 = icmp eq i32 %call.i117, 0
br i1 %cmp.i118, label %create.exit, label %if.end.i119
if.end.i119: ; preds = %while.cond.preheader.i.preheader
%call1.i120 = tail call i32 @stotag(ptr noundef nonnull %call.i)
%idxprom.i121 = sext i32 %call1.i120 to i64
%arrayidx.i122 = getelementptr inbounds i8, ptr %7, i64 %idxprom.i121
%9 = load i8, ptr %arrayidx.i122, align 1, !tbaa !13
%tobool.not.i = icmp eq i8 %9, 0
br i1 %tobool.not.i, label %if.end3.i, label %if.end8
if.end3.i: ; preds = %if.end.i119
%conv.i123 = trunc i32 %add to i8
store i8 %conv.i123, ptr %arrayidx.i122, align 1, !tbaa !13
%10 = load ptr, ptr @que, align 8, !tbaa !15
%11 = load i32, ptr @rear, align 4, !tbaa !9
%idxprom6.i = sext i32 %11 to i64
%arrayidx7.i = getelementptr inbounds i32, ptr %10, i64 %idxprom6.i
store i32 %call1.i120, ptr %arrayidx7.i, align 4, !tbaa !9
%12 = load i32, ptr @rear, align 4, !tbaa !9
%inc.i = add nsw i32 %12, 1
store i32 %inc.i, ptr @rear, align 4, !tbaa !9
br label %if.end8
create.exit: ; preds = %while.cond.preheader.i.preheader
%tobool.not = icmp eq i32 %add, 0
br i1 %tobool.not, label %if.end8, label %cleanup
if.end8: ; preds = %if.end3.i, %if.end.i119, %create.exit
%cmp.i125 = icmp eq i32 %rem.i, 0
br i1 %cmp.i125, label %if.end23, label %while.cond.preheader.i137.preheader
while.cond.preheader.i137.preheader: ; preds = %if.end8, %check_x.exit.move_left.exit_crit_edge
%idxprom2.i132.pre-phi = phi i64 [ %.pre344, %check_x.exit.move_left.exit_crit_edge ], [ %idxprom2.i, %if.end8 ]
%sub.i129.pre-phi = phi i64 [ %.pre, %check_x.exit.move_left.exit_crit_edge ], [ %add.i, %if.end8 ]
%retval.0.i295304 = phi ptr [ null, %check_x.exit.move_left.exit_crit_edge ], [ %call.i, %if.end8 ]
%call.i127 = tail call noalias dereferenceable_or_null(10) ptr @malloc(i64 noundef 10) #18
%call1.i128 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %call.i127, ptr noundef nonnull dereferenceable(1) %call) #19
%sext340 = add i64 %sub.i129.pre-phi, -4294967296
%idxprom.i130 = ashr exact i64 %sext340, 32
%arrayidx.i131 = getelementptr inbounds i8, ptr %call, i64 %idxprom.i130
%13 = load i8, ptr %arrayidx.i131, align 1, !tbaa !13
%arrayidx3.i133 = getelementptr inbounds i8, ptr %call.i127, i64 %idxprom2.i132.pre-phi
store i8 %13, ptr %arrayidx3.i133, align 1, !tbaa !13
%arrayidx5.i134 = getelementptr inbounds i8, ptr %call, i64 %idxprom2.i132.pre-phi
%14 = load i8, ptr %arrayidx5.i134, align 1, !tbaa !13
%arrayidx8.i135 = getelementptr inbounds i8, ptr %call.i127, i64 %idxprom.i130
store i8 %14, ptr %arrayidx8.i135, align 1, !tbaa !13
%15 = load ptr, ptr @flag, align 8, !tbaa !15
%idxprom14 = sext i32 %2 to i64
%arrayidx15 = getelementptr inbounds i8, ptr %15, i64 %idxprom14
%16 = load i8, ptr %arrayidx15, align 1, !tbaa !13
%conv16 = sext i8 %16 to i32
%add17 = add nsw i32 %conv16, 1
%call.i167 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %call.i127, ptr noundef nonnull dereferenceable(10) @__const.distance.s) #20
%cmp.i168 = icmp eq i32 %call.i167, 0
br i1 %cmp.i168, label %create.exit180, label %if.end.i169
if.end.i169: ; preds = %while.cond.preheader.i137.preheader
%call1.i170 = tail call i32 @stotag(ptr noundef nonnull %call.i127)
%idxprom.i171 = sext i32 %call1.i170 to i64
%arrayidx.i172 = getelementptr inbounds i8, ptr %15, i64 %idxprom.i171
%17 = load i8, ptr %arrayidx.i172, align 1, !tbaa !13
%tobool.not.i173 = icmp eq i8 %17, 0
br i1 %tobool.not.i173, label %if.end3.i175, label %if.end23
if.end3.i175: ; preds = %if.end.i169
%conv.i176 = trunc i32 %add17 to i8
store i8 %conv.i176, ptr %arrayidx.i172, align 1, !tbaa !13
%18 = load ptr, ptr @que, align 8, !tbaa !15
%19 = load i32, ptr @rear, align 4, !tbaa !9
%idxprom6.i177 = sext i32 %19 to i64
%arrayidx7.i178 = getelementptr inbounds i32, ptr %18, i64 %idxprom6.i177
store i32 %call1.i170, ptr %arrayidx7.i178, align 4, !tbaa !9
%20 = load i32, ptr @rear, align 4, !tbaa !9
%inc.i179 = add nsw i32 %20, 1
store i32 %inc.i179, ptr @rear, align 4, !tbaa !9
br label %if.end23
create.exit180: ; preds = %while.cond.preheader.i137.preheader
%tobool19.not = icmp eq i32 %add17, 0
br i1 %tobool19.not, label %if.end23, label %cleanup
if.end23: ; preds = %if.end3.i175, %if.end.i169, %if.end8, %create.exit180
%cmp10.not313 = phi i1 [ false, %create.exit180 ], [ true, %if.end8 ], [ false, %if.end.i169 ], [ false, %if.end3.i175 ]
%retval.0.i136312 = phi ptr [ %call.i127, %create.exit180 ], [ null, %if.end8 ], [ %call.i127, %if.end.i169 ], [ %call.i127, %if.end3.i175 ]
%cmp.not296303311 = phi i1 [ %cmp.i, %create.exit180 ], [ false, %if.end8 ], [ %cmp.i, %if.end.i169 ], [ %cmp.i, %if.end3.i175 ]
%retval.0.i295305310 = phi ptr [ %retval.0.i295304, %create.exit180 ], [ %call.i, %if.end8 ], [ %retval.0.i295304, %if.end.i169 ], [ %retval.0.i295304, %if.end3.i175 ]
%cmp.i181 = icmp slt i32 %4, 3
br i1 %cmp.i181, label %while.cond.preheader.i249.preheader, label %while.cond.preheader.i193.preheader
while.cond.preheader.i193.preheader: ; preds = %if.end23
%call.i183 = tail call noalias dereferenceable_or_null(10) ptr @malloc(i64 noundef 10) #18
%call1.i184 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %call.i183, ptr noundef nonnull dereferenceable(1) %call) #19
%sub.i185 = add i64 %indvars.iv.i, 4294967293
%idxprom.i186 = and i64 %sub.i185, 4294967295
%arrayidx.i187 = getelementptr inbounds i8, ptr %call, i64 %idxprom.i186
%21 = load i8, ptr %arrayidx.i187, align 1, !tbaa !13
%idxprom2.i188 = and i64 %indvars.iv.i, 4294967295
%arrayidx3.i189 = getelementptr inbounds i8, ptr %call.i183, i64 %idxprom2.i188
store i8 %21, ptr %arrayidx3.i189, align 1, !tbaa !13
%arrayidx5.i190 = getelementptr inbounds i8, ptr %call, i64 %idxprom2.i188
%22 = load i8, ptr %arrayidx5.i190, align 1, !tbaa !13
%arrayidx8.i191 = getelementptr inbounds i8, ptr %call.i183, i64 %idxprom.i186
store i8 %22, ptr %arrayidx8.i191, align 1, !tbaa !13
%23 = load ptr, ptr @flag, align 8, !tbaa !15
%idxprom29 = sext i32 %2 to i64
%arrayidx30 = getelementptr inbounds i8, ptr %23, i64 %idxprom29
%24 = load i8, ptr %arrayidx30, align 1, !tbaa !13
%conv31 = sext i8 %24 to i32
%add32 = add nsw i32 %conv31, 1
%call.i223 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %call.i183, ptr noundef nonnull dereferenceable(10) @__const.distance.s) #20
%cmp.i224 = icmp eq i32 %call.i223, 0
br i1 %cmp.i224, label %create.exit236, label %if.end.i225
if.end.i225: ; preds = %while.cond.preheader.i193.preheader
%call1.i226 = tail call i32 @stotag(ptr noundef nonnull %call.i183)
%idxprom.i227 = sext i32 %call1.i226 to i64
%arrayidx.i228 = getelementptr inbounds i8, ptr %23, i64 %idxprom.i227
%25 = load i8, ptr %arrayidx.i228, align 1, !tbaa !13
%tobool.not.i229 = icmp eq i8 %25, 0
br i1 %tobool.not.i229, label %if.end3.i231, label %if.end38
if.end3.i231: ; preds = %if.end.i225
%conv.i232 = trunc i32 %add32 to i8
store i8 %conv.i232, ptr %arrayidx.i228, align 1, !tbaa !13
%26 = load ptr, ptr @que, align 8, !tbaa !15
%27 = load i32, ptr @rear, align 4, !tbaa !9
%idxprom6.i233 = sext i32 %27 to i64
%arrayidx7.i234 = getelementptr inbounds i32, ptr %26, i64 %idxprom6.i233
store i32 %call1.i226, ptr %arrayidx7.i234, align 4, !tbaa !9
%28 = load i32, ptr @rear, align 4, !tbaa !9
%inc.i235 = add nsw i32 %28, 1
store i32 %inc.i235, ptr @rear, align 4, !tbaa !9
br label %if.end38
create.exit236: ; preds = %while.cond.preheader.i193.preheader
%tobool34.not = icmp eq i32 %add32, 0
br i1 %tobool34.not, label %if.end38, label %cleanup
if.end38: ; preds = %if.end3.i231, %if.end.i225, %create.exit236
%cmp.i237 = icmp ugt i32 %4, 5
br i1 %cmp.i237, label %if.end53, label %while.cond.preheader.i249.preheader
while.cond.preheader.i249.preheader: ; preds = %if.end38, %if.end23
%retval.0.i192318327 = phi ptr [ %call.i183, %if.end38 ], [ null, %if.end23 ]
%call.i239 = tail call noalias dereferenceable_or_null(10) ptr @malloc(i64 noundef 10) #18
%call1.i240 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %call.i239, ptr noundef nonnull dereferenceable(1) %call) #19
%add.i241 = shl i64 %indvars.iv.i, 32
%sext342 = add i64 %add.i241, 12884901888
%idxprom.i242 = ashr exact i64 %sext342, 32
%arrayidx.i243 = getelementptr inbounds i8, ptr %call, i64 %idxprom.i242
%29 = load i8, ptr %arrayidx.i243, align 1, !tbaa !13
%idxprom2.i244 = ashr exact i64 %add.i241, 32
%arrayidx3.i245 = getelementptr inbounds i8, ptr %call.i239, i64 %idxprom2.i244
store i8 %29, ptr %arrayidx3.i245, align 1, !tbaa !13
%arrayidx5.i246 = getelementptr inbounds i8, ptr %call, i64 %idxprom2.i244
%30 = load i8, ptr %arrayidx5.i246, align 1, !tbaa !13
%arrayidx8.i247 = getelementptr inbounds i8, ptr %call.i239, i64 %idxprom.i242
store i8 %30, ptr %arrayidx8.i247, align 1, !tbaa !13
%31 = load ptr, ptr @flag, align 8, !tbaa !15
%idxprom44 = sext i32 %2 to i64
%arrayidx45 = getelementptr inbounds i8, ptr %31, i64 %idxprom44
%32 = load i8, ptr %arrayidx45, align 1, !tbaa !13
%conv46 = sext i8 %32 to i32
%add47 = add nsw i32 %conv46, 1
%call.i279 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %call.i239, ptr noundef nonnull dereferenceable(10) @__const.distance.s) #20
%cmp.i280 = icmp eq i32 %call.i279, 0
br i1 %cmp.i280, label %create.exit292, label %if.end.i281
if.end.i281: ; preds = %while.cond.preheader.i249.preheader
%call1.i282 = tail call i32 @stotag(ptr noundef nonnull %call.i239)
%idxprom.i283 = sext i32 %call1.i282 to i64
%arrayidx.i284 = getelementptr inbounds i8, ptr %31, i64 %idxprom.i283
%33 = load i8, ptr %arrayidx.i284, align 1, !tbaa !13
%tobool.not.i285 = icmp eq i8 %33, 0
br i1 %tobool.not.i285, label %if.end3.i287, label %if.end53
if.end3.i287: ; preds = %if.end.i281
%conv.i288 = trunc i32 %add47 to i8
store i8 %conv.i288, ptr %arrayidx.i284, align 1, !tbaa !13
%34 = load ptr, ptr @que, align 8, !tbaa !15
%35 = load i32, ptr @rear, align 4, !tbaa !9
%idxprom6.i289 = sext i32 %35 to i64
%arrayidx7.i290 = getelementptr inbounds i32, ptr %34, i64 %idxprom6.i289
store i32 %call1.i282, ptr %arrayidx7.i290, align 4, !tbaa !9
%36 = load i32, ptr @rear, align 4, !tbaa !9
%inc.i291 = add nsw i32 %36, 1
store i32 %inc.i291, ptr @rear, align 4, !tbaa !9
br label %if.end53
create.exit292: ; preds = %while.cond.preheader.i249.preheader
%tobool49.not = icmp eq i32 %add47, 0
br i1 %tobool49.not, label %if.end53, label %cleanup
if.end53: ; preds = %if.end3.i287, %if.end.i281, %if.end38, %create.exit292
%cmp40.not336 = phi i1 [ false, %create.exit292 ], [ true, %if.end38 ], [ false, %if.end.i281 ], [ false, %if.end3.i287 ]
%retval.0.i248335 = phi ptr [ %call.i239, %create.exit292 ], [ null, %if.end38 ], [ %call.i239, %if.end.i281 ], [ %call.i239, %if.end3.i287 ]
%cmp25.not319326334 = phi i1 [ %cmp.i181, %create.exit292 ], [ false, %if.end38 ], [ %cmp.i181, %if.end.i281 ], [ %cmp.i181, %if.end3.i287 ]
%retval.0.i192318328333 = phi ptr [ %retval.0.i192318327, %create.exit292 ], [ %call.i183, %if.end38 ], [ %retval.0.i192318327, %if.end.i281 ], [ %retval.0.i192318327, %if.end3.i287 ]
tail call void @free(ptr noundef nonnull %call) #19
br i1 %cmp.not296303311, label %if.end57, label %if.then56
if.then56: ; preds = %if.end53
tail call void @free(ptr noundef %retval.0.i295305310) #19
br label %if.end57
if.end57: ; preds = %if.then56, %if.end53
br i1 %cmp10.not313, label %if.end61, label %if.then60
if.then60: ; preds = %if.end57
tail call void @free(ptr noundef %retval.0.i136312) #19
br label %if.end61
if.end61: ; preds = %if.then60, %if.end57
br i1 %cmp25.not319326334, label %if.end65, label %if.then64
if.then64: ; preds = %if.end61
tail call void @free(ptr noundef %retval.0.i192318328333) #19
br label %if.end65
if.end65: ; preds = %if.then64, %if.end61
br i1 %cmp40.not336, label %if.end69, label %if.then68
if.then68: ; preds = %if.end65
tail call void @free(ptr noundef %retval.0.i248335) #19
br label %if.end69
if.end69: ; preds = %if.then68, %if.end65
%37 = load i32, ptr @head, align 4, !tbaa !9
%inc = add nsw i32 %37, 1
store i32 %inc, ptr @head, align 4, !tbaa !9
br label %cleanup
cleanup: ; preds = %create.exit292, %create.exit236, %create.exit180, %create.exit, %if.end69
%retval.0 = phi i32 [ 0, %if.end69 ], [ %add, %create.exit ], [ %add17, %create.exit180 ], [ %add32, %create.exit236 ], [ %add47, %create.exit292 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #13
; Function Attrs: nounwind uwtable
define dso_local i32 @solve(ptr nocapture noundef readonly %s0) local_unnamed_addr #12 {
entry:
%call.i = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %s0, ptr noundef nonnull dereferenceable(10) @__const.distance.s) #20
%cmp.i = icmp eq i32 %call.i, 0
br i1 %cmp.i, label %cleanup, label %if.end.i
if.end.i: ; preds = %entry
%call1.i = tail call i32 @stotag(ptr noundef %s0)
%0 = load ptr, ptr @flag, align 8, !tbaa !15
%idxprom.i = sext i32 %call1.i to i64
%arrayidx.i = getelementptr inbounds i8, ptr %0, i64 %idxprom.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !13
%tobool.not.i = icmp eq i8 %1, 0
br i1 %tobool.not.i, label %if.end3.i, label %while.cond.preheader
if.end3.i: ; preds = %if.end.i
store i8 1, ptr %arrayidx.i, align 1, !tbaa !13
%2 = load ptr, ptr @que, align 8, !tbaa !15
%3 = load i32, ptr @rear, align 4, !tbaa !9
%idxprom6.i = sext i32 %3 to i64
%arrayidx7.i = getelementptr inbounds i32, ptr %2, i64 %idxprom6.i
store i32 %call1.i, ptr %arrayidx7.i, align 4, !tbaa !9
%4 = load i32, ptr @rear, align 4, !tbaa !9
%inc.i = add nsw i32 %4, 1
store i32 %inc.i, ptr @rear, align 4, !tbaa !9
br label %while.cond.preheader
while.cond.preheader: ; preds = %if.end.i, %if.end3.i
br label %while.cond
while.cond: ; preds = %while.cond.preheader, %while.body
%call1 = tail call i32 @cal()
%tobool2.not = icmp eq i32 %call1, 0
br i1 %tobool2.not, label %while.body, label %cleanup
while.body: ; preds = %while.cond
%5 = load i32, ptr @head, align 4, !tbaa !9
%6 = load i32, ptr @rear, align 4, !tbaa !9
%cmp = icmp eq i32 %5, %6
br i1 %cmp, label %cleanup, label %while.cond, !llvm.loop !22
cleanup: ; preds = %while.cond, %while.body, %entry
%retval.0 = phi i32 [ 1, %entry ], [ %call1, %while.cond ], [ 0, %while.body ]
ret i32 %retval.0
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #12 {
cal_factorial.exit.9:
%d = alloca i32, align 4
%s = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #19
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %s) #19
store <4 x i32> <i32 1, i32 1, i32 2, i32 6>, ptr @factorial, align 16, !tbaa !9
store <4 x i32> <i32 24, i32 120, i32 720, i32 5040>, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 4), align 16, !tbaa !9
store i32 40320, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 8), align 16, !tbaa !9
store i32 362880, ptr getelementptr inbounds ([10 x i32], ptr @factorial, i64 0, i64 9), align 4, !tbaa !9
%calloc = tail call dereferenceable_or_null(362880) ptr @calloc(i64 1, i64 362880)
store ptr %calloc, ptr @flag, align 8, !tbaa !15
%call5 = tail call noalias dereferenceable_or_null(1451520) ptr @malloc(i64 noundef 1451520) #18
store ptr %call5, ptr @que, align 8, !tbaa !15
store i32 0, ptr @head, align 4, !tbaa !9
store i32 0, ptr @rear, align 4, !tbaa !9
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d)
%0 = load i32, ptr %d, align 4, !tbaa !9
%1 = trunc i32 %0 to i8
%conv11 = add i8 %1, 48
store i8 %conv11, ptr %s, align 1, !tbaa !13
%call10.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d)
%2 = load i32, ptr %d, align 4, !tbaa !9
%3 = trunc i32 %2 to i8
%conv11.1 = add i8 %3, 48
%arrayidx13.1 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 1
store i8 %conv11.1, ptr %arrayidx13.1, align 1, !tbaa !13
%call10.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d)
%4 = load i32, ptr %d, align 4, !tbaa !9
%5 = trunc i32 %4 to i8
%conv11.2 = add i8 %5, 48
%arrayidx13.2 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 2
store i8 %conv11.2, ptr %arrayidx13.2, align 1, !tbaa !13
%call10.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d)
%6 = load i32, ptr %d, align 4, !tbaa !9
%7 = trunc i32 %6 to i8
%conv11.3 = add i8 %7, 48
%arrayidx13.3 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 3
store i8 %conv11.3, ptr %arrayidx13.3, align 1, !tbaa !13
%call10.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d)
%8 = load i32, ptr %d, align 4, !tbaa !9
%9 = trunc i32 %8 to i8
%conv11.4 = add i8 %9, 48
%arrayidx13.4 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 4
store i8 %conv11.4, ptr %arrayidx13.4, align 1, !tbaa !13
%call10.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d)
%10 = load i32, ptr %d, align 4, !tbaa !9
%11 = trunc i32 %10 to i8
%conv11.5 = add i8 %11, 48
%arrayidx13.5 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 5
store i8 %conv11.5, ptr %arrayidx13.5, align 1, !tbaa !13
%call10.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d)
%12 = load i32, ptr %d, align 4, !tbaa !9
%13 = trunc i32 %12 to i8
%conv11.6 = add i8 %13, 48
%arrayidx13.6 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 6
store i8 %conv11.6, ptr %arrayidx13.6, align 1, !tbaa !13
%call10.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d)
%14 = load i32, ptr %d, align 4, !tbaa !9
%15 = trunc i32 %14 to i8
%conv11.7 = add i8 %15, 48
%arrayidx13.7 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 7
store i8 %conv11.7, ptr %arrayidx13.7, align 1, !tbaa !13
%call10.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %d)
%16 = load i32, ptr %d, align 4, !tbaa !9
%17 = trunc i32 %16 to i8
%conv11.8 = add i8 %17, 48
%arrayidx13.8 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 8
store i8 %conv11.8, ptr %arrayidx13.8, align 1, !tbaa !13
%arrayidx17 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 9
store i8 0, ptr %arrayidx17, align 1, !tbaa !13
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(10) %s, ptr noundef nonnull dereferenceable(10) @__const.distance.s, i64 10)
%cmp.i.i = icmp eq i32 %bcmp, 0
br i1 %cmp.i.i, label %solve.exit, label %if.end.i.i
if.end.i.i: ; preds = %cal_factorial.exit.9
%call1.i.i = call i32 @stotag(ptr noundef nonnull %s)
%18 = load ptr, ptr @flag, align 8, !tbaa !15
%idxprom.i.i = sext i32 %call1.i.i to i64
%arrayidx.i.i = getelementptr inbounds i8, ptr %18, i64 %idxprom.i.i
%19 = load i8, ptr %arrayidx.i.i, align 1, !tbaa !13
%tobool.not.i.i = icmp eq i8 %19, 0
br i1 %tobool.not.i.i, label %if.end3.i.i, label %while.cond.i.preheader
if.end3.i.i: ; preds = %if.end.i.i
store i8 1, ptr %arrayidx.i.i, align 1, !tbaa !13
%20 = load ptr, ptr @que, align 8, !tbaa !15
%21 = load i32, ptr @rear, align 4, !tbaa !9
%idxprom6.i.i = sext i32 %21 to i64
%arrayidx7.i.i = getelementptr inbounds i32, ptr %20, i64 %idxprom6.i.i
store i32 %call1.i.i, ptr %arrayidx7.i.i, align 4, !tbaa !9
%22 = load i32, ptr @rear, align 4, !tbaa !9
%inc.i.i = add nsw i32 %22, 1
store i32 %inc.i.i, ptr @rear, align 4, !tbaa !9
br label %while.cond.i.preheader
while.cond.i.preheader: ; preds = %if.end3.i.i, %if.end.i.i
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i.preheader, %while.body.i
%call1.i = call i32 @cal()
%tobool2.not.i = icmp eq i32 %call1.i, 0
br i1 %tobool2.not.i, label %while.body.i, label %solve.exit.loopexit
while.body.i: ; preds = %while.cond.i
%23 = load i32, ptr @head, align 4, !tbaa !9
%24 = load i32, ptr @rear, align 4, !tbaa !9
%cmp.i26 = icmp eq i32 %23, %24
br i1 %cmp.i26, label %solve.exit.loopexit, label %while.cond.i, !llvm.loop !22
solve.exit.loopexit: ; preds = %while.body.i, %while.cond.i
%25 = add nsw i32 %call1.i, -1
br label %solve.exit
solve.exit: ; preds = %solve.exit.loopexit, %cal_factorial.exit.9
%retval.0.i = phi i32 [ 0, %cal_factorial.exit.9 ], [ %25, %solve.exit.loopexit ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %retval.0.i)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %s) #19
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #19
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #14
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #14
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #15
; Function Attrs: nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #16
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #17
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.ctpop.i8(i8) #17
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 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(readwrite, argmem: 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 = { 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 #5 = { mustprogress nofree nounwind willreturn uwtable "min-legal-vector-width"="0" "no-trapping-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 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 #7 = { mustprogress nofree nounwind willreturn memory(readwrite, 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 #8 = { 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 #9 = { nofree 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 #10 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #11 = { 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 #12 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #13 = { 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 #14 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #15 = { nofree nounwind willreturn memory(argmem: read) }
attributes #16 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #17 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #18 = { nounwind allocsize(0) }
attributes #19 = { nounwind }
attributes #20 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6, !7}
!6 = !{!"llvm.loop.isvectorized", i32 1}
!7 = !{!"llvm.loop.unroll.runtime.disable"}
!8 = distinct !{!8, !7, !6}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C/C++ TBAA"}
!13 = !{!11, !11, i64 0}
!14 = !{i8 0, i8 9}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !11, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define T 1
#define F 0
#define N 3
int dx[4]={0,-1,0,1};
int dy[4]={1,0,-1,0};
int lim;
int p[N][N];
int huristic()
{
int i,j,n,sum=0;
for (i=0;i<N;i++)
{
for(j=0;j<N;j++)
{
if(p[i][j]==0)continue;
n=p[i][j]-1;
sum+=abs(n/N-i)+abs(n%N-j);
}
}
return sum;
}
int dfs(int d,int pre,int y,int x)
{
int h = huristic();
int i;
if(h==0)return T;
if(lim<d+h) return F;
for(i=0;i<4;i++)
{
if(abs(i-pre)==2)continue;
int tx=x+dx[i],ty=y+dy[i];
if (tx<0||ty<0||tx>=N||ty>= N)continue;
int tmp=p[ty][tx];
p[ty][tx]=p[y][x];
p[y][x]=tmp;
if(dfs(d+1,i,ty,tx))return T;
tmp=p[ty][tx];
p[ty][tx]=p[y][x];
p[y][x]=tmp;
}
return F;
}
void azl(int x,int y)
{
for(lim=0;;lim++)
{
if(dfs(0,99,y,x))
{
printf("%d\n",lim);
return;
}
}
}
int main()
{
int i,j;
int a,b;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&p[i][j]);
if(p[i][j]==0)
{
b=i;a=j;
}
}
}
azl(a,b);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189098/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189098/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@dx = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 -1, i32 0, i32 1], align 16
@dy = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 0, i32 -1, i32 0], align 16
@p = dso_local global [3 x [3 x i32]] zeroinitializer, align 16
@lim = dso_local local_unnamed_addr global i32 0, align 4
@.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
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @huristic() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @p, align 16, !tbaa !5
%cmp6 = icmp eq i32 %0, 0
br i1 %cmp6, label %for.inc, label %if.end
if.end: ; preds = %entry
%sub = add nsw i32 %0, -1
%div = sdiv i32 %sub, 3
%1 = tail call i32 @llvm.abs.i32(i32 %div, i1 true)
%rem = srem i32 %sub, 3
%2 = tail call i32 @llvm.abs.i32(i32 %rem, i1 true)
%add13 = add nuw nsw i32 %2, %1
br label %for.inc
for.inc: ; preds = %entry, %if.end
%sum.2 = phi i32 [ 0, %entry ], [ %add13, %if.end ]
%3 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 0, i64 1), align 4, !tbaa !5
%cmp6.1 = icmp eq i32 %3, 0
br i1 %cmp6.1, label %for.inc.1, label %if.end.1
if.end.1: ; preds = %for.inc
%sub.1 = add nsw i32 %3, -1
%div.1 = sdiv i32 %sub.1, 3
%4 = tail call i32 @llvm.abs.i32(i32 %div.1, i1 true)
%rem.1 = srem i32 %sub.1, 3
%sub12.1 = add nsw i32 %rem.1, -1
%5 = tail call i32 @llvm.abs.i32(i32 %sub12.1, i1 true)
%add.1 = add nuw nsw i32 %5, %sum.2
%add13.1 = add nuw nsw i32 %add.1, %4
br label %for.inc.1
for.inc.1: ; preds = %if.end.1, %for.inc
%sum.2.1 = phi i32 [ %sum.2, %for.inc ], [ %add13.1, %if.end.1 ]
%6 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 0, i64 2), align 8, !tbaa !5
%cmp6.2 = icmp eq i32 %6, 0
br i1 %cmp6.2, label %for.inc.2, label %if.end.2
if.end.2: ; preds = %for.inc.1
%sub.2 = add nsw i32 %6, -1
%div.2 = sdiv i32 %sub.2, 3
%7 = tail call i32 @llvm.abs.i32(i32 %div.2, i1 true)
%rem.2 = srem i32 %sub.2, 3
%reass.sub = sub i32 %sum.2.1, %rem.2
%add.2 = add i32 %reass.sub, 2
%add13.2 = add nuw i32 %add.2, %7
br label %for.inc.2
for.inc.2: ; preds = %if.end.2, %for.inc.1
%sum.2.2 = phi i32 [ %sum.2.1, %for.inc.1 ], [ %add13.2, %if.end.2 ]
%8 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 1, i64 0), align 4, !tbaa !5
%cmp6.134 = icmp eq i32 %8, 0
br i1 %cmp6.134, label %for.inc.143, label %if.end.141
if.end.141: ; preds = %for.inc.2
%sub.135 = add nsw i32 %8, -1
%div.136 = sdiv i32 %sub.135, 3
%sub11.137 = add nsw i32 %div.136, -1
%9 = tail call i32 @llvm.abs.i32(i32 %sub11.137, i1 true)
%rem.138 = srem i32 %sub.135, 3
%10 = tail call i32 @llvm.abs.i32(i32 %rem.138, i1 true)
%add.139 = add nuw i32 %10, %sum.2.2
%add13.140 = add nuw i32 %add.139, %9
br label %for.inc.143
for.inc.143: ; preds = %if.end.141, %for.inc.2
%sum.2.142 = phi i32 [ %sum.2.2, %for.inc.2 ], [ %add13.140, %if.end.141 ]
%11 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 1, i64 1), align 16, !tbaa !5
%cmp6.1.1 = icmp eq i32 %11, 0
br i1 %cmp6.1.1, label %for.inc.1.1, label %if.end.1.1
if.end.1.1: ; preds = %for.inc.143
%sub.1.1 = add nsw i32 %11, -1
%div.1.1 = sdiv i32 %sub.1.1, 3
%sub11.1.1 = add nsw i32 %div.1.1, -1
%12 = tail call i32 @llvm.abs.i32(i32 %sub11.1.1, i1 true)
%rem.1.1 = srem i32 %sub.1.1, 3
%sub12.1.1 = add nsw i32 %rem.1.1, -1
%13 = tail call i32 @llvm.abs.i32(i32 %sub12.1.1, i1 true)
%add.1.1 = add nuw i32 %13, %sum.2.142
%add13.1.1 = add nuw i32 %add.1.1, %12
br label %for.inc.1.1
for.inc.1.1: ; preds = %if.end.1.1, %for.inc.143
%sum.2.1.1 = phi i32 [ %sum.2.142, %for.inc.143 ], [ %add13.1.1, %if.end.1.1 ]
%14 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 1, i64 2), align 4, !tbaa !5
%cmp6.2.1 = icmp eq i32 %14, 0
br i1 %cmp6.2.1, label %for.inc.2.1, label %if.end.2.1
if.end.2.1: ; preds = %for.inc.1.1
%sub.2.1 = add nsw i32 %14, -1
%div.2.1 = sdiv i32 %sub.2.1, 3
%sub11.2.1 = add nsw i32 %div.2.1, -1
%15 = tail call i32 @llvm.abs.i32(i32 %sub11.2.1, i1 true)
%rem.2.1 = srem i32 %sub.2.1, 3
%reass.sub55 = sub i32 %sum.2.1.1, %rem.2.1
%add.2.1 = add i32 %reass.sub55, 2
%add13.2.1 = add i32 %add.2.1, %15
br label %for.inc.2.1
for.inc.2.1: ; preds = %if.end.2.1, %for.inc.1.1
%sum.2.2.1 = phi i32 [ %sum.2.1.1, %for.inc.1.1 ], [ %add13.2.1, %if.end.2.1 ]
%16 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 2, i64 0), align 8, !tbaa !5
%cmp6.245 = icmp eq i32 %16, 0
br i1 %cmp6.245, label %for.inc.254, label %if.end.252
if.end.252: ; preds = %for.inc.2.1
%sub.246 = add nsw i32 %16, -1
%div.247 = sdiv i32 %sub.246, 3
%sub11.248 = add nsw i32 %div.247, -2
%17 = tail call i32 @llvm.abs.i32(i32 %sub11.248, i1 true)
%rem.249 = srem i32 %sub.246, 3
%18 = tail call i32 @llvm.abs.i32(i32 %rem.249, i1 true)
%add.250 = add i32 %18, %sum.2.2.1
%add13.251 = add i32 %add.250, %17
br label %for.inc.254
for.inc.254: ; preds = %if.end.252, %for.inc.2.1
%sum.2.253 = phi i32 [ %sum.2.2.1, %for.inc.2.1 ], [ %add13.251, %if.end.252 ]
%19 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 2, i64 1), align 4, !tbaa !5
%cmp6.1.2 = icmp eq i32 %19, 0
br i1 %cmp6.1.2, label %for.inc.1.2, label %if.end.1.2
if.end.1.2: ; preds = %for.inc.254
%sub.1.2 = add nsw i32 %19, -1
%div.1.2 = sdiv i32 %sub.1.2, 3
%sub11.1.2 = add nsw i32 %div.1.2, -2
%20 = tail call i32 @llvm.abs.i32(i32 %sub11.1.2, i1 true)
%rem.1.2 = srem i32 %sub.1.2, 3
%sub12.1.2 = add nsw i32 %rem.1.2, -1
%21 = tail call i32 @llvm.abs.i32(i32 %sub12.1.2, i1 true)
%add.1.2 = add i32 %21, %sum.2.253
%add13.1.2 = add i32 %add.1.2, %20
br label %for.inc.1.2
for.inc.1.2: ; preds = %if.end.1.2, %for.inc.254
%sum.2.1.2 = phi i32 [ %sum.2.253, %for.inc.254 ], [ %add13.1.2, %if.end.1.2 ]
%22 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 2, i64 2), align 16, !tbaa !5
%cmp6.2.2 = icmp eq i32 %22, 0
br i1 %cmp6.2.2, label %for.inc.2.2, label %if.end.2.2
if.end.2.2: ; preds = %for.inc.1.2
%sub.2.2 = add nsw i32 %22, -1
%div.2.2 = sdiv i32 %sub.2.2, 3
%sub11.2.2 = add nsw i32 %div.2.2, -2
%23 = tail call i32 @llvm.abs.i32(i32 %sub11.2.2, i1 true)
%rem.2.2 = srem i32 %sub.2.2, 3
%reass.sub56 = sub i32 %sum.2.1.2, %rem.2.2
%add.2.2 = add i32 %reass.sub56, 2
%add13.2.2 = add i32 %add.2.2, %23
br label %for.inc.2.2
for.inc.2.2: ; preds = %if.end.2.2, %for.inc.1.2
%sum.2.2.2 = phi i32 [ %sum.2.1.2, %for.inc.1.2 ], [ %add13.2.2, %if.end.2.2 ]
ret i32 %sum.2.2.2
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i32 @dfs(i32 noundef %d, i32 noundef %pre, i32 noundef %y, i32 noundef %x) local_unnamed_addr #2 {
entry:
%call = tail call i32 @huristic()
%cmp = icmp eq i32 %call, 0
br i1 %cmp, label %cleanup58, label %if.end
if.end: ; preds = %entry
%0 = load i32, ptr @lim, align 4, !tbaa !5
%add = add nsw i32 %call, %d
%cmp1 = icmp slt i32 %0, %add
br i1 %cmp1, label %cleanup58, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end
%idxprom24 = sext i32 %y to i64
%idxprom26 = sext i32 %x to i64
%arrayidx27 = getelementptr inbounds [3 x [3 x i32]], ptr @p, i64 0, i64 %idxprom24, i64 %idxprom26
%add36 = add nsw i32 %d, 1
%1 = tail call i32 @llvm.abs.i32(i32 %pre, i1 true)
%cmp5 = icmp eq i32 %1, 2
br i1 %cmp5, label %for.inc, label %if.end7
if.end7: ; preds = %for.cond.preheader
%2 = load i32, ptr @dx, align 16, !tbaa !5
%add8 = add nsw i32 %2, %x
%3 = load i32, ptr @dy, align 16, !tbaa !5
%add11 = add nsw i32 %3, %y
%cmp13 = icmp slt i32 %add11, 0
%4 = icmp ugt i32 %add8, 2
%or.cond60 = select i1 %4, i1 true, i1 %cmp13
%cmp17 = icmp sgt i32 %add11, 2
%or.cond61 = select i1 %or.cond60, i1 true, i1 %cmp17
br i1 %or.cond61, label %for.inc, label %if.end19
if.end19: ; preds = %if.end7
%idxprom20 = zext i32 %add11 to i64
%idxprom22 = zext i32 %add8 to i64
%arrayidx23 = getelementptr inbounds [3 x [3 x i32]], ptr @p, i64 0, i64 %idxprom20, i64 %idxprom22
%5 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%6 = load i32, ptr %arrayidx27, align 4, !tbaa !5
store i32 %6, ptr %arrayidx23, align 4, !tbaa !5
store i32 %5, ptr %arrayidx27, align 4, !tbaa !5
%call37 = tail call i32 @dfs(i32 noundef %add36, i32 noundef 0, i32 noundef %add11, i32 noundef %add8)
%tobool.not = icmp eq i32 %call37, 0
br i1 %tobool.not, label %if.end39, label %cleanup58
if.end39: ; preds = %if.end19
%7 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%8 = load i32, ptr %arrayidx27, align 4, !tbaa !5
store i32 %8, ptr %arrayidx23, align 4, !tbaa !5
store i32 %7, ptr %arrayidx27, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end39, %if.end7, %for.cond.preheader
%sub.1 = sub nsw i32 1, %pre
%9 = tail call i32 @llvm.abs.i32(i32 %sub.1, i1 true)
%cmp5.1 = icmp eq i32 %9, 2
br i1 %cmp5.1, label %for.inc.1, label %if.end7.1
if.end7.1: ; preds = %for.inc
%10 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 1), align 4, !tbaa !5
%add8.1 = add nsw i32 %10, %x
%11 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 1), align 4, !tbaa !5
%add11.1 = add nsw i32 %11, %y
%cmp13.1 = icmp slt i32 %add11.1, 0
%12 = icmp ugt i32 %add8.1, 2
%or.cond60.1 = select i1 %12, i1 true, i1 %cmp13.1
%cmp17.1 = icmp sgt i32 %add11.1, 2
%or.cond61.1 = select i1 %or.cond60.1, i1 true, i1 %cmp17.1
br i1 %or.cond61.1, label %for.inc.1, label %if.end19.1
if.end19.1: ; preds = %if.end7.1
%idxprom20.1 = zext i32 %add11.1 to i64
%idxprom22.1 = zext i32 %add8.1 to i64
%arrayidx23.1 = getelementptr inbounds [3 x [3 x i32]], ptr @p, i64 0, i64 %idxprom20.1, i64 %idxprom22.1
%13 = load i32, ptr %arrayidx23.1, align 4, !tbaa !5
%14 = load i32, ptr %arrayidx27, align 4, !tbaa !5
store i32 %14, ptr %arrayidx23.1, align 4, !tbaa !5
store i32 %13, ptr %arrayidx27, align 4, !tbaa !5
%call37.1 = tail call i32 @dfs(i32 noundef %add36, i32 noundef 1, i32 noundef %add11.1, i32 noundef %add8.1)
%tobool.not.1 = icmp eq i32 %call37.1, 0
br i1 %tobool.not.1, label %if.end39.1, label %cleanup58
if.end39.1: ; preds = %if.end19.1
%15 = load i32, ptr %arrayidx23.1, align 4, !tbaa !5
%16 = load i32, ptr %arrayidx27, align 4, !tbaa !5
store i32 %16, ptr %arrayidx23.1, align 4, !tbaa !5
store i32 %15, ptr %arrayidx27, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.end39.1, %if.end7.1, %for.inc
%sub.2 = sub nsw i32 2, %pre
%17 = tail call i32 @llvm.abs.i32(i32 %sub.2, i1 true)
%cmp5.2 = icmp eq i32 %17, 2
br i1 %cmp5.2, label %for.inc.2, label %if.end7.2
if.end7.2: ; preds = %for.inc.1
%18 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 2), align 8, !tbaa !5
%add8.2 = add nsw i32 %18, %x
%19 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 2), align 8, !tbaa !5
%add11.2 = add nsw i32 %19, %y
%cmp13.2 = icmp slt i32 %add11.2, 0
%20 = icmp ugt i32 %add8.2, 2
%or.cond60.2 = select i1 %20, i1 true, i1 %cmp13.2
%cmp17.2 = icmp sgt i32 %add11.2, 2
%or.cond61.2 = select i1 %or.cond60.2, i1 true, i1 %cmp17.2
br i1 %or.cond61.2, label %for.inc.2, label %if.end19.2
if.end19.2: ; preds = %if.end7.2
%idxprom20.2 = zext i32 %add11.2 to i64
%idxprom22.2 = zext i32 %add8.2 to i64
%arrayidx23.2 = getelementptr inbounds [3 x [3 x i32]], ptr @p, i64 0, i64 %idxprom20.2, i64 %idxprom22.2
%21 = load i32, ptr %arrayidx23.2, align 4, !tbaa !5
%22 = load i32, ptr %arrayidx27, align 4, !tbaa !5
store i32 %22, ptr %arrayidx23.2, align 4, !tbaa !5
store i32 %21, ptr %arrayidx27, align 4, !tbaa !5
%call37.2 = tail call i32 @dfs(i32 noundef %add36, i32 noundef 2, i32 noundef %add11.2, i32 noundef %add8.2)
%tobool.not.2 = icmp eq i32 %call37.2, 0
br i1 %tobool.not.2, label %if.end39.2, label %cleanup58
if.end39.2: ; preds = %if.end19.2
%23 = load i32, ptr %arrayidx23.2, align 4, !tbaa !5
%24 = load i32, ptr %arrayidx27, align 4, !tbaa !5
store i32 %24, ptr %arrayidx23.2, align 4, !tbaa !5
store i32 %23, ptr %arrayidx27, align 4, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.end39.2, %if.end7.2, %for.inc.1
%sub.3 = sub nsw i32 3, %pre
%25 = tail call i32 @llvm.abs.i32(i32 %sub.3, i1 true)
%cmp5.3 = icmp eq i32 %25, 2
br i1 %cmp5.3, label %cleanup58, label %if.end7.3
if.end7.3: ; preds = %for.inc.2
%26 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 3), align 4, !tbaa !5
%add8.3 = add nsw i32 %26, %x
%27 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 3), align 4, !tbaa !5
%add11.3 = add nsw i32 %27, %y
%cmp13.3 = icmp slt i32 %add11.3, 0
%28 = icmp ugt i32 %add8.3, 2
%or.cond60.3 = select i1 %28, i1 true, i1 %cmp13.3
%cmp17.3 = icmp sgt i32 %add11.3, 2
%or.cond61.3 = select i1 %or.cond60.3, i1 true, i1 %cmp17.3
br i1 %or.cond61.3, label %cleanup58, label %if.end19.3
if.end19.3: ; preds = %if.end7.3
%idxprom20.3 = zext i32 %add11.3 to i64
%idxprom22.3 = zext i32 %add8.3 to i64
%arrayidx23.3 = getelementptr inbounds [3 x [3 x i32]], ptr @p, i64 0, i64 %idxprom20.3, i64 %idxprom22.3
%29 = load i32, ptr %arrayidx23.3, align 4, !tbaa !5
%30 = load i32, ptr %arrayidx27, align 4, !tbaa !5
store i32 %30, ptr %arrayidx23.3, align 4, !tbaa !5
store i32 %29, ptr %arrayidx27, align 4, !tbaa !5
%call37.3 = tail call i32 @dfs(i32 noundef %add36, i32 noundef 3, i32 noundef %add11.3, i32 noundef %add8.3)
%tobool.not.3 = icmp eq i32 %call37.3, 0
br i1 %tobool.not.3, label %if.end39.3, label %cleanup58
if.end39.3: ; preds = %if.end19.3
%31 = load i32, ptr %arrayidx23.3, align 4, !tbaa !5
%32 = load i32, ptr %arrayidx27, align 4, !tbaa !5
store i32 %32, ptr %arrayidx23.3, align 4, !tbaa !5
store i32 %31, ptr %arrayidx27, align 4, !tbaa !5
br label %cleanup58
cleanup58: ; preds = %if.end19, %if.end19.1, %if.end19.2, %if.end19.3, %if.end39.3, %if.end7.3, %for.inc.2, %if.end, %entry
%retval.4 = phi i32 [ 1, %entry ], [ 0, %if.end ], [ 1, %if.end19 ], [ 1, %if.end19.1 ], [ 1, %if.end19.2 ], [ 1, %if.end19.3 ], [ 0, %if.end39.3 ], [ 0, %if.end7.3 ], [ 0, %for.inc.2 ]
ret i32 %retval.4
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @azl(i32 noundef %x, i32 noundef %y) local_unnamed_addr #3 {
entry:
store i32 0, ptr @lim, align 4, !tbaa !5
%call2 = tail call i32 @dfs(i32 noundef 0, i32 noundef 99, i32 noundef %y, i32 noundef %x)
%tobool.not3 = icmp eq i32 %call2, 0
br i1 %tobool.not3, label %for.inc, label %if.then
if.then: ; preds = %for.inc, %entry
%0 = load i32, ptr @lim, align 4, !tbaa !5
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
ret void
for.inc: ; preds = %entry, %for.inc
%1 = load i32, ptr @lim, align 4, !tbaa !5
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @lim, align 4, !tbaa !5
%call = tail call i32 @dfs(i32 noundef 0, i32 noundef 99, i32 noundef %y, i32 noundef %x)
%tobool.not = icmp eq i32 %call, 0
br i1 %tobool.not, label %for.inc, label %if.then
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @p)
%call.1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 0, i64 1))
%0 = load <4 x i32>, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 0, i64 1), align 4
%1 = shufflevector <4 x i32> %0, <4 x i32> poison, <8 x i32> <i32 0, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%call.2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 0, i64 2))
%2 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 0, i64 2), align 8, !tbaa !5
%call.132 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 1, i64 0))
%3 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 1, i64 0), align 4, !tbaa !5
%call.1.1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 1, i64 1))
%4 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 1, i64 1), align 16, !tbaa !5
%call.2.1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 1, i64 2))
%5 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 1, i64 2), align 4, !tbaa !5
%call.237 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 2, i64 0))
%6 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 2, i64 0), align 8, !tbaa !5
%call.1.2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 2, i64 1))
%7 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 2, i64 1), align 4, !tbaa !5
%call.2.2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 2, i64 2))
%8 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @p, i64 0, i64 2, i64 2), align 16, !tbaa !5
%9 = insertelement <8 x i32> %1, i32 %2, i64 1
%10 = insertelement <8 x i32> %9, i32 %3, i64 2
%11 = insertelement <8 x i32> %10, i32 %4, i64 3
%12 = insertelement <8 x i32> %11, i32 %5, i64 4
%13 = insertelement <8 x i32> %12, i32 %6, i64 5
%14 = insertelement <8 x i32> %13, i32 %7, i64 6
%15 = insertelement <8 x i32> %14, i32 %8, i64 7
%16 = icmp eq <8 x i32> %15, zeroinitializer
%17 = extractelement <8 x i1> %16, i64 0
%spec.select.1 = zext i1 %17 to i32
%18 = extractelement <8 x i1> %16, i64 1
%spec.select.2 = select i1 %18, i32 2, i32 %spec.select.1
%19 = extractelement <8 x i1> %16, i64 2
%spec.select.134 = select i1 %19, i32 0, i32 %spec.select.2
%20 = extractelement <8 x i1> %16, i64 3
%spec.select.1.1 = select i1 %20, i32 1, i32 %spec.select.134
%21 = extractelement <8 x i1> %16, i64 4
%spec.select.2.1 = select i1 %21, i32 2, i32 %spec.select.1.1
%22 = select i1 %21, i1 true, i1 %20
%narrow41 = select i1 %22, i1 true, i1 %19
%spec.select22.2.1 = zext i1 %narrow41 to i32
%23 = extractelement <8 x i1> %16, i64 5
%spec.select.239 = select i1 %23, i32 0, i32 %spec.select.2.1
%24 = extractelement <8 x i1> %16, i64 6
%spec.select.1.2 = select i1 %24, i32 1, i32 %spec.select.239
%25 = extractelement <8 x i1> %16, i64 7
%spec.select.2.2 = select i1 %25, i32 2, i32 %spec.select.1.2
%26 = select i1 %25, i1 true, i1 %24
%27 = select i1 %26, i1 true, i1 %23
%spec.select22.2.2 = select i1 %27, i32 2, i32 %spec.select22.2.1
store i32 0, ptr @lim, align 4, !tbaa !5
%call2.i = tail call i32 @dfs(i32 noundef 0, i32 noundef 99, i32 noundef %spec.select22.2.2, i32 noundef %spec.select.2.2)
%tobool.not3.i = icmp eq i32 %call2.i, 0
br i1 %tobool.not3.i, label %for.inc.i, label %azl.exit
for.inc.i: ; preds = %entry, %for.inc.i
%28 = load i32, ptr @lim, align 4, !tbaa !5
%inc.i = add nsw i32 %28, 1
store i32 %inc.i, ptr @lim, align 4, !tbaa !5
%call.i = tail call i32 @dfs(i32 noundef 0, i32 noundef 99, i32 noundef %spec.select22.2.2, i32 noundef %spec.select.2.2)
%tobool.not.i = icmp eq i32 %call.i, 0
br i1 %tobool.not.i, label %for.inc.i, label %azl.exit
azl.exit: ; preds = %for.inc.i, %entry
%29 = load i32, ptr @lim, align 4, !tbaa !5
%call1.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %29)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { mustprogress nofree 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 #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#define N 3
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int count;
int A[N][N];
int abs(int a){
if(a > 0) return a;
else return a*-1;
}
void swap(int *x,int *y){
int tmp=*x;
*x=*y;
*y=tmp;
return ;
}
int Heuristic(){
int i,j,sum = 0,x;
for(i=0;i<N;i++){
for(j=0;j<N;j++){
if(A[i][j]==0)continue;
x = A[i][j] - 1;
sum+=abs(x/N - i)+abs(x%N - j);
}
}
return sum;
}
int move(int d,int pre,int s,int t){
int i,x,y,h = Heuristic();
if(h==0)return 1;
if(d+h > count)return 0;
for(i=0;i<4;i++){
if(abs(i - pre)==2)continue;/*return move*/
x = s + dy[i];
y = t + dx[i];
if(x<0||y<0||x>=N||y>=N)continue;/*frame over*/
swap(&A[x][y],&A[s][t]);
if(move(d+1,i,x,y))return 1;
swap(&A[x][y],&A[s][t]);/*return move because next move's starat is same this one */
}
return 0;
}
void counter(int s,int t){
count = 0;
while(1){
if(move(0,10,s,t)){
printf("%d\n",count);
return ;
}
count++;
}
}
int main(){
int i,j,s,t;
for(i=0;i<N;i++){
for(j=0;j<N;j++){
scanf("%d",&A[i][j]);
if(A[i][j]==0){
s = i;
t = j;
}
}
}
counter(s,t);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189140/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189140/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@dx = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 1, i32 0, i32 -1], align 16
@dy = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 0, i32 -1, i32 0], align 16
@A = dso_local global [3 x [3 x i32]] zeroinitializer, align 16
@count = dso_local local_unnamed_addr global i32 0, align 4
@.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
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @abs(i32 noundef %a) local_unnamed_addr #0 {
entry:
%retval.0 = tail call i32 @llvm.abs.i32(i32 %a, i1 true)
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %x, ptr nocapture noundef %y) local_unnamed_addr #1 {
entry:
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
store i32 %1, ptr %x, align 4, !tbaa !5
store i32 %0, ptr %y, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @Heuristic() local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @A, align 16, !tbaa !5
%cmp6 = icmp eq i32 %0, 0
br i1 %cmp6, label %for.inc, label %if.end
if.end: ; preds = %entry
%sub = add nsw i32 %0, -1
%div = sdiv i32 %sub, 3
%1 = tail call i32 @llvm.abs.i32(i32 %div, i1 true)
%rem = srem i32 %sub, 3
%2 = tail call i32 @llvm.abs.i32(i32 %rem, i1 true)
%add13 = add nuw nsw i32 %2, %1
br label %for.inc
for.inc: ; preds = %entry, %if.end
%sum.2 = phi i32 [ 0, %entry ], [ %add13, %if.end ]
%3 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 0, i64 1), align 4, !tbaa !5
%cmp6.1 = icmp eq i32 %3, 0
br i1 %cmp6.1, label %for.inc.1, label %if.end.1
if.end.1: ; preds = %for.inc
%sub.1 = add nsw i32 %3, -1
%div.1 = sdiv i32 %sub.1, 3
%4 = tail call i32 @llvm.abs.i32(i32 %div.1, i1 true)
%rem.1 = srem i32 %sub.1, 3
%sub12.1 = add nsw i32 %rem.1, -1
%5 = tail call i32 @llvm.abs.i32(i32 %sub12.1, i1 true)
%add.1 = add nuw nsw i32 %5, %sum.2
%add13.1 = add nuw nsw i32 %add.1, %4
br label %for.inc.1
for.inc.1: ; preds = %if.end.1, %for.inc
%sum.2.1 = phi i32 [ %sum.2, %for.inc ], [ %add13.1, %if.end.1 ]
%6 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 0, i64 2), align 8, !tbaa !5
%cmp6.2 = icmp eq i32 %6, 0
br i1 %cmp6.2, label %for.inc.2, label %if.end.2
if.end.2: ; preds = %for.inc.1
%sub.2 = add nsw i32 %6, -1
%div.2 = sdiv i32 %sub.2, 3
%7 = tail call i32 @llvm.abs.i32(i32 %div.2, i1 true)
%rem.2 = srem i32 %sub.2, 3
%reass.sub = sub i32 %sum.2.1, %rem.2
%add.2 = add i32 %reass.sub, 2
%add13.2 = add nuw i32 %add.2, %7
br label %for.inc.2
for.inc.2: ; preds = %if.end.2, %for.inc.1
%sum.2.2 = phi i32 [ %sum.2.1, %for.inc.1 ], [ %add13.2, %if.end.2 ]
%8 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 1, i64 0), align 4, !tbaa !5
%cmp6.134 = icmp eq i32 %8, 0
br i1 %cmp6.134, label %for.inc.143, label %if.end.141
if.end.141: ; preds = %for.inc.2
%sub.135 = add nsw i32 %8, -1
%div.136 = sdiv i32 %sub.135, 3
%sub11.137 = add nsw i32 %div.136, -1
%9 = tail call i32 @llvm.abs.i32(i32 %sub11.137, i1 true)
%rem.138 = srem i32 %sub.135, 3
%10 = tail call i32 @llvm.abs.i32(i32 %rem.138, i1 true)
%add.139 = add nuw i32 %10, %sum.2.2
%add13.140 = add nuw i32 %add.139, %9
br label %for.inc.143
for.inc.143: ; preds = %if.end.141, %for.inc.2
%sum.2.142 = phi i32 [ %sum.2.2, %for.inc.2 ], [ %add13.140, %if.end.141 ]
%11 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 1, i64 1), align 16, !tbaa !5
%cmp6.1.1 = icmp eq i32 %11, 0
br i1 %cmp6.1.1, label %for.inc.1.1, label %if.end.1.1
if.end.1.1: ; preds = %for.inc.143
%sub.1.1 = add nsw i32 %11, -1
%div.1.1 = sdiv i32 %sub.1.1, 3
%sub11.1.1 = add nsw i32 %div.1.1, -1
%12 = tail call i32 @llvm.abs.i32(i32 %sub11.1.1, i1 true)
%rem.1.1 = srem i32 %sub.1.1, 3
%sub12.1.1 = add nsw i32 %rem.1.1, -1
%13 = tail call i32 @llvm.abs.i32(i32 %sub12.1.1, i1 true)
%add.1.1 = add nuw i32 %13, %sum.2.142
%add13.1.1 = add nuw i32 %add.1.1, %12
br label %for.inc.1.1
for.inc.1.1: ; preds = %if.end.1.1, %for.inc.143
%sum.2.1.1 = phi i32 [ %sum.2.142, %for.inc.143 ], [ %add13.1.1, %if.end.1.1 ]
%14 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 1, i64 2), align 4, !tbaa !5
%cmp6.2.1 = icmp eq i32 %14, 0
br i1 %cmp6.2.1, label %for.inc.2.1, label %if.end.2.1
if.end.2.1: ; preds = %for.inc.1.1
%sub.2.1 = add nsw i32 %14, -1
%div.2.1 = sdiv i32 %sub.2.1, 3
%sub11.2.1 = add nsw i32 %div.2.1, -1
%15 = tail call i32 @llvm.abs.i32(i32 %sub11.2.1, i1 true)
%rem.2.1 = srem i32 %sub.2.1, 3
%reass.sub55 = sub i32 %sum.2.1.1, %rem.2.1
%add.2.1 = add i32 %reass.sub55, 2
%add13.2.1 = add i32 %add.2.1, %15
br label %for.inc.2.1
for.inc.2.1: ; preds = %if.end.2.1, %for.inc.1.1
%sum.2.2.1 = phi i32 [ %sum.2.1.1, %for.inc.1.1 ], [ %add13.2.1, %if.end.2.1 ]
%16 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 2, i64 0), align 8, !tbaa !5
%cmp6.245 = icmp eq i32 %16, 0
br i1 %cmp6.245, label %for.inc.254, label %if.end.252
if.end.252: ; preds = %for.inc.2.1
%sub.246 = add nsw i32 %16, -1
%div.247 = sdiv i32 %sub.246, 3
%sub11.248 = add nsw i32 %div.247, -2
%17 = tail call i32 @llvm.abs.i32(i32 %sub11.248, i1 true)
%rem.249 = srem i32 %sub.246, 3
%18 = tail call i32 @llvm.abs.i32(i32 %rem.249, i1 true)
%add.250 = add i32 %18, %sum.2.2.1
%add13.251 = add i32 %add.250, %17
br label %for.inc.254
for.inc.254: ; preds = %if.end.252, %for.inc.2.1
%sum.2.253 = phi i32 [ %sum.2.2.1, %for.inc.2.1 ], [ %add13.251, %if.end.252 ]
%19 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 2, i64 1), align 4, !tbaa !5
%cmp6.1.2 = icmp eq i32 %19, 0
br i1 %cmp6.1.2, label %for.inc.1.2, label %if.end.1.2
if.end.1.2: ; preds = %for.inc.254
%sub.1.2 = add nsw i32 %19, -1
%div.1.2 = sdiv i32 %sub.1.2, 3
%sub11.1.2 = add nsw i32 %div.1.2, -2
%20 = tail call i32 @llvm.abs.i32(i32 %sub11.1.2, i1 true)
%rem.1.2 = srem i32 %sub.1.2, 3
%sub12.1.2 = add nsw i32 %rem.1.2, -1
%21 = tail call i32 @llvm.abs.i32(i32 %sub12.1.2, i1 true)
%add.1.2 = add i32 %21, %sum.2.253
%add13.1.2 = add i32 %add.1.2, %20
br label %for.inc.1.2
for.inc.1.2: ; preds = %if.end.1.2, %for.inc.254
%sum.2.1.2 = phi i32 [ %sum.2.253, %for.inc.254 ], [ %add13.1.2, %if.end.1.2 ]
%22 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 2, i64 2), align 16, !tbaa !5
%cmp6.2.2 = icmp eq i32 %22, 0
br i1 %cmp6.2.2, label %for.inc.2.2, label %if.end.2.2
if.end.2.2: ; preds = %for.inc.1.2
%sub.2.2 = add nsw i32 %22, -1
%div.2.2 = sdiv i32 %sub.2.2, 3
%sub11.2.2 = add nsw i32 %div.2.2, -2
%23 = tail call i32 @llvm.abs.i32(i32 %sub11.2.2, i1 true)
%rem.2.2 = srem i32 %sub.2.2, 3
%reass.sub56 = sub i32 %sum.2.1.2, %rem.2.2
%add.2.2 = add i32 %reass.sub56, 2
%add13.2.2 = add i32 %add.2.2, %23
br label %for.inc.2.2
for.inc.2.2: ; preds = %if.end.2.2, %for.inc.1.2
%sum.2.2.2 = phi i32 [ %sum.2.1.2, %for.inc.1.2 ], [ %add13.2.2, %if.end.2.2 ]
ret i32 %sum.2.2.2
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i32 @move(i32 noundef %d, i32 noundef %pre, i32 noundef %s, i32 noundef %t) local_unnamed_addr #4 {
entry:
%call = tail call i32 @Heuristic()
%cmp = icmp eq i32 %call, 0
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%add = add nsw i32 %call, %d
%0 = load i32, ptr @count, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %add, %0
br i1 %cmp1, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end
%idxprom24 = sext i32 %s to i64
%idxprom26 = sext i32 %t to i64
%arrayidx27 = getelementptr inbounds [3 x [3 x i32]], ptr @A, i64 0, i64 %idxprom24, i64 %idxprom26
%add28 = add nsw i32 %d, 1
%1 = tail call i32 @llvm.abs.i32(i32 %pre, i1 true)
%cmp5 = icmp eq i32 %1, 2
br i1 %cmp5, label %for.inc, label %if.end7
if.end7: ; preds = %for.cond.preheader
%2 = load i32, ptr @dy, align 16, !tbaa !5
%add8 = add nsw i32 %2, %s
%3 = load i32, ptr @dx, align 16, !tbaa !5
%add11 = add nsw i32 %3, %t
%cmp13 = icmp slt i32 %add11, 0
%4 = icmp ugt i32 %add8, 2
%or.cond43 = select i1 %4, i1 true, i1 %cmp13
%cmp17 = icmp sgt i32 %add11, 2
%or.cond44 = select i1 %or.cond43, i1 true, i1 %cmp17
br i1 %or.cond44, label %for.inc, label %if.end19
if.end19: ; preds = %if.end7
%idxprom20 = zext i32 %add8 to i64
%idxprom22 = zext i32 %add11 to i64
%arrayidx23 = getelementptr inbounds [3 x [3 x i32]], ptr @A, i64 0, i64 %idxprom20, i64 %idxprom22
%5 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%6 = load i32, ptr %arrayidx27, align 4, !tbaa !5
store i32 %6, ptr %arrayidx23, align 4, !tbaa !5
store i32 %5, ptr %arrayidx27, align 4, !tbaa !5
%call29 = tail call i32 @move(i32 noundef %add28, i32 noundef 0, i32 noundef %add8, i32 noundef %add11), !range !9
%tobool.not = icmp eq i32 %call29, 0
br i1 %tobool.not, label %if.end31, label %cleanup
if.end31: ; preds = %if.end19
%7 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%8 = load i32, ptr %arrayidx27, align 4, !tbaa !5
store i32 %8, ptr %arrayidx23, align 4, !tbaa !5
store i32 %7, ptr %arrayidx27, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end7, %for.cond.preheader, %if.end31
%sub.1 = sub nsw i32 1, %pre
%9 = tail call i32 @llvm.abs.i32(i32 %sub.1, i1 true)
%cmp5.1 = icmp eq i32 %9, 2
br i1 %cmp5.1, label %for.inc.1, label %if.end7.1
if.end7.1: ; preds = %for.inc
%10 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 1), align 4, !tbaa !5
%add8.1 = add nsw i32 %10, %s
%11 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 1), align 4, !tbaa !5
%add11.1 = add nsw i32 %11, %t
%cmp13.1 = icmp slt i32 %add11.1, 0
%12 = icmp ugt i32 %add8.1, 2
%or.cond43.1 = select i1 %12, i1 true, i1 %cmp13.1
%cmp17.1 = icmp sgt i32 %add11.1, 2
%or.cond44.1 = select i1 %or.cond43.1, i1 true, i1 %cmp17.1
br i1 %or.cond44.1, label %for.inc.1, label %if.end19.1
if.end19.1: ; preds = %if.end7.1
%idxprom20.1 = zext i32 %add8.1 to i64
%idxprom22.1 = zext i32 %add11.1 to i64
%arrayidx23.1 = getelementptr inbounds [3 x [3 x i32]], ptr @A, i64 0, i64 %idxprom20.1, i64 %idxprom22.1
%13 = load i32, ptr %arrayidx23.1, align 4, !tbaa !5
%14 = load i32, ptr %arrayidx27, align 4, !tbaa !5
store i32 %14, ptr %arrayidx23.1, align 4, !tbaa !5
store i32 %13, ptr %arrayidx27, align 4, !tbaa !5
%call29.1 = tail call i32 @move(i32 noundef %add28, i32 noundef 1, i32 noundef %add8.1, i32 noundef %add11.1), !range !9
%tobool.not.1 = icmp eq i32 %call29.1, 0
br i1 %tobool.not.1, label %if.end31.1, label %cleanup
if.end31.1: ; preds = %if.end19.1
%15 = load i32, ptr %arrayidx23.1, align 4, !tbaa !5
%16 = load i32, ptr %arrayidx27, align 4, !tbaa !5
store i32 %16, ptr %arrayidx23.1, align 4, !tbaa !5
store i32 %15, ptr %arrayidx27, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.end31.1, %if.end7.1, %for.inc
%sub.2 = sub nsw i32 2, %pre
%17 = tail call i32 @llvm.abs.i32(i32 %sub.2, i1 true)
%cmp5.2 = icmp eq i32 %17, 2
br i1 %cmp5.2, label %for.inc.2, label %if.end7.2
if.end7.2: ; preds = %for.inc.1
%18 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 2), align 8, !tbaa !5
%add8.2 = add nsw i32 %18, %s
%19 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 2), align 8, !tbaa !5
%add11.2 = add nsw i32 %19, %t
%cmp13.2 = icmp slt i32 %add11.2, 0
%20 = icmp ugt i32 %add8.2, 2
%or.cond43.2 = select i1 %20, i1 true, i1 %cmp13.2
%cmp17.2 = icmp sgt i32 %add11.2, 2
%or.cond44.2 = select i1 %or.cond43.2, i1 true, i1 %cmp17.2
br i1 %or.cond44.2, label %for.inc.2, label %if.end19.2
if.end19.2: ; preds = %if.end7.2
%idxprom20.2 = zext i32 %add8.2 to i64
%idxprom22.2 = zext i32 %add11.2 to i64
%arrayidx23.2 = getelementptr inbounds [3 x [3 x i32]], ptr @A, i64 0, i64 %idxprom20.2, i64 %idxprom22.2
%21 = load i32, ptr %arrayidx23.2, align 4, !tbaa !5
%22 = load i32, ptr %arrayidx27, align 4, !tbaa !5
store i32 %22, ptr %arrayidx23.2, align 4, !tbaa !5
store i32 %21, ptr %arrayidx27, align 4, !tbaa !5
%call29.2 = tail call i32 @move(i32 noundef %add28, i32 noundef 2, i32 noundef %add8.2, i32 noundef %add11.2), !range !9
%tobool.not.2 = icmp eq i32 %call29.2, 0
br i1 %tobool.not.2, label %if.end31.2, label %cleanup
if.end31.2: ; preds = %if.end19.2
%23 = load i32, ptr %arrayidx23.2, align 4, !tbaa !5
%24 = load i32, ptr %arrayidx27, align 4, !tbaa !5
store i32 %24, ptr %arrayidx23.2, align 4, !tbaa !5
store i32 %23, ptr %arrayidx27, align 4, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.end31.2, %if.end7.2, %for.inc.1
%sub.3 = sub nsw i32 3, %pre
%25 = tail call i32 @llvm.abs.i32(i32 %sub.3, i1 true)
%cmp5.3 = icmp eq i32 %25, 2
br i1 %cmp5.3, label %cleanup, label %if.end7.3
if.end7.3: ; preds = %for.inc.2
%26 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 3), align 4, !tbaa !5
%add8.3 = add nsw i32 %26, %s
%27 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 3), align 4, !tbaa !5
%add11.3 = add nsw i32 %27, %t
%cmp13.3 = icmp slt i32 %add11.3, 0
%28 = icmp ugt i32 %add8.3, 2
%or.cond43.3 = select i1 %28, i1 true, i1 %cmp13.3
%cmp17.3 = icmp sgt i32 %add11.3, 2
%or.cond44.3 = select i1 %or.cond43.3, i1 true, i1 %cmp17.3
br i1 %or.cond44.3, label %cleanup, label %if.end19.3
if.end19.3: ; preds = %if.end7.3
%idxprom20.3 = zext i32 %add8.3 to i64
%idxprom22.3 = zext i32 %add11.3 to i64
%arrayidx23.3 = getelementptr inbounds [3 x [3 x i32]], ptr @A, i64 0, i64 %idxprom20.3, i64 %idxprom22.3
%29 = load i32, ptr %arrayidx23.3, align 4, !tbaa !5
%30 = load i32, ptr %arrayidx27, align 4, !tbaa !5
store i32 %30, ptr %arrayidx23.3, align 4, !tbaa !5
store i32 %29, ptr %arrayidx27, align 4, !tbaa !5
%call29.3 = tail call i32 @move(i32 noundef %add28, i32 noundef 3, i32 noundef %add8.3, i32 noundef %add11.3), !range !9
%tobool.not.3 = icmp eq i32 %call29.3, 0
br i1 %tobool.not.3, label %if.end31.3, label %cleanup
if.end31.3: ; preds = %if.end19.3
%31 = load i32, ptr %arrayidx23.3, align 4, !tbaa !5
%32 = load i32, ptr %arrayidx27, align 4, !tbaa !5
store i32 %32, ptr %arrayidx23.3, align 4, !tbaa !5
store i32 %31, ptr %arrayidx27, align 4, !tbaa !5
br label %cleanup
cleanup: ; preds = %if.end19, %if.end19.1, %if.end19.2, %if.end19.3, %if.end31.3, %if.end7.3, %for.inc.2, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.end ], [ 1, %if.end19 ], [ 1, %if.end19.1 ], [ 1, %if.end19.2 ], [ 1, %if.end19.3 ], [ 0, %if.end31.3 ], [ 0, %if.end7.3 ], [ 0, %for.inc.2 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @counter(i32 noundef %s, i32 noundef %t) local_unnamed_addr #5 {
entry:
store i32 0, ptr @count, align 4, !tbaa !5
%call2 = tail call i32 @move(i32 noundef 0, i32 noundef 10, i32 noundef %s, i32 noundef %t), !range !9
%tobool.not3 = icmp eq i32 %call2, 0
br i1 %tobool.not3, label %if.end, label %if.then
if.then: ; preds = %if.end, %entry
%0 = load i32, ptr @count, align 4, !tbaa !5
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
ret void
if.end: ; preds = %entry, %if.end
%1 = load i32, ptr @count, align 4, !tbaa !5
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @count, align 4, !tbaa !5
%call = tail call i32 @move(i32 noundef 0, i32 noundef 10, i32 noundef %s, i32 noundef %t), !range !9
%tobool.not = icmp eq i32 %call, 0
br i1 %tobool.not, label %if.end, label %if.then
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #5 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @A)
%call.1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 0, i64 1))
%0 = load <4 x i32>, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 0, i64 1), align 4
%1 = shufflevector <4 x i32> %0, <4 x i32> poison, <8 x i32> <i32 0, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%call.2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 0, i64 2))
%2 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 0, i64 2), align 8, !tbaa !5
%call.132 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 1, i64 0))
%3 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 1, i64 0), align 4, !tbaa !5
%call.1.1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 1, i64 1))
%4 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 1, i64 1), align 16, !tbaa !5
%call.2.1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 1, i64 2))
%5 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 1, i64 2), align 4, !tbaa !5
%call.237 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 2, i64 0))
%6 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 2, i64 0), align 8, !tbaa !5
%call.1.2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 2, i64 1))
%7 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 2, i64 1), align 4, !tbaa !5
%call.2.2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 2, i64 2))
%8 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @A, i64 0, i64 2, i64 2), align 16, !tbaa !5
%9 = insertelement <8 x i32> %1, i32 %2, i64 1
%10 = insertelement <8 x i32> %9, i32 %3, i64 2
%11 = insertelement <8 x i32> %10, i32 %4, i64 3
%12 = insertelement <8 x i32> %11, i32 %5, i64 4
%13 = insertelement <8 x i32> %12, i32 %6, i64 5
%14 = insertelement <8 x i32> %13, i32 %7, i64 6
%15 = insertelement <8 x i32> %14, i32 %8, i64 7
%16 = icmp eq <8 x i32> %15, zeroinitializer
%17 = extractelement <8 x i1> %16, i64 0
%spec.select22.1 = zext i1 %17 to i32
%18 = extractelement <8 x i1> %16, i64 1
%spec.select22.2 = select i1 %18, i32 2, i32 %spec.select22.1
%19 = extractelement <8 x i1> %16, i64 2
%spec.select22.135 = select i1 %19, i32 0, i32 %spec.select22.2
%20 = extractelement <8 x i1> %16, i64 3
%spec.select22.1.1 = select i1 %20, i32 1, i32 %spec.select22.135
%21 = extractelement <8 x i1> %16, i64 4
%22 = select i1 %21, i1 true, i1 %20
%narrow41 = select i1 %22, i1 true, i1 %19
%spec.select.2.1 = zext i1 %narrow41 to i32
%spec.select22.2.1 = select i1 %21, i32 2, i32 %spec.select22.1.1
%23 = extractelement <8 x i1> %16, i64 5
%spec.select22.240 = select i1 %23, i32 0, i32 %spec.select22.2.1
%24 = extractelement <8 x i1> %16, i64 6
%spec.select22.1.2 = select i1 %24, i32 1, i32 %spec.select22.240
%25 = extractelement <8 x i1> %16, i64 7
%26 = select i1 %25, i1 true, i1 %24
%27 = select i1 %26, i1 true, i1 %23
%spec.select.2.2 = select i1 %27, i32 2, i32 %spec.select.2.1
%spec.select22.2.2 = select i1 %25, i32 2, i32 %spec.select22.1.2
store i32 0, ptr @count, align 4, !tbaa !5
%call2.i = tail call i32 @move(i32 noundef 0, i32 noundef 10, i32 noundef %spec.select.2.2, i32 noundef %spec.select22.2.2), !range !9
%tobool.not3.i = icmp eq i32 %call2.i, 0
br i1 %tobool.not3.i, label %if.end.i, label %counter.exit
if.end.i: ; preds = %entry, %if.end.i
%28 = load i32, ptr @count, align 4, !tbaa !5
%inc.i = add nsw i32 %28, 1
store i32 %inc.i, ptr @count, align 4, !tbaa !5
%call.i = tail call i32 @move(i32 noundef 0, i32 noundef 10, i32 noundef %spec.select.2.2, i32 noundef %spec.select22.2.2), !range !9
%tobool.not.i = icmp eq i32 %call.i, 0
br i1 %tobool.not.i, label %if.end.i, label %counter.exit
counter.exit: ; preds = %if.end.i, %entry
%29 = load i32, ptr @count, align 4, !tbaa !5
%call1.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %29)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { mustprogress nofree 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i32 0, i32 2}
|
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define MAX 362880 //9の階乗
#define N 3
#define N2 9
/*
螺旋本の解答例`似せてc言語で書いてみた
*/
typedef struct puzzle{
int f[N2];
int space;
int path;
}Puzzle;
static const int dx[4] = {-1, 0, 1, 0};
static const int dy[4] = {0, -1, 0, 1};
int V[MAX];
// QUEUE --------
Puzzle Q[MAX];
int head, tail;
int empty(){
return head == tail;
}
void push(Puzzle x){
Q[tail] = x;
tail = (tail+1)%MAX;
}
Puzzle front(){
Puzzle x;
x = Q[head];
head = (head+1)%MAX;
return x;
}
// QUEUE --------
/*
int cheak(Puzzle p)
1から9までの数を並び替えた数列をすべて列挙して辞書順に並び替えたとき以下の数列
p.f[8],p.f[7],p.f[6].......p.[0]
が前から何番目にあるかを返す関数
*/
int cheak(Puzzle p){
int i, j, fac, count, res = 0;
for(i = 0, fac = 1; i < N2; fac*= ++i){
for(j = 0, count = 0; j < i; j++){
if(p.f[j] < p.f[i]) count++;
}
res += count*fac;
}
return res;
}
int isTarget(Puzzle p){
int i;
for(i = 0; i < N2; i++ )
if(p.f[i] != (i + 1) ) return 0;
return 1;
}
int bfs(Puzzle s){
int sx, sy, tx, ty, r, temp;
Puzzle u, v;
s.path = 0;
push(s);
V[cheak(s)] = 1;
while(!empty()){
u = front();
if( isTarget(u)) return u.path;
sx = u.space / N;
sy = u.space % N;
for ( r = 0; r < 4; r++ ) {
tx = sx + dx[r];
ty = sy + dy[r];
if(tx < 0 || ty < 0 || tx >= N || ty >= N) continue;
v = u;
temp = v.f[u.space];
v.f[u.space] = v.f[tx * N + ty];
v.f[tx * N + ty] = temp;
v.space = tx * N + ty;
if( !V[cheak(v)] ){
V[cheak(v)] = 1;
v.path++;
push(v);
}
}
}
return -1;
}
int main(){
int i, ans;
Puzzle in;
for( i = 0; i < N2; i++ ) {
scanf("%d", &in.f[i]);
if( in.f[i] == 0) {
in.f[i] = N2;
in.space = i;
}
}
ans = bfs(in);
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189184/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189184/source.c"
target datalayout = "e-m:e-p270: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.puzzle = type { [9 x i32], i32, i32 }
@head = dso_local local_unnamed_addr global i32 0, align 4
@tail = dso_local local_unnamed_addr global i32 0, align 4
@Q = dso_local local_unnamed_addr global [362880 x %struct.puzzle] zeroinitializer, align 16
@V = dso_local local_unnamed_addr global [362880 x i32] zeroinitializer, align 16
@dx = internal unnamed_addr constant [4 x i32] [i32 -1, i32 0, i32 1, i32 0], align 16
@dy = internal unnamed_addr constant [4 x i32] [i32 0, i32 -1, i32 0, i32 1], 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(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @empty() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%1 = load i32, ptr @tail, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @push(ptr nocapture noundef readonly byval(%struct.puzzle) align 8 %x) local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [362880 x %struct.puzzle], ptr @Q, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(44) %arrayidx, ptr noundef nonnull align 8 dereferenceable(44) %x, i64 44, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 362880
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @front(ptr noalias nocapture writeonly sret(%struct.puzzle) align 4 %agg.result) local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [362880 x %struct.puzzle], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(44) %agg.result, ptr noundef nonnull align 4 dereferenceable(44) %arrayidx, i64 44, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 362880
store i32 %rem, ptr @head, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cheak(ptr nocapture noundef readonly byval(%struct.puzzle) align 8 %p) local_unnamed_addr #3 {
for.end.8:
%arrayidx6.2 = getelementptr inbounds [9 x i32], ptr %p, i64 0, i64 2
%arrayidx6.3 = getelementptr inbounds [9 x i32], ptr %p, i64 0, i64 3
%0 = load <2 x i32>, ptr %p, align 8, !tbaa !5
%arrayidx.4.2 = getelementptr inbounds [9 x i32], ptr %p, i64 0, i64 2
%1 = load i32, ptr %arrayidx.4.2, align 8, !tbaa !5
%arrayidx.5.1 = getelementptr inbounds [9 x i32], ptr %p, i64 0, i64 1
%2 = load <2 x i32>, ptr %arrayidx.5.1, align 4, !tbaa !5
%arrayidx.5.3 = getelementptr inbounds [9 x i32], ptr %p, i64 0, i64 3
%3 = load i32, ptr %p, align 8, !tbaa !5
%4 = load <4 x i32>, ptr %p, align 8, !tbaa !5
%5 = load <4 x i32>, ptr %arrayidx.5.3, align 4
%arrayidx.7.4 = getelementptr inbounds [9 x i32], ptr %p, i64 0, i64 4
%6 = load i32, ptr %arrayidx.7.4, align 8, !tbaa !5
%arrayidx.7.5 = getelementptr inbounds [9 x i32], ptr %p, i64 0, i64 5
%7 = load i32, ptr %arrayidx.7.5, align 4, !tbaa !5
%arrayidx.7.6 = getelementptr inbounds [9 x i32], ptr %p, i64 0, i64 6
%8 = load <2 x i32>, ptr %arrayidx.7.6, align 8, !tbaa !5
%arrayidx6.8 = getelementptr inbounds [9 x i32], ptr %p, i64 0, i64 8
%9 = load i32, ptr %arrayidx6.8, align 8, !tbaa !5
%10 = load <8 x i32>, ptr %p, align 8, !tbaa !5
%11 = insertelement <8 x i32> poison, i32 %9, i64 0
%12 = shufflevector <8 x i32> %11, <8 x i32> poison, <8 x i32> zeroinitializer
%13 = icmp slt <8 x i32> %10, %12
%14 = bitcast <8 x i1> %13 to i8
%15 = tail call i8 @llvm.ctpop.i8(i8 %14), !range !11
%16 = zext i8 %15 to i32
%17 = load <4 x i32>, ptr %p, align 8, !tbaa !5
%18 = shufflevector <2 x i32> %8, <2 x i32> poison, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
%19 = icmp slt <4 x i32> %17, %18
%20 = extractelement <2 x i32> %8, i64 1
%cmp7.7.4 = icmp slt i32 %6, %20
%inc.7.4 = zext i1 %cmp7.7.4 to i32
%cmp7.7.5 = icmp slt i32 %7, %20
%inc.7.5 = zext i1 %cmp7.7.5 to i32
%21 = extractelement <2 x i32> %8, i64 0
%cmp7.7.6 = icmp slt i32 %21, %20
%inc.7.6 = zext i1 %cmp7.7.6 to i32
%22 = bitcast <4 x i1> %19 to i4
%23 = tail call i4 @llvm.ctpop.i4(i4 %22), !range !12
%24 = zext i4 %23 to i32
%op.rdx34 = add nuw nsw i32 %24, %inc.7.4
%op.rdx35 = add nuw nsw i32 %inc.7.5, %inc.7.6
%op.rdx36 = add nuw nsw i32 %op.rdx34, %op.rdx35
%mul.7 = mul nuw nsw i32 %op.rdx36, 5040
%25 = load <4 x i32>, ptr %arrayidx6.3, align 4, !tbaa !5
%26 = load <4 x i32>, ptr %arrayidx6.2, align 8, !tbaa !5
%27 = extractelement <4 x i32> %25, i64 3
%cmp7.6 = icmp slt i32 %3, %27
%inc.6 = zext i1 %cmp7.6 to i32
%28 = shufflevector <2 x i32> %0, <2 x i32> poison, <8 x i32> <i32 1, i32 0, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%29 = shufflevector <2 x i32> %2, <2 x i32> poison, <8 x i32> <i32 1, i32 0, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%30 = shufflevector <8 x i32> %28, <8 x i32> %29, <8 x i32> <i32 0, i32 1, i32 8, i32 9, i32 poison, i32 poison, i32 poison, i32 poison>
%31 = shufflevector <4 x i32> %4, <4 x i32> poison, <8 x i32> <i32 0, i32 3, i32 2, i32 1, i32 poison, i32 poison, i32 poison, i32 poison>
%32 = shufflevector <8 x i32> %30, <8 x i32> %31, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11>
%33 = shufflevector <4 x i32> %25, <4 x i32> poison, <8 x i32> <i32 1, i32 1, i32 2, i32 2, i32 2, i32 3, i32 3, i32 3>
%34 = icmp slt <8 x i32> %32, %33
%35 = extractelement <8 x i1> %34, i64 7
%inc.6.1 = zext i1 %35 to i32
%spec.select.6.1 = add nuw nsw i32 %inc.6, %inc.6.1
%36 = extractelement <8 x i1> %34, i64 6
%inc.6.2 = zext i1 %36 to i32
%spec.select.6.2 = add nuw nsw i32 %spec.select.6.1, %inc.6.2
%37 = extractelement <8 x i1> %34, i64 5
%inc.6.3 = zext i1 %37 to i32
%spec.select.6.3 = add nuw nsw i32 %spec.select.6.2, %inc.6.3
%38 = extractelement <8 x i1> %34, i64 4
%inc.5 = zext i1 %38 to i32
%39 = extractelement <8 x i1> %34, i64 3
%inc.5.1 = zext i1 %39 to i32
%spec.select.5.1 = add nuw nsw i32 %inc.5, %inc.5.1
%40 = extractelement <8 x i1> %34, i64 2
%inc.5.2 = zext i1 %40 to i32
%spec.select.5.2 = add nuw nsw i32 %spec.select.5.1, %inc.5.2
%41 = extractelement <8 x i1> %34, i64 1
%inc.4 = zext i1 %41 to i32
%42 = extractelement <8 x i1> %34, i64 0
%inc.4.1 = zext i1 %42 to i32
%spec.select.4.1 = add nuw nsw i32 %inc.4, %inc.4.1
%43 = extractelement <4 x i32> %25, i64 0
%44 = extractelement <2 x i32> %0, i64 1
%cmp7.3.1 = icmp slt i32 %44, %43
%inc.3.1 = zext i1 %cmp7.3.1 to i32
%45 = insertelement <4 x i32> poison, i32 %inc.3.1, i64 0
%46 = insertelement <4 x i32> %45, i32 %spec.select.4.1, i64 1
%47 = insertelement <4 x i32> %46, i32 %spec.select.5.2, i64 2
%48 = insertelement <4 x i32> %47, i32 %spec.select.6.3, i64 3
%49 = icmp slt <4 x i32> %26, %25
%50 = zext <4 x i1> %49 to <4 x i32>
%51 = load <2 x i32>, ptr %p, align 8, !tbaa !5
%52 = shufflevector <2 x i32> %51, <2 x i32> poison, <4 x i32> <i32 0, i32 poison, i32 poison, i32 poison>
%53 = insertelement <4 x i32> %52, i32 %1, i64 1
%54 = shufflevector <4 x i32> %53, <4 x i32> %5, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
%55 = icmp slt <4 x i32> %54, %25
%56 = zext <4 x i1> %55 to <4 x i32>
%57 = add nuw nsw <4 x i32> %48, %56
%58 = add nuw nsw <4 x i32> %57, %50
%59 = mul nuw nsw <4 x i32> %58, <i32 6, i32 24, i32 120, i32 720>
%60 = shufflevector <4 x i32> %26, <4 x i32> poison, <2 x i32> zeroinitializer
%61 = icmp slt <2 x i32> %51, %60
%62 = zext <2 x i1> %61 to <2 x i32>
%shift = shufflevector <2 x i32> %62, <2 x i32> poison, <2 x i32> <i32 1, i32 poison>
%63 = add nuw nsw <2 x i32> %shift, %62
%spec.select.2.1 = extractelement <2 x i32> %63, i64 0
%mul.2 = shl nuw nsw i32 %spec.select.2.1, 1
%shift37 = shufflevector <2 x i32> %51, <2 x i32> poison, <2 x i32> <i32 1, i32 poison>
%64 = icmp slt <2 x i32> %51, %shift37
%cmp7.1 = extractelement <2 x i1> %64, i64 0
%inc.1 = zext i1 %cmp7.1 to i32
%add.2 = or i32 %mul.2, %inc.1
%mul.8 = mul nuw nsw i32 %16, 40320
%65 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %59)
%op.rdx = add i32 %65, %mul.7
%op.rdx32 = or i32 %mul.8, %add.2
%op.rdx33 = add i32 %op.rdx, %op.rdx32
ret i32 %op.rdx33
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @isTarget(ptr nocapture noundef readonly byval(%struct.puzzle) align 8 %p) local_unnamed_addr #3 {
entry:
%0 = load <8 x i32>, ptr %p, align 8
%.fr = freeze <8 x i32> %0
%1 = icmp ne <8 x i32> %.fr, <i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8>
%arrayidx.8 = getelementptr inbounds [9 x i32], ptr %p, i64 0, i64 8
%2 = load i32, ptr %arrayidx.8, align 8
%cmp1.not.8 = icmp eq i32 %2, 9
%3 = bitcast <8 x i1> %1 to i8
%4 = icmp eq i8 %3, 0
%op.rdx = select i1 %4, i1 %cmp1.not.8, i1 false
%retval.0 = zext i1 %op.rdx to i32
ret i32 %retval.0
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @bfs(ptr nocapture noundef byval(%struct.puzzle) align 8 %s) local_unnamed_addr #5 {
entry:
%v = alloca %struct.puzzle, align 16
%path = getelementptr inbounds %struct.puzzle, ptr %s, i64 0, i32 2
store i32 0, ptr %path, align 8, !tbaa !13
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom.i = sext i32 %0 to i64
%arrayidx.i = getelementptr inbounds [362880 x %struct.puzzle], ptr @Q, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(44) %arrayidx.i, ptr noundef nonnull align 8 dereferenceable(44) %s, i64 44, i1 false)
%add.i = add nsw i32 %0, 1
%rem.i = srem i32 %add.i, 362880
store i32 %rem.i, ptr @tail, align 4, !tbaa !5
%call = tail call i32 @cheak(ptr noundef nonnull byval(%struct.puzzle) align 8 %s)
%idxprom = sext i32 %call to i64
%arrayidx = getelementptr inbounds [362880 x i32], ptr @V, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%head.promoted = load i32, ptr @head, align 4, !tbaa !5
%cmp.i.not247 = icmp eq i32 %head.promoted, %rem.i
br i1 %cmp.i.not247, label %cleanup, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%u.sroa.5.0.v.sroa_idx = getelementptr inbounds i8, ptr %v, i64 4
%u.sroa.6.0.v.sroa_idx = getelementptr inbounds i8, ptr %v, i64 8
%u.sroa.7.0.v.sroa_idx = getelementptr inbounds i8, ptr %v, i64 12
%u.sroa.8.0.v.sroa_idx = getelementptr inbounds i8, ptr %v, i64 16
%u.sroa.9.0.v.sroa_idx = getelementptr inbounds i8, ptr %v, i64 20
%u.sroa.10.0.v.sroa_idx = getelementptr inbounds i8, ptr %v, i64 24
%u.sroa.11.0.v.sroa_idx = getelementptr inbounds i8, ptr %v, i64 28
%u.sroa.12.0.v.sroa_idx = getelementptr inbounds i8, ptr %v, i64 32
%u.sroa.13.0.v.sroa_idx = getelementptr inbounds i8, ptr %v, i64 36
%u.sroa.15.0.v.sroa_idx = getelementptr inbounds i8, ptr %v, i64 40
br label %while.body
while.cond.loopexit: ; preds = %for.inc
%cmp.i.not = icmp eq i32 %rem.i73, %tail.promoted244
br i1 %cmp.i.not, label %cleanup.sink.split, label %while.body, !llvm.loop !15
while.body: ; preds = %while.body.lr.ph, %while.cond.loopexit
%rem.i73242249 = phi i32 [ %head.promoted, %while.body.lr.ph ], [ %rem.i73, %while.cond.loopexit ]
%tail.promoted246248 = phi i32 [ %rem.i, %while.body.lr.ph ], [ %tail.promoted244, %while.cond.loopexit ]
%idxprom.i70 = sext i32 %rem.i73242249 to i64
%arrayidx.i71 = getelementptr inbounds [362880 x %struct.puzzle], ptr @Q, i64 0, i64 %idxprom.i70
%tmp.sroa.11.0.arrayidx.i71.sroa_idx = getelementptr inbounds i8, ptr %arrayidx.i71, i64 32
%tmp.sroa.11.0.copyload = load i32, ptr %tmp.sroa.11.0.arrayidx.i71.sroa_idx, align 4, !tbaa.struct !17
%tmp.sroa.12.0.arrayidx.i71.sroa_idx = getelementptr inbounds i8, ptr %arrayidx.i71, i64 36
%tmp.sroa.12.0.copyload = load i32, ptr %tmp.sroa.12.0.arrayidx.i71.sroa_idx, align 4, !tbaa.struct !18
%tmp.sroa.13.0.arrayidx.i71.sroa_idx = getelementptr inbounds i8, ptr %arrayidx.i71, i64 40
%tmp.sroa.13.0.copyload = load i32, ptr %tmp.sroa.13.0.arrayidx.i71.sroa_idx, align 4, !tbaa.struct !19
%add.i72 = add nsw i32 %rem.i73242249, 1
%rem.i73 = srem i32 %add.i72, 362880
%1 = load <8 x i32>, ptr %arrayidx.i71, align 4
%.fr = freeze <8 x i32> %1
%2 = icmp ne <8 x i32> %.fr, <i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8>
%cmp1.not.8.i = icmp ne i32 %tmp.sroa.11.0.copyload, 9
%3 = bitcast <8 x i1> %2 to i8
%4 = icmp ne i8 %3, 0
%op.rdx260 = select i1 %4, i1 true, i1 %cmp1.not.8.i
br i1 %op.rdx260, label %if.end, label %cleanup.sink.split
if.end: ; preds = %while.body
%div = sdiv i32 %tmp.sroa.12.0.copyload, 3
%rem = srem i32 %tmp.sroa.12.0.copyload, 3
%idxprom20 = sext i32 %tmp.sroa.12.0.copyload to i64
%arrayidx21 = getelementptr inbounds [9 x i32], ptr %v, i64 0, i64 %idxprom20
%5 = extractelement <8 x i32> %.fr, i64 0
%6 = extractelement <8 x i32> %.fr, i64 1
%7 = extractelement <8 x i32> %.fr, i64 2
%8 = extractelement <8 x i32> %.fr, i64 3
%9 = extractelement <8 x i32> %.fr, i64 4
%10 = extractelement <8 x i32> %.fr, i64 5
%11 = extractelement <8 x i32> %.fr, i64 6
%12 = extractelement <8 x i32> %.fr, i64 7
br label %for.body
for.body: ; preds = %if.end, %for.inc
%indvars.iv = phi i64 [ 0, %if.end ], [ %indvars.iv.next, %for.inc ]
%tail.promoted245 = phi i32 [ %tail.promoted246248, %if.end ], [ %tail.promoted244, %for.inc ]
%rem.i225239240 = phi i32 [ %tail.promoted246248, %if.end ], [ %rem.i225238, %for.inc ]
%arrayidx7 = getelementptr inbounds [4 x i32], ptr @dx, i64 0, i64 %indvars.iv
%13 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add = add nsw i32 %13, %div
%arrayidx9 = getelementptr inbounds [4 x i32], ptr @dy, i64 0, i64 %indvars.iv
%14 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%add10 = add nsw i32 %14, %rem
%cmp12 = icmp slt i32 %add10, 0
%15 = icmp ugt i32 %add, 2
%or.cond56 = select i1 %15, i1 true, i1 %cmp12
%cmp16 = icmp sgt i32 %add10, 2
%or.cond57 = select i1 %or.cond56, i1 true, i1 %cmp16
br i1 %or.cond57, label %for.inc, label %if.end18
if.end18: ; preds = %for.body
store i32 %5, ptr %v, align 16, !tbaa.struct !9
store i32 %6, ptr %u.sroa.5.0.v.sroa_idx, align 4, !tbaa.struct !20
store i32 %7, ptr %u.sroa.6.0.v.sroa_idx, align 8, !tbaa.struct !21
store i32 %8, ptr %u.sroa.7.0.v.sroa_idx, align 4, !tbaa.struct !22
store i32 %9, ptr %u.sroa.8.0.v.sroa_idx, align 16, !tbaa.struct !23
store i32 %10, ptr %u.sroa.9.0.v.sroa_idx, align 4, !tbaa.struct !24
store i32 %11, ptr %u.sroa.10.0.v.sroa_idx, align 8, !tbaa.struct !25
store i32 %12, ptr %u.sroa.11.0.v.sroa_idx, align 4, !tbaa.struct !26
store i32 %tmp.sroa.11.0.copyload, ptr %u.sroa.12.0.v.sroa_idx, align 16, !tbaa.struct !17
store i32 %tmp.sroa.12.0.copyload, ptr %u.sroa.13.0.v.sroa_idx, align 4, !tbaa.struct !18
store i32 %tmp.sroa.13.0.copyload, ptr %u.sroa.15.0.v.sroa_idx, align 8, !tbaa.struct !19
%16 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%mul = mul nuw nsw i32 %add, 3
%add23 = add nuw nsw i32 %mul, %add10
%idxprom24 = zext i32 %add23 to i64
%arrayidx25 = getelementptr inbounds [9 x i32], ptr %v, i64 0, i64 %idxprom24
%17 = load i32, ptr %arrayidx25, align 4, !tbaa !5
store i32 %17, ptr %arrayidx21, align 4, !tbaa !5
store i32 %16, ptr %arrayidx25, align 4, !tbaa !5
store i32 %add23, ptr %u.sroa.13.0.v.sroa_idx, align 4, !tbaa !27
%18 = load i32, ptr %u.sroa.12.0.v.sroa_idx, align 16, !tbaa !5
%19 = load <4 x i32>, ptr %v, align 16, !tbaa !5
%20 = insertelement <4 x i32> poison, i32 %18, i64 0
%21 = shufflevector <4 x i32> %20, <4 x i32> poison, <4 x i32> zeroinitializer
%22 = icmp slt <4 x i32> %19, %21
%23 = load <4 x i32>, ptr %u.sroa.8.0.v.sroa_idx, align 16, !tbaa !5
%24 = icmp slt <4 x i32> %23, %21
%25 = bitcast <4 x i1> %22 to i4
%26 = tail call i4 @llvm.ctpop.i4(i4 %25), !range !12
%27 = bitcast <4 x i1> %24 to i4
%28 = tail call i4 @llvm.ctpop.i4(i4 %27), !range !12
%narrow = add nuw i4 %26, %28
%op.rdx259 = zext i4 %narrow to i64
%29 = shufflevector <4 x i32> %19, <4 x i32> poison, <16 x i32> <i32 1, i32 0, i32 0, i32 2, i32 1, i32 0, i32 1, i32 1, i32 0, i32 2, i32 1, i32 0, i32 3, i32 2, i32 1, i32 0>
%30 = shufflevector <4 x i32> %19, <4 x i32> poison, <4 x i32> <i32 0, i32 2, i32 3, i32 poison>
%31 = shufflevector <4 x i32> %30, <4 x i32> %23, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
%32 = icmp slt <4 x i32> %31, %23
%33 = zext <4 x i1> %32 to <4 x i64>
%34 = shufflevector <4 x i32> %19, <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 poison, i32 poison>
%35 = shufflevector <4 x i32> %34, <4 x i32> %23, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
%36 = icmp slt <4 x i32> %35, %23
%37 = zext <4 x i1> %36 to <4 x i64>
%38 = shufflevector <4 x i32> %19, <4 x i32> poison, <4 x i32> <i32 3, i32 poison, i32 poison, i32 poison>
%39 = shufflevector <4 x i32> %38, <4 x i32> %23, <4 x i32> <i32 0, i32 4, i32 5, i32 6>
%40 = icmp slt <4 x i32> %39, %23
%41 = zext <4 x i1> %40 to <4 x i64>
%42 = shufflevector <4 x i32> %19, <4 x i32> %23, <16 x i32> <i32 2, i32 1, i32 2, i32 3, i32 3, i32 3, i32 4, i32 5, i32 5, i32 6, i32 6, i32 6, i32 7, i32 7, i32 7, i32 7>
%43 = icmp slt <16 x i32> %29, %42
%44 = extractelement <16 x i1> %43, i64 15
%inc.7.i = zext i1 %44 to i64
%45 = extractelement <16 x i1> %43, i64 14
%inc.7.1.i = zext i1 %45 to i64
%spec.select.7.1.i = add nuw nsw i64 %inc.7.i, %inc.7.1.i
%46 = extractelement <16 x i1> %43, i64 13
%inc.7.2.i = zext i1 %46 to i64
%spec.select.7.2.i = add nuw nsw i64 %spec.select.7.1.i, %inc.7.2.i
%47 = extractelement <16 x i1> %43, i64 12
%inc.7.3.i = zext i1 %47 to i64
%spec.select.7.3.i = add nuw nsw i64 %spec.select.7.2.i, %inc.7.3.i
%48 = extractelement <16 x i1> %43, i64 11
%inc.6.i = zext i1 %48 to i64
%49 = extractelement <16 x i1> %43, i64 10
%inc.6.1.i = zext i1 %49 to i64
%spec.select.6.1.i = add nuw nsw i64 %inc.6.i, %inc.6.1.i
%50 = extractelement <16 x i1> %43, i64 9
%inc.6.2.i = zext i1 %50 to i64
%spec.select.6.2.i = add nuw nsw i64 %spec.select.6.1.i, %inc.6.2.i
%51 = extractelement <16 x i1> %43, i64 8
%inc.5.i = zext i1 %51 to i64
%52 = extractelement <16 x i1> %43, i64 7
%inc.5.1.i = zext i1 %52 to i64
%spec.select.5.1.i = add nuw nsw i64 %inc.5.i, %inc.5.1.i
%53 = extractelement <16 x i1> %43, i64 6
%inc.4.1.i = zext i1 %53 to i64
%54 = insertelement <4 x i64> poison, i64 %inc.4.1.i, i64 0
%55 = insertelement <4 x i64> %54, i64 %spec.select.5.1.i, i64 1
%56 = insertelement <4 x i64> %55, i64 %spec.select.6.2.i, i64 2
%57 = insertelement <4 x i64> %56, i64 %spec.select.7.3.i, i64 3
%58 = add nuw nsw <4 x i64> %57, %33
%59 = add nuw nsw <4 x i64> %58, %37
%60 = add nuw nsw <4 x i64> %59, %41
%61 = mul nuw nsw <4 x i64> %60, <i64 24, i64 120, i64 720, i64 5040>
%62 = extractelement <16 x i1> %43, i64 5
%inc.3.i = zext i1 %62 to i64
%63 = extractelement <16 x i1> %43, i64 4
%inc.3.1.i = zext i1 %63 to i64
%spec.select.3.1.i = add nuw nsw i64 %inc.3.i, %inc.3.1.i
%64 = extractelement <16 x i1> %43, i64 3
%inc.3.2.i = zext i1 %64 to i64
%spec.select.3.2.i = add nuw nsw i64 %spec.select.3.1.i, %inc.3.2.i
%mul.3.i = mul nuw nsw i64 %spec.select.3.2.i, 6
%65 = extractelement <16 x i1> %43, i64 2
%inc.2.i = zext i1 %65 to i64
%66 = extractelement <16 x i1> %43, i64 0
%inc.2.1.i = zext i1 %66 to i64
%spec.select.2.1.i = add nuw nsw i64 %inc.2.i, %inc.2.1.i
%mul.2.i = shl nuw nsw i64 %spec.select.2.1.i, 1
%67 = extractelement <16 x i1> %43, i64 1
%inc.1.i = zext i1 %67 to i64
%add.2.i = or i64 %mul.2.i, %inc.1.i
%mul.8.i = mul nuw nsw i64 %op.rdx259, 40320
%68 = tail call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %61)
%op.rdx = add i64 %68, %mul.3.i
%op.rdx257 = or i64 %mul.8.i, %add.2.i
%op.rdx258 = add i64 %op.rdx, %op.rdx257
%arrayidx40 = getelementptr inbounds [362880 x i32], ptr @V, i64 0, i64 %op.rdx258
%69 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%tobool41.not = icmp eq i32 %69, 0
br i1 %tobool41.not, label %if.then42, label %for.inc
if.then42: ; preds = %if.end18
store i32 1, ptr %arrayidx40, align 4, !tbaa !5
%70 = load i32, ptr %u.sroa.15.0.v.sroa_idx, align 8, !tbaa !13
%inc = add nsw i32 %70, 1
store i32 %inc, ptr %u.sroa.15.0.v.sroa_idx, align 8, !tbaa !13
%idxprom.i222 = sext i32 %rem.i225239240 to i64
%arrayidx.i223 = getelementptr inbounds [362880 x %struct.puzzle], ptr @Q, i64 0, i64 %idxprom.i222
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(44) %arrayidx.i223, ptr noundef nonnull align 16 dereferenceable(44) %v, i64 44, i1 false)
%add.i224 = add nsw i32 %rem.i225239240, 1
%rem.i225 = srem i32 %add.i224, 362880
store i32 %rem.i225, ptr @tail, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end18, %if.then42, %for.body
%tail.promoted244 = phi i32 [ %tail.promoted245, %if.end18 ], [ %rem.i225, %if.then42 ], [ %tail.promoted245, %for.body ]
%rem.i225238 = phi i32 [ %rem.i225239240, %if.end18 ], [ %rem.i225, %if.then42 ], [ %rem.i225239240, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 4
br i1 %exitcond.not, label %while.cond.loopexit, label %for.body, !llvm.loop !28
cleanup.sink.split: ; preds = %while.cond.loopexit, %while.body
%retval.0.ph = phi i32 [ %tmp.sroa.13.0.copyload, %while.body ], [ -1, %while.cond.loopexit ]
store i32 %rem.i73, ptr @head, align 4, !tbaa !5, !noalias !29
br label %cleanup
cleanup: ; preds = %cleanup.sink.split, %entry
%retval.0 = phi i32 [ -1, %entry ], [ %retval.0.ph, %cleanup.sink.split ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #6 {
entry:
%in = alloca %struct.puzzle, align 8
call void @llvm.lifetime.start.p0(i64 44, ptr nonnull %in) #9
%space = getelementptr inbounds %struct.puzzle, ptr %in, i64 0, i32 1
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in)
%0 = load i32, ptr %in, align 8, !tbaa !5
%cmp4 = icmp eq i32 %0, 0
br i1 %cmp4, label %if.then, label %for.inc
if.then: ; preds = %entry
store i32 9, ptr %in, align 8, !tbaa !5
store i32 0, ptr %space, align 4, !tbaa !27
br label %for.inc
for.inc: ; preds = %entry, %if.then
%arrayidx.1 = getelementptr inbounds [9 x i32], ptr %in, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%cmp4.1 = icmp eq i32 %1, 0
br i1 %cmp4.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %for.inc
store i32 9, ptr %arrayidx.1, align 4, !tbaa !5
store i32 1, ptr %space, align 4, !tbaa !27
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%arrayidx.2 = getelementptr inbounds [9 x i32], ptr %in, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%2 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%cmp4.2 = icmp eq i32 %2, 0
br i1 %cmp4.2, label %if.then.2, label %for.inc.2
if.then.2: ; preds = %for.inc.1
store i32 9, ptr %arrayidx.2, align 8, !tbaa !5
store i32 2, ptr %space, align 4, !tbaa !27
br label %for.inc.2
for.inc.2: ; preds = %if.then.2, %for.inc.1
%arrayidx.3 = getelementptr inbounds [9 x i32], ptr %in, i64 0, i64 3
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.3)
%3 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%cmp4.3 = icmp eq i32 %3, 0
br i1 %cmp4.3, label %if.then.3, label %for.inc.3
if.then.3: ; preds = %for.inc.2
store i32 9, ptr %arrayidx.3, align 4, !tbaa !5
store i32 3, ptr %space, align 4, !tbaa !27
br label %for.inc.3
for.inc.3: ; preds = %if.then.3, %for.inc.2
%arrayidx.4 = getelementptr inbounds [9 x i32], ptr %in, i64 0, i64 4
%call.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.4)
%4 = load i32, ptr %arrayidx.4, align 8, !tbaa !5
%cmp4.4 = icmp eq i32 %4, 0
br i1 %cmp4.4, label %if.then.4, label %for.inc.4
if.then.4: ; preds = %for.inc.3
store i32 9, ptr %arrayidx.4, align 8, !tbaa !5
store i32 4, ptr %space, align 4, !tbaa !27
br label %for.inc.4
for.inc.4: ; preds = %if.then.4, %for.inc.3
%arrayidx.5 = getelementptr inbounds [9 x i32], ptr %in, i64 0, i64 5
%call.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.5)
%5 = load i32, ptr %arrayidx.5, align 4, !tbaa !5
%cmp4.5 = icmp eq i32 %5, 0
br i1 %cmp4.5, label %if.then.5, label %for.inc.5
if.then.5: ; preds = %for.inc.4
store i32 9, ptr %arrayidx.5, align 4, !tbaa !5
store i32 5, ptr %space, align 4, !tbaa !27
br label %for.inc.5
for.inc.5: ; preds = %if.then.5, %for.inc.4
%arrayidx.6 = getelementptr inbounds [9 x i32], ptr %in, i64 0, i64 6
%call.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.6)
%6 = load i32, ptr %arrayidx.6, align 8, !tbaa !5
%cmp4.6 = icmp eq i32 %6, 0
br i1 %cmp4.6, label %if.then.6, label %for.inc.6
if.then.6: ; preds = %for.inc.5
store i32 9, ptr %arrayidx.6, align 8, !tbaa !5
store i32 6, ptr %space, align 4, !tbaa !27
br label %for.inc.6
for.inc.6: ; preds = %if.then.6, %for.inc.5
%arrayidx.7 = getelementptr inbounds [9 x i32], ptr %in, i64 0, i64 7
%call.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.7)
%7 = load i32, ptr %arrayidx.7, align 4, !tbaa !5
%cmp4.7 = icmp eq i32 %7, 0
br i1 %cmp4.7, label %if.then.7, label %for.inc.7
if.then.7: ; preds = %for.inc.6
store i32 9, ptr %arrayidx.7, align 4, !tbaa !5
store i32 7, ptr %space, align 4, !tbaa !27
br label %for.inc.7
for.inc.7: ; preds = %if.then.7, %for.inc.6
%arrayidx.8 = getelementptr inbounds [9 x i32], ptr %in, i64 0, i64 8
%call.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.8)
%8 = load i32, ptr %arrayidx.8, align 8, !tbaa !5
%cmp4.8 = icmp eq i32 %8, 0
br i1 %cmp4.8, label %if.then.8, label %for.inc.8
if.then.8: ; preds = %for.inc.7
store i32 9, ptr %arrayidx.8, align 8, !tbaa !5
store i32 8, ptr %space, align 4, !tbaa !27
br label %for.inc.8
for.inc.8: ; preds = %if.then.8, %for.inc.7
%call8 = call i32 @bfs(ptr noundef nonnull byval(%struct.puzzle) align 8 %in)
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call8)
call void @llvm.lifetime.end.p0(i64 44, ptr nonnull %in) #9
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.ctpop.i8(i8) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i4 @llvm.ctpop.i4(i4) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v4i64(<4 x i64>) #8
attributes #0 = { 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 #1 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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 = !{i64 0, i64 36, !10, i64 36, i64 4, !5, i64 40, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = !{i8 0, i8 9}
!12 = !{i4 0, i4 5}
!13 = !{!14, !6, i64 40}
!14 = !{!"puzzle", !7, i64 0, !6, i64 36, !6, i64 40}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{i64 0, i64 4, !10, i64 4, i64 4, !5, i64 8, i64 4, !5}
!18 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!19 = !{i64 0, i64 4, !5}
!20 = !{i64 0, i64 32, !10, i64 32, i64 4, !5, i64 36, i64 4, !5}
!21 = !{i64 0, i64 28, !10, i64 28, i64 4, !5, i64 32, i64 4, !5}
!22 = !{i64 0, i64 24, !10, i64 24, i64 4, !5, i64 28, i64 4, !5}
!23 = !{i64 0, i64 20, !10, i64 20, i64 4, !5, i64 24, i64 4, !5}
!24 = !{i64 0, i64 16, !10, i64 16, i64 4, !5, i64 20, i64 4, !5}
!25 = !{i64 0, i64 12, !10, i64 12, i64 4, !5, i64 16, i64 4, !5}
!26 = !{i64 0, i64 8, !10, i64 8, i64 4, !5, i64 12, i64 4, !5}
!27 = !{!14, !6, i64 36}
!28 = distinct !{!28, !16}
!29 = !{!30}
!30 = distinct !{!30, !31, !"front: %agg.result"}
!31 = distinct !{!31, !"front"}
|
#include <stdio.h>
#include <stdlib.h>
#define N 3
int P[N][N],T[N][N];
int X[N+1]={0,1,0,-1};
int Y[N+1]={1,0,-1,0};
void empty(int *,int *);
void swap(int *,int *);
int cal();
int dfs(int ,int ,int ,int ,const int );
int main()
{
int i,j;
int h,ans,row,col;
for(i=0; i<N; i++){
for(j=0; j<N; j++){
scanf("%d",&P[i][j]);
}
}
empty(&row,&col);
for(h=0; h<100; h++){
for(i=0; i<N; i++){
for(j=0; j<N; j++){
T[i][j] = P[i][j];
}
}
ans = dfs(row,col,-1,0,h);
if(ans!=-1){
printf("%d\n",ans);
break;
}
for(i=0; i<N; i++){
for(j=0; j<N; j++){
P[i][j] = T[i][j];
}
}
ans = -1;
if(h==99)
printf("%d\n\n",ans);
}
return 0;
}
void empty(int *row,int *col)
{
int i,j;
for(i=0; i<N; i++){
for(j=0; j<N; j++){
if(!P[i][j]){
*row = j;
*col = i;
return;
}
}
}
}
void swap(int *a,int *b)
{
int tmp;
tmp = *a;
*a = *b;
*b = tmp;
}
int cal()
{
int i,e;
int C=0;
for(i=0; i<9; i++){
e = P[i/3][i%3];
if(e){
e--;
C += abs(i/3-e/3) + abs(i%3-e%3);
}
}
return C;
}
int dfs(int x,int y,int p,int deep,const int limt)
{
int i,len,emc;
int x2,y2;
len = cal();
if(len==0)
return deep;
if(deep+len > limt)
return -1;
for(i=0; i<N+1; i++){
x2 = x+X[i];
y2 = y+Y[i];
if(~p && i==(p+2)%4)
continue;
if(!(0<=x2 && x2<3 && 0<=y2 && y2<3))
continue;
swap(&P[y][x],&P[y2][x2]);
emc = dfs(x2,y2,i,deep+1,limt);
if(~emc)
return emc;
swap(&P[y][x],&P[y2][x2]);
}
return -1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189241/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189241/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@X = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 1, i32 0, i32 -1], align 16
@Y = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 0, i32 -1, i32 0], align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@P = dso_local global [3 x [3 x i32]] zeroinitializer, align 16
@T = dso_local local_unnamed_addr global [3 x [3 x i32]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%d\0A\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @P)
%call.1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 0, i64 1))
%call.2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 0, i64 2))
%call.198 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 1, i64 0))
%call.1.1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 1, i64 1))
%call.2.1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 1, i64 2))
%call.2100 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 2, i64 0))
%call.1.2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 2, i64 1))
%call.2.2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 2, i64 2))
%0 = load i32, ptr @P, align 16, !tbaa !5
%tobool.not.i = icmp eq i32 %0, 0
br i1 %tobool.not.i, label %empty.exit, label %for.inc.i
for.inc.i: ; preds = %entry
%1 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 0, i64 1), align 4, !tbaa !5
%tobool.not.1.i = icmp eq i32 %1, 0
br i1 %tobool.not.1.i, label %empty.exit, label %for.inc.1.i
for.inc.1.i: ; preds = %for.inc.i
%2 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 0, i64 2), align 8, !tbaa !5
%tobool.not.2.i = icmp eq i32 %2, 0
br i1 %tobool.not.2.i, label %empty.exit, label %for.inc.2.i
for.inc.2.i: ; preds = %for.inc.1.i
%3 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 1, i64 0), align 4, !tbaa !5
%tobool.not.125.i = icmp eq i32 %3, 0
br i1 %tobool.not.125.i, label %empty.exit, label %for.inc.126.i
for.inc.126.i: ; preds = %for.inc.2.i
%4 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 1, i64 1), align 16, !tbaa !5
%tobool.not.1.1.i = icmp eq i32 %4, 0
br i1 %tobool.not.1.1.i, label %empty.exit, label %for.inc.1.1.i
for.inc.1.1.i: ; preds = %for.inc.126.i
%5 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 1, i64 2), align 4, !tbaa !5
%tobool.not.2.1.i = icmp eq i32 %5, 0
br i1 %tobool.not.2.1.i, label %empty.exit, label %for.inc.2.1.i
for.inc.2.1.i: ; preds = %for.inc.1.1.i
%6 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 2, i64 0), align 8, !tbaa !5
%tobool.not.228.i = icmp eq i32 %6, 0
br i1 %tobool.not.228.i, label %empty.exit, label %for.inc.229.i
for.inc.229.i: ; preds = %for.inc.2.1.i
%7 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 2, i64 1), align 4, !tbaa !5
%tobool.not.1.2.i = icmp eq i32 %7, 0
%spec.select = select i1 %tobool.not.1.2.i, i32 1, i32 2
br label %empty.exit
empty.exit: ; preds = %for.inc.229.i, %entry, %for.inc.i, %for.inc.1.i, %for.inc.2.i, %for.inc.126.i, %for.inc.1.1.i, %for.inc.2.1.i
%row.0 = phi i32 [ 0, %entry ], [ 1, %for.inc.i ], [ 2, %for.inc.1.i ], [ 0, %for.inc.2.i ], [ 1, %for.inc.126.i ], [ 2, %for.inc.1.1.i ], [ 0, %for.inc.2.1.i ], [ %spec.select, %for.inc.229.i ]
%col.0 = phi i32 [ 0, %entry ], [ 0, %for.inc.i ], [ 0, %for.inc.1.i ], [ 1, %for.inc.2.i ], [ 1, %for.inc.126.i ], [ 1, %for.inc.1.1.i ], [ 2, %for.inc.2.1.i ], [ 2, %for.inc.229.i ]
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(36) @T, ptr noundef nonnull align 16 dereferenceable(36) @P, i64 36, i1 false), !tbaa !5
%call32111 = tail call i32 @dfs(i32 noundef %row.0, i32 noundef %col.0, i32 noundef -1, i32 noundef 0, i32 noundef 0)
%cmp33.not112 = icmp eq i32 %call32111, -1
br i1 %cmp33.not112, label %for.cond38.preheader.preheader, label %if.then
for.cond12.preheader: ; preds = %for.cond38.preheader.preheader
%inc60 = add nuw nsw i32 %h.093113, 1
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(36) @T, ptr noundef nonnull align 16 dereferenceable(36) @P, i64 36, i1 false), !tbaa !5
%call32 = tail call i32 @dfs(i32 noundef %row.0, i32 noundef %col.0, i32 noundef -1, i32 noundef 0, i32 noundef %inc60)
%cmp33.not = icmp eq i32 %call32, -1
br i1 %cmp33.not, label %for.cond38.preheader.preheader, label %if.then
for.cond38.preheader.preheader: ; preds = %empty.exit, %for.cond12.preheader
%h.093113 = phi i32 [ %inc60, %for.cond12.preheader ], [ 0, %empty.exit ]
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(36) @P, ptr noundef nonnull align 16 dereferenceable(36) @T, i64 36, i1 false), !tbaa !5
%cmp55 = icmp eq i32 %h.093113, 99
br i1 %cmp55, label %for.end61.loopexit, label %for.cond12.preheader
if.then: ; preds = %for.cond12.preheader, %empty.exit
%call32.lcssa = phi i32 [ %call32111, %empty.exit ], [ %call32, %for.cond12.preheader ]
%call34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call32.lcssa)
br label %for.end61
for.end61.loopexit: ; preds = %for.cond38.preheader.preheader
%call57 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef -1)
br label %for.end61
for.end61: ; preds = %for.end61.loopexit, %if.then
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: write, inaccessiblemem: none) uwtable
define dso_local void @empty(ptr nocapture noundef writeonly %row, ptr nocapture noundef writeonly %col) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @P, align 16, !tbaa !5
%tobool.not = icmp eq i32 %0, 0
br i1 %tobool.not, label %if.then, label %for.inc
if.then: ; preds = %for.inc.1.2, %for.inc.229, %for.inc.2.1, %for.inc.1.1, %for.inc.126, %for.inc.2, %for.inc.1, %for.inc, %entry
%i.019.lcssa = phi i32 [ 0, %entry ], [ 0, %for.inc ], [ 0, %for.inc.1 ], [ 1, %for.inc.2 ], [ 1, %for.inc.126 ], [ 1, %for.inc.1.1 ], [ 2, %for.inc.2.1 ], [ 2, %for.inc.229 ], [ 2, %for.inc.1.2 ]
%j.018.lcssa.wide = phi i32 [ 0, %entry ], [ 1, %for.inc ], [ 2, %for.inc.1 ], [ 0, %for.inc.2 ], [ 1, %for.inc.126 ], [ 2, %for.inc.1.1 ], [ 0, %for.inc.2.1 ], [ 1, %for.inc.229 ], [ 2, %for.inc.1.2 ]
store i32 %j.018.lcssa.wide, ptr %row, align 4, !tbaa !5
store i32 %i.019.lcssa, ptr %col, align 4, !tbaa !5
br label %cleanup
for.inc: ; preds = %entry
%1 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 0, i64 1), align 4, !tbaa !5
%tobool.not.1 = icmp eq i32 %1, 0
br i1 %tobool.not.1, label %if.then, label %for.inc.1
for.inc.1: ; preds = %for.inc
%2 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 0, i64 2), align 8, !tbaa !5
%tobool.not.2 = icmp eq i32 %2, 0
br i1 %tobool.not.2, label %if.then, label %for.inc.2
for.inc.2: ; preds = %for.inc.1
%3 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 1, i64 0), align 4, !tbaa !5
%tobool.not.125 = icmp eq i32 %3, 0
br i1 %tobool.not.125, label %if.then, label %for.inc.126
for.inc.126: ; preds = %for.inc.2
%4 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 1, i64 1), align 16, !tbaa !5
%tobool.not.1.1 = icmp eq i32 %4, 0
br i1 %tobool.not.1.1, label %if.then, label %for.inc.1.1
for.inc.1.1: ; preds = %for.inc.126
%5 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 1, i64 2), align 4, !tbaa !5
%tobool.not.2.1 = icmp eq i32 %5, 0
br i1 %tobool.not.2.1, label %if.then, label %for.inc.2.1
for.inc.2.1: ; preds = %for.inc.1.1
%6 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 2, i64 0), align 8, !tbaa !5
%tobool.not.228 = icmp eq i32 %6, 0
br i1 %tobool.not.228, label %if.then, label %for.inc.229
for.inc.229: ; preds = %for.inc.2.1
%7 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 2, i64 1), align 4, !tbaa !5
%tobool.not.1.2 = icmp eq i32 %7, 0
br i1 %tobool.not.1.2, label %if.then, label %for.inc.1.2
for.inc.1.2: ; preds = %for.inc.229
%8 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 2, i64 2), align 16, !tbaa !5
%tobool.not.2.2 = icmp eq i32 %8, 0
br i1 %tobool.not.2.2, label %if.then, label %cleanup
cleanup: ; preds = %for.inc.1.2, %if.then
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i32 @dfs(i32 noundef %x, i32 noundef %y, i32 noundef %p, i32 noundef %deep, i32 noundef %limt) local_unnamed_addr #3 {
entry:
%call = tail call i32 @cal()
%cmp = icmp eq i32 %call, 0
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%add = add nsw i32 %call, %deep
%cmp1 = icmp sgt i32 %add, %limt
br i1 %cmp1, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end
%idxprom22 = sext i32 %y to i64
%idxprom24 = sext i32 %x to i64
%arrayidx25 = getelementptr inbounds [3 x [3 x i32]], ptr @P, i64 0, i64 %idxprom22, i64 %idxprom24
%tobool.not = icmp eq i32 %p, -1
%add30 = add nsw i32 %deep, 1
br i1 %tobool.not, label %for.body.us.preheader, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%add9 = add nsw i32 %p, 2
%rem = srem i32 %add9, 4
%0 = load i32, ptr @X, align 16, !tbaa !5
%add5 = add nsw i32 %0, %x
%1 = load i32, ptr @Y, align 16, !tbaa !5
%add8 = add nsw i32 %1, %y
%cmp10 = icmp eq i32 %rem, 0
br i1 %cmp10, label %if.end12.1, label %if.end12
for.body.us.preheader: ; preds = %for.cond.preheader
%2 = load i32, ptr @X, align 16, !tbaa !5
%add5.us = add nsw i32 %2, %x
%3 = load i32, ptr @Y, align 16, !tbaa !5
%add8.us = add nsw i32 %3, %y
%or.cond.us = icmp ult i32 %add5.us, 3
%cmp17.us = icmp sgt i32 %add8.us, -1
%or.cond48.us = select i1 %or.cond.us, i1 %cmp17.us, i1 false
%cmp19.us = icmp slt i32 %add8.us, 3
%or.cond49.us = select i1 %or.cond48.us, i1 %cmp19.us, i1 false
br i1 %or.cond49.us, label %if.end21.us, label %for.inc.us
if.end21.us: ; preds = %for.body.us.preheader
%idxprom26.us = zext i32 %add8.us to i64
%idxprom28.us = zext i32 %add5.us to i64
%arrayidx29.us = getelementptr inbounds [3 x [3 x i32]], ptr @P, i64 0, i64 %idxprom26.us, i64 %idxprom28.us
%4 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%5 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
store i32 %5, ptr %arrayidx25, align 4, !tbaa !5
store i32 %4, ptr %arrayidx29.us, align 4, !tbaa !5
%call31.us = tail call i32 @dfs(i32 noundef %add5.us, i32 noundef %add8.us, i32 noundef 0, i32 noundef %add30, i32 noundef %limt)
%tobool33.not.us = icmp eq i32 %call31.us, -1
br i1 %tobool33.not.us, label %if.end35.us, label %cleanup
if.end35.us: ; preds = %if.end21.us
%6 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%7 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
store i32 %7, ptr %arrayidx25, align 4, !tbaa !5
store i32 %6, ptr %arrayidx29.us, align 4, !tbaa !5
br label %for.inc.us
for.inc.us: ; preds = %if.end35.us, %for.body.us.preheader
%8 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @X, i64 0, i64 1), align 4, !tbaa !5
%add5.us.1 = add nsw i32 %8, %x
%9 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @Y, i64 0, i64 1), align 4, !tbaa !5
%add8.us.1 = add nsw i32 %9, %y
%or.cond.us.1 = icmp ult i32 %add5.us.1, 3
%cmp17.us.1 = icmp sgt i32 %add8.us.1, -1
%or.cond48.us.1 = select i1 %or.cond.us.1, i1 %cmp17.us.1, i1 false
%cmp19.us.1 = icmp slt i32 %add8.us.1, 3
%or.cond49.us.1 = select i1 %or.cond48.us.1, i1 %cmp19.us.1, i1 false
br i1 %or.cond49.us.1, label %if.end21.us.1, label %for.inc.us.1
if.end21.us.1: ; preds = %for.inc.us
%idxprom26.us.1 = zext i32 %add8.us.1 to i64
%idxprom28.us.1 = zext i32 %add5.us.1 to i64
%arrayidx29.us.1 = getelementptr inbounds [3 x [3 x i32]], ptr @P, i64 0, i64 %idxprom26.us.1, i64 %idxprom28.us.1
%10 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%11 = load i32, ptr %arrayidx29.us.1, align 4, !tbaa !5
store i32 %11, ptr %arrayidx25, align 4, !tbaa !5
store i32 %10, ptr %arrayidx29.us.1, align 4, !tbaa !5
%call31.us.1 = tail call i32 @dfs(i32 noundef %add5.us.1, i32 noundef %add8.us.1, i32 noundef 1, i32 noundef %add30, i32 noundef %limt)
%tobool33.not.us.1 = icmp eq i32 %call31.us.1, -1
br i1 %tobool33.not.us.1, label %if.end35.us.1, label %cleanup
if.end35.us.1: ; preds = %if.end21.us.1
%12 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%13 = load i32, ptr %arrayidx29.us.1, align 4, !tbaa !5
store i32 %13, ptr %arrayidx25, align 4, !tbaa !5
store i32 %12, ptr %arrayidx29.us.1, align 4, !tbaa !5
br label %for.inc.us.1
for.inc.us.1: ; preds = %if.end35.us.1, %for.inc.us
%14 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @X, i64 0, i64 2), align 8, !tbaa !5
%add5.us.2 = add nsw i32 %14, %x
%15 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @Y, i64 0, i64 2), align 8, !tbaa !5
%add8.us.2 = add nsw i32 %15, %y
%or.cond.us.2 = icmp ult i32 %add5.us.2, 3
%cmp17.us.2 = icmp sgt i32 %add8.us.2, -1
%or.cond48.us.2 = select i1 %or.cond.us.2, i1 %cmp17.us.2, i1 false
%cmp19.us.2 = icmp slt i32 %add8.us.2, 3
%or.cond49.us.2 = select i1 %or.cond48.us.2, i1 %cmp19.us.2, i1 false
br i1 %or.cond49.us.2, label %if.end21.us.2, label %for.inc.us.2
if.end21.us.2: ; preds = %for.inc.us.1
%idxprom26.us.2 = zext i32 %add8.us.2 to i64
%idxprom28.us.2 = zext i32 %add5.us.2 to i64
%arrayidx29.us.2 = getelementptr inbounds [3 x [3 x i32]], ptr @P, i64 0, i64 %idxprom26.us.2, i64 %idxprom28.us.2
%16 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%17 = load i32, ptr %arrayidx29.us.2, align 4, !tbaa !5
store i32 %17, ptr %arrayidx25, align 4, !tbaa !5
store i32 %16, ptr %arrayidx29.us.2, align 4, !tbaa !5
%call31.us.2 = tail call i32 @dfs(i32 noundef %add5.us.2, i32 noundef %add8.us.2, i32 noundef 2, i32 noundef %add30, i32 noundef %limt)
%tobool33.not.us.2 = icmp eq i32 %call31.us.2, -1
br i1 %tobool33.not.us.2, label %if.end35.us.2, label %cleanup
if.end35.us.2: ; preds = %if.end21.us.2
%18 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%19 = load i32, ptr %arrayidx29.us.2, align 4, !tbaa !5
store i32 %19, ptr %arrayidx25, align 4, !tbaa !5
store i32 %18, ptr %arrayidx29.us.2, align 4, !tbaa !5
br label %for.inc.us.2
for.inc.us.2: ; preds = %if.end35.us.2, %for.inc.us.1
%20 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @X, i64 0, i64 3), align 4, !tbaa !5
%add5.us.3 = add nsw i32 %20, %x
%21 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @Y, i64 0, i64 3), align 4, !tbaa !5
%add8.us.3 = add nsw i32 %21, %y
%or.cond.us.3 = icmp ult i32 %add5.us.3, 3
%cmp17.us.3 = icmp sgt i32 %add8.us.3, -1
%or.cond48.us.3 = select i1 %or.cond.us.3, i1 %cmp17.us.3, i1 false
%cmp19.us.3 = icmp slt i32 %add8.us.3, 3
%or.cond49.us.3 = select i1 %or.cond48.us.3, i1 %cmp19.us.3, i1 false
br i1 %or.cond49.us.3, label %if.end21.us.3, label %cleanup
if.end21.us.3: ; preds = %for.inc.us.2
%idxprom26.us.3 = zext i32 %add8.us.3 to i64
%idxprom28.us.3 = zext i32 %add5.us.3 to i64
%arrayidx29.us.3 = getelementptr inbounds [3 x [3 x i32]], ptr @P, i64 0, i64 %idxprom26.us.3, i64 %idxprom28.us.3
%22 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%23 = load i32, ptr %arrayidx29.us.3, align 4, !tbaa !5
store i32 %23, ptr %arrayidx25, align 4, !tbaa !5
store i32 %22, ptr %arrayidx29.us.3, align 4, !tbaa !5
%call31.us.3 = tail call i32 @dfs(i32 noundef %add5.us.3, i32 noundef %add8.us.3, i32 noundef 3, i32 noundef %add30, i32 noundef %limt)
%tobool33.not.us.3 = icmp eq i32 %call31.us.3, -1
br i1 %tobool33.not.us.3, label %cleanup.sink.split, label %cleanup
if.end12: ; preds = %for.body.preheader
%or.cond = icmp ult i32 %add5, 3
%cmp17 = icmp sgt i32 %add8, -1
%or.cond48 = select i1 %or.cond, i1 %cmp17, i1 false
%cmp19 = icmp slt i32 %add8, 3
%or.cond49 = select i1 %or.cond48, i1 %cmp19, i1 false
br i1 %or.cond49, label %if.end21, label %for.inc
if.end21: ; preds = %if.end12
%idxprom26 = zext i32 %add8 to i64
%idxprom28 = zext i32 %add5 to i64
%arrayidx29 = getelementptr inbounds [3 x [3 x i32]], ptr @P, i64 0, i64 %idxprom26, i64 %idxprom28
%24 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%25 = load i32, ptr %arrayidx29, align 4, !tbaa !5
store i32 %25, ptr %arrayidx25, align 4, !tbaa !5
store i32 %24, ptr %arrayidx29, align 4, !tbaa !5
%call31 = tail call i32 @dfs(i32 noundef %add5, i32 noundef %add8, i32 noundef 0, i32 noundef %add30, i32 noundef %limt)
%tobool33.not = icmp eq i32 %call31, -1
br i1 %tobool33.not, label %if.end35, label %cleanup
if.end35: ; preds = %if.end21
%26 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%27 = load i32, ptr %arrayidx29, align 4, !tbaa !5
store i32 %27, ptr %arrayidx25, align 4, !tbaa !5
store i32 %26, ptr %arrayidx29, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end12, %if.end35
%cmp10.1 = icmp eq i32 %rem, 1
br i1 %cmp10.1, label %if.end12.2, label %if.end12.1
if.end12.1: ; preds = %for.body.preheader, %for.inc
%.pn95 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @X, i64 0, i64 1), align 4, !tbaa !5
%add5.181 = add nsw i32 %.pn95, %x
%.pn = load i32, ptr getelementptr inbounds ([4 x i32], ptr @Y, i64 0, i64 1), align 4, !tbaa !5
%add8.182 = add nsw i32 %.pn, %y
%or.cond.1 = icmp ult i32 %add5.181, 3
%cmp17.1 = icmp sgt i32 %add8.182, -1
%or.cond48.1 = select i1 %or.cond.1, i1 %cmp17.1, i1 false
%cmp19.1 = icmp slt i32 %add8.182, 3
%or.cond49.1 = select i1 %or.cond48.1, i1 %cmp19.1, i1 false
br i1 %or.cond49.1, label %if.end21.1, label %for.inc.1
if.end21.1: ; preds = %if.end12.1
%idxprom26.1 = zext i32 %add8.182 to i64
%idxprom28.1 = zext i32 %add5.181 to i64
%arrayidx29.1 = getelementptr inbounds [3 x [3 x i32]], ptr @P, i64 0, i64 %idxprom26.1, i64 %idxprom28.1
%28 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%29 = load i32, ptr %arrayidx29.1, align 4, !tbaa !5
store i32 %29, ptr %arrayidx25, align 4, !tbaa !5
store i32 %28, ptr %arrayidx29.1, align 4, !tbaa !5
%call31.1 = tail call i32 @dfs(i32 noundef %add5.181, i32 noundef %add8.182, i32 noundef 1, i32 noundef %add30, i32 noundef %limt)
%tobool33.not.1 = icmp eq i32 %call31.1, -1
br i1 %tobool33.not.1, label %if.end35.1, label %cleanup
if.end35.1: ; preds = %if.end21.1
%30 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%31 = load i32, ptr %arrayidx29.1, align 4, !tbaa !5
store i32 %31, ptr %arrayidx25, align 4, !tbaa !5
store i32 %30, ptr %arrayidx29.1, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.end35.1, %if.end12.1
%cmp10.2 = icmp eq i32 %rem, 2
br i1 %cmp10.2, label %if.end12.3, label %if.end12.2
if.end12.2: ; preds = %for.inc, %for.inc.1
%.pn97 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @X, i64 0, i64 2), align 8, !tbaa !5
%add5.286 = add nsw i32 %.pn97, %x
%.pn96 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @Y, i64 0, i64 2), align 8, !tbaa !5
%add8.287 = add nsw i32 %.pn96, %y
%or.cond.2 = icmp ult i32 %add5.286, 3
%cmp17.2 = icmp sgt i32 %add8.287, -1
%or.cond48.2 = select i1 %or.cond.2, i1 %cmp17.2, i1 false
%cmp19.2 = icmp slt i32 %add8.287, 3
%or.cond49.2 = select i1 %or.cond48.2, i1 %cmp19.2, i1 false
br i1 %or.cond49.2, label %if.end21.2, label %for.inc.2
if.end21.2: ; preds = %if.end12.2
%idxprom26.2 = zext i32 %add8.287 to i64
%idxprom28.2 = zext i32 %add5.286 to i64
%arrayidx29.2 = getelementptr inbounds [3 x [3 x i32]], ptr @P, i64 0, i64 %idxprom26.2, i64 %idxprom28.2
%32 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%33 = load i32, ptr %arrayidx29.2, align 4, !tbaa !5
store i32 %33, ptr %arrayidx25, align 4, !tbaa !5
store i32 %32, ptr %arrayidx29.2, align 4, !tbaa !5
%call31.2 = tail call i32 @dfs(i32 noundef %add5.286, i32 noundef %add8.287, i32 noundef 2, i32 noundef %add30, i32 noundef %limt)
%tobool33.not.2 = icmp eq i32 %call31.2, -1
br i1 %tobool33.not.2, label %if.end35.2, label %cleanup
if.end35.2: ; preds = %if.end21.2
%34 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%35 = load i32, ptr %arrayidx29.2, align 4, !tbaa !5
store i32 %35, ptr %arrayidx25, align 4, !tbaa !5
store i32 %34, ptr %arrayidx29.2, align 4, !tbaa !5
br label %for.inc.2
for.inc.2: ; preds = %if.end35.2, %if.end12.2
%cmp10.3 = icmp eq i32 %rem, 3
br i1 %cmp10.3, label %cleanup, label %if.end12.3
if.end12.3: ; preds = %for.inc.1, %for.inc.2
%.pn99 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @X, i64 0, i64 3), align 4, !tbaa !5
%add5.391 = add nsw i32 %.pn99, %x
%.pn98 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @Y, i64 0, i64 3), align 4, !tbaa !5
%add8.392 = add nsw i32 %.pn98, %y
%or.cond.3 = icmp ult i32 %add5.391, 3
%cmp17.3 = icmp sgt i32 %add8.392, -1
%or.cond48.3 = select i1 %or.cond.3, i1 %cmp17.3, i1 false
%cmp19.3 = icmp slt i32 %add8.392, 3
%or.cond49.3 = select i1 %or.cond48.3, i1 %cmp19.3, i1 false
br i1 %or.cond49.3, label %if.end21.3, label %cleanup
if.end21.3: ; preds = %if.end12.3
%idxprom26.3 = zext i32 %add8.392 to i64
%idxprom28.3 = zext i32 %add5.391 to i64
%arrayidx29.3 = getelementptr inbounds [3 x [3 x i32]], ptr @P, i64 0, i64 %idxprom26.3, i64 %idxprom28.3
%36 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%37 = load i32, ptr %arrayidx29.3, align 4, !tbaa !5
store i32 %37, ptr %arrayidx25, align 4, !tbaa !5
store i32 %36, ptr %arrayidx29.3, align 4, !tbaa !5
%call31.3 = tail call i32 @dfs(i32 noundef %add5.391, i32 noundef %add8.392, i32 noundef 3, i32 noundef %add30, i32 noundef %limt)
%tobool33.not.3 = icmp eq i32 %call31.3, -1
br i1 %tobool33.not.3, label %cleanup.sink.split, label %cleanup
cleanup.sink.split: ; preds = %if.end21.3, %if.end21.us.3
%arrayidx29.3.sink94 = phi ptr [ %arrayidx29.us.3, %if.end21.us.3 ], [ %arrayidx29.3, %if.end21.3 ]
%38 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%39 = load i32, ptr %arrayidx29.3.sink94, align 4, !tbaa !5
store i32 %39, ptr %arrayidx25, align 4, !tbaa !5
store i32 %38, ptr %arrayidx29.3.sink94, align 4, !tbaa !5
br label %cleanup
cleanup: ; preds = %cleanup.sink.split, %if.end21, %if.end21.1, %if.end21.2, %if.end21.3, %if.end12.3, %for.inc.2, %if.end21.us, %if.end21.us.1, %if.end21.us.2, %if.end21.us.3, %for.inc.us.2, %if.end, %entry
%retval.0 = phi i32 [ %deep, %entry ], [ -1, %if.end ], [ %call31.us, %if.end21.us ], [ %call31.us.1, %if.end21.us.1 ], [ %call31.us.2, %if.end21.us.2 ], [ %call31.us.3, %if.end21.us.3 ], [ -1, %for.inc.us.2 ], [ %call31, %if.end21 ], [ %call31.1, %if.end21.1 ], [ %call31.2, %if.end21.2 ], [ %call31.3, %if.end21.3 ], [ -1, %if.end12.3 ], [ -1, %for.inc.2 ], [ -1, %cleanup.sink.split ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 #4 {
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 nofree nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @cal() local_unnamed_addr #5 {
entry:
%0 = load i32, ptr @P, align 16, !tbaa !5
%tobool.not = icmp eq i32 %0, 0
br i1 %tobool.not, label %for.inc, label %if.then
if.then: ; preds = %entry
%dec = add nsw i32 %0, -1
%div4.neg = sdiv i32 %dec, -3
%1 = tail call i32 @llvm.abs.i32(i32 %div4.neg, i1 true)
%rem6 = srem i32 %dec, 3
%2 = tail call i32 @llvm.abs.i32(i32 %rem6, i1 true)
%add8 = add nuw nsw i32 %2, %1
br label %for.inc
for.inc: ; preds = %entry, %if.then
%C.1 = phi i32 [ %add8, %if.then ], [ 0, %entry ]
%3 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 0, i64 1), align 4, !tbaa !5
%tobool.not.1 = icmp eq i32 %3, 0
br i1 %tobool.not.1, label %for.inc.1, label %if.then.1
if.then.1: ; preds = %for.inc
%dec.1 = add nsw i32 %3, -1
%div4.neg.1 = sdiv i32 %dec.1, -3
%4 = tail call i32 @llvm.abs.i32(i32 %div4.neg.1, i1 true)
%rem6.1 = srem i32 %dec.1, 3
%sub7.1 = sub nsw i32 1, %rem6.1
%5 = tail call i32 @llvm.abs.i32(i32 %sub7.1, i1 true)
%add.1 = add nuw nsw i32 %5, %C.1
%add8.1 = add nuw nsw i32 %add.1, %4
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%C.1.1 = phi i32 [ %add8.1, %if.then.1 ], [ %C.1, %for.inc ]
%6 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 0, i64 2), align 8, !tbaa !5
%tobool.not.2 = icmp eq i32 %6, 0
br i1 %tobool.not.2, label %for.inc.2, label %if.then.2
if.then.2: ; preds = %for.inc.1
%dec.2 = add nsw i32 %6, -1
%div4.neg.2 = sdiv i32 %dec.2, -3
%7 = tail call i32 @llvm.abs.i32(i32 %div4.neg.2, i1 true)
%rem6.2 = srem i32 %dec.2, 3
%reass.sub = sub i32 %C.1.1, %rem6.2
%add.2 = add i32 %reass.sub, 2
%add8.2 = add nuw i32 %add.2, %7
br label %for.inc.2
for.inc.2: ; preds = %if.then.2, %for.inc.1
%C.1.2 = phi i32 [ %add8.2, %if.then.2 ], [ %C.1.1, %for.inc.1 ]
%8 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 1, i64 0), align 4, !tbaa !5
%tobool.not.3 = icmp eq i32 %8, 0
br i1 %tobool.not.3, label %for.inc.3, label %if.then.3
if.then.3: ; preds = %for.inc.2
%dec.3 = add nsw i32 %8, -1
%div4.neg.3 = sdiv i32 %dec.3, -3
%sub.3 = add nsw i32 %div4.neg.3, 1
%9 = tail call i32 @llvm.abs.i32(i32 %sub.3, i1 true)
%rem6.3 = srem i32 %dec.3, 3
%10 = tail call i32 @llvm.abs.i32(i32 %rem6.3, i1 true)
%add.3 = add nuw i32 %10, %C.1.2
%add8.3 = add nuw i32 %add.3, %9
br label %for.inc.3
for.inc.3: ; preds = %if.then.3, %for.inc.2
%C.1.3 = phi i32 [ %add8.3, %if.then.3 ], [ %C.1.2, %for.inc.2 ]
%11 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 1, i64 1), align 16, !tbaa !5
%tobool.not.4 = icmp eq i32 %11, 0
br i1 %tobool.not.4, label %for.inc.4, label %if.then.4
if.then.4: ; preds = %for.inc.3
%dec.4 = add nsw i32 %11, -1
%div4.neg.4 = sdiv i32 %dec.4, -3
%sub.4 = add nsw i32 %div4.neg.4, 1
%12 = tail call i32 @llvm.abs.i32(i32 %sub.4, i1 true)
%rem6.4 = srem i32 %dec.4, 3
%sub7.4 = sub nsw i32 1, %rem6.4
%13 = tail call i32 @llvm.abs.i32(i32 %sub7.4, i1 true)
%add.4 = add nuw i32 %13, %C.1.3
%add8.4 = add nuw i32 %add.4, %12
br label %for.inc.4
for.inc.4: ; preds = %if.then.4, %for.inc.3
%C.1.4 = phi i32 [ %add8.4, %if.then.4 ], [ %C.1.3, %for.inc.3 ]
%14 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 1, i64 2), align 4, !tbaa !5
%tobool.not.5 = icmp eq i32 %14, 0
br i1 %tobool.not.5, label %for.inc.5, label %if.then.5
if.then.5: ; preds = %for.inc.4
%dec.5 = add nsw i32 %14, -1
%div4.neg.5 = sdiv i32 %dec.5, -3
%sub.5 = add nsw i32 %div4.neg.5, 1
%15 = tail call i32 @llvm.abs.i32(i32 %sub.5, i1 true)
%rem6.5 = srem i32 %dec.5, 3
%reass.sub22 = sub i32 %C.1.4, %rem6.5
%add.5 = add i32 %reass.sub22, 2
%add8.5 = add i32 %add.5, %15
br label %for.inc.5
for.inc.5: ; preds = %if.then.5, %for.inc.4
%C.1.5 = phi i32 [ %add8.5, %if.then.5 ], [ %C.1.4, %for.inc.4 ]
%16 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 2, i64 0), align 8, !tbaa !5
%tobool.not.6 = icmp eq i32 %16, 0
br i1 %tobool.not.6, label %for.inc.6, label %if.then.6
if.then.6: ; preds = %for.inc.5
%dec.6 = add nsw i32 %16, -1
%div4.neg.6 = sdiv i32 %dec.6, -3
%sub.6 = add nsw i32 %div4.neg.6, 2
%17 = tail call i32 @llvm.abs.i32(i32 %sub.6, i1 true)
%rem6.6 = srem i32 %dec.6, 3
%18 = tail call i32 @llvm.abs.i32(i32 %rem6.6, i1 true)
%add.6 = add i32 %18, %C.1.5
%add8.6 = add i32 %add.6, %17
br label %for.inc.6
for.inc.6: ; preds = %if.then.6, %for.inc.5
%C.1.6 = phi i32 [ %add8.6, %if.then.6 ], [ %C.1.5, %for.inc.5 ]
%19 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 2, i64 1), align 4, !tbaa !5
%tobool.not.7 = icmp eq i32 %19, 0
br i1 %tobool.not.7, label %for.inc.7, label %if.then.7
if.then.7: ; preds = %for.inc.6
%dec.7 = add nsw i32 %19, -1
%div4.neg.7 = sdiv i32 %dec.7, -3
%sub.7 = add nsw i32 %div4.neg.7, 2
%20 = tail call i32 @llvm.abs.i32(i32 %sub.7, i1 true)
%rem6.7 = srem i32 %dec.7, 3
%sub7.7 = sub nsw i32 1, %rem6.7
%21 = tail call i32 @llvm.abs.i32(i32 %sub7.7, i1 true)
%add.7 = add i32 %21, %C.1.6
%add8.7 = add i32 %add.7, %20
br label %for.inc.7
for.inc.7: ; preds = %if.then.7, %for.inc.6
%C.1.7 = phi i32 [ %add8.7, %if.then.7 ], [ %C.1.6, %for.inc.6 ]
%22 = load i32, ptr getelementptr inbounds ([3 x [3 x i32]], ptr @P, i64 0, i64 2, i64 2), align 16, !tbaa !5
%tobool.not.8 = icmp eq i32 %22, 0
br i1 %tobool.not.8, label %for.inc.8, label %if.then.8
if.then.8: ; preds = %for.inc.7
%dec.8 = add nsw i32 %22, -1
%div4.neg.8 = sdiv i32 %dec.8, -3
%sub.8 = add nsw i32 %div4.neg.8, 2
%23 = tail call i32 @llvm.abs.i32(i32 %sub.8, i1 true)
%rem6.8 = srem i32 %dec.8, 3
%reass.sub23 = sub i32 %C.1.7, %rem6.8
%add.8 = add i32 %reass.sub23, 2
%add8.8 = add i32 %add.8, %23
br label %for.inc.8
for.inc.8: ; preds = %if.then.8, %for.inc.7
%C.1.8 = phi i32 [ %add8.8, %if.then.8 ], [ %C.1.7, %for.inc.7 ]
ret i32 %C.1.8
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #7
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: write, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { mustprogress nofree 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 #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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>
void swap(int *a,int *b){
int c=*a;
*a=*b;
*b=c;
}
int main(){
int w,n;
int a,b;
int c[31];
int i,j;
scanf("%d",&w);
scanf("%d",&n);
for(i=0;i<w;i++){
c[i]=i+1;
}
for(i=0;i<n;i++){
scanf("%d,%d",&a,&b);
swap(&c[a-1],&c[b-1]);
}
for(i=0;i<w;i++){
printf("%d\n",c[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189292/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189292/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d,%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\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 nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%w = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca [31 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #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 void @llvm.lifetime.start.p0(i64 124, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %w, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body.preheader, label %for.cond2.preheader
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader42, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%1 = getelementptr inbounds [31 x i32], ptr %c, i64 0, i64 %index
%2 = trunc <4 x i64> %vec.ind to <4 x i32>
%3 = add <4 x i32> %2, <i32 1, i32 1, i32 1, i32 1>
%4 = trunc <4 x i64> %vec.ind to <4 x i32>
%5 = add <4 x i32> %4, <i32 5, i32 5, i32 5, i32 5>
store <4 x i32> %3, ptr %1, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> %5, ptr %6, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond2.preheader, label %for.body.preheader42
for.body.preheader42: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond2.preheader: ; preds = %for.body, %middle.block, %entry
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp333 = icmp sgt i32 %8, 0
br i1 %cmp333, label %for.body4, label %for.cond14.preheader
for.body: ; preds = %for.body.preheader42, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader42 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [31 x i32], ptr %c, i64 0, i64 %indvars.iv
%9 = trunc i64 %indvars.iv.next to i32
store i32 %9, ptr %arrayidx, align 4, !tbaa !5
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond2.preheader, label %for.body, !llvm.loop !13
for.cond14.preheader.loopexit: ; preds = %for.body4
%.pre = load i32, ptr %w, align 4, !tbaa !5
br label %for.cond14.preheader
for.cond14.preheader: ; preds = %for.cond14.preheader.loopexit, %for.cond2.preheader
%10 = phi i32 [ %.pre, %for.cond14.preheader.loopexit ], [ %0, %for.cond2.preheader ]
%cmp1535 = icmp sgt i32 %10, 0
br i1 %cmp1535, label %for.body16, label %for.end22
for.body4: ; preds = %for.cond2.preheader, %for.body4
%i.134 = phi i32 [ %inc12, %for.body4 ], [ 0, %for.cond2.preheader ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%11 = load i32, ptr %a, align 4, !tbaa !5
%sub = add nsw i32 %11, -1
%idxprom6 = sext i32 %sub to i64
%arrayidx7 = getelementptr inbounds [31 x i32], ptr %c, i64 0, i64 %idxprom6
%12 = load i32, ptr %b, align 4, !tbaa !5
%sub8 = add nsw i32 %12, -1
%idxprom9 = sext i32 %sub8 to i64
%arrayidx10 = getelementptr inbounds [31 x i32], ptr %c, i64 0, i64 %idxprom9
%13 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%14 = load i32, ptr %arrayidx10, align 4, !tbaa !5
store i32 %14, ptr %arrayidx7, align 4, !tbaa !5
store i32 %13, ptr %arrayidx10, align 4, !tbaa !5
%inc12 = add nuw nsw i32 %i.134, 1
%15 = load i32, ptr %n, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc12, %15
br i1 %cmp3, label %for.body4, label %for.cond14.preheader.loopexit, !llvm.loop !14
for.body16: ; preds = %for.cond14.preheader, %for.body16
%indvars.iv38 = phi i64 [ %indvars.iv.next39, %for.body16 ], [ 0, %for.cond14.preheader ]
%arrayidx18 = getelementptr inbounds [31 x i32], ptr %c, i64 0, i64 %indvars.iv38
%16 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
%17 = load i32, ptr %w, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp15 = icmp slt i64 %indvars.iv.next39, %18
br i1 %cmp15, label %for.body16, label %for.end22, !llvm.loop !15
for.end22: ; preds = %for.body16, %for.cond14.preheader
call void @llvm.lifetime.end.p0(i64 124, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
void sort( int *);
int main(void)
{
int n,w,a,b;
int array[30];
int i,s;
for(i=0; i<30; i++) array[i] = i+1;
scanf("%d",&w);
scanf("%d",&n);
for(i=0; i<n; i++){
sort(array);
}
for(i=0;i<w;i++){
printf("%d\r\n", array[i]);
}
return 0;
}
void sort(int *array){
int a,b, i;
int s;
scanf("%d, %d",&a, &b);
--a;
--b;
s = *(array+a);
*(array+a) = *(array+b);
*(array+b) = s;
return;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189342/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189342/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d\0D\0A\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d, %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a.i = alloca i32, align 4
%b.i = alloca i32, align 4
%n = alloca i32, align 4
%w = alloca i32, align 4
%array = alloca [30 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %array) #3
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, ptr %array, align 16, !tbaa !5
%arrayidx.4 = getelementptr inbounds [30 x i32], ptr %array, i64 0, i64 4
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, ptr %arrayidx.4, align 16, !tbaa !5
%arrayidx.8 = getelementptr inbounds [30 x i32], ptr %array, i64 0, i64 8
store <4 x i32> <i32 9, i32 10, i32 11, i32 12>, ptr %arrayidx.8, align 16, !tbaa !5
%arrayidx.12 = getelementptr inbounds [30 x i32], ptr %array, i64 0, i64 12
store <4 x i32> <i32 13, i32 14, i32 15, i32 16>, ptr %arrayidx.12, align 16, !tbaa !5
%arrayidx.16 = getelementptr inbounds [30 x i32], ptr %array, i64 0, i64 16
store <4 x i32> <i32 17, i32 18, i32 19, i32 20>, ptr %arrayidx.16, align 16, !tbaa !5
%arrayidx.20 = getelementptr inbounds [30 x i32], ptr %array, i64 0, i64 20
store <4 x i32> <i32 21, i32 22, i32 23, i32 24>, ptr %arrayidx.20, align 16, !tbaa !5
%arrayidx.24 = getelementptr inbounds [30 x i32], ptr %array, i64 0, i64 24
store <4 x i32> <i32 25, i32 26, i32 27, i32 28>, ptr %arrayidx.24, align 16, !tbaa !5
%arrayidx.28 = getelementptr inbounds [30 x i32], ptr %array, i64 0, i64 28
store i32 29, ptr %arrayidx.28, align 16, !tbaa !5
%arrayidx.29 = getelementptr inbounds [30 x i32], ptr %array, i64 0, i64 29
store i32 30, ptr %arrayidx.29, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp326 = icmp sgt i32 %0, 0
br i1 %cmp326, label %for.body4, label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.body4, %entry
%1 = load i32, ptr %w, align 4, !tbaa !5
%cmp928 = icmp sgt i32 %1, 0
br i1 %cmp928, label %for.body10, label %for.end16
for.body4: ; preds = %entry, %for.body4
%i.127 = phi i32 [ %inc6, %for.body4 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a.i) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b.i) #3
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %a.i, ptr noundef nonnull %b.i)
%2 = load i32, ptr %a.i, align 4, !tbaa !5
%dec.i = add nsw i32 %2, -1
%3 = load i32, ptr %b.i, align 4, !tbaa !5
%dec1.i = add nsw i32 %3, -1
%idx.ext.i = sext i32 %dec.i to i64
%add.ptr.i = getelementptr inbounds i32, ptr %array, i64 %idx.ext.i
%4 = load i32, ptr %add.ptr.i, align 4, !tbaa !5
%idx.ext2.i = sext i32 %dec1.i to i64
%add.ptr3.i = getelementptr inbounds i32, ptr %array, i64 %idx.ext2.i
%5 = load i32, ptr %add.ptr3.i, align 4, !tbaa !5
store i32 %5, ptr %add.ptr.i, align 4, !tbaa !5
store i32 %4, ptr %add.ptr3.i, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b.i) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a.i) #3
%inc6 = add nuw nsw i32 %i.127, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc6, %6
br i1 %cmp3, label %for.body4, label %for.cond8.preheader, !llvm.loop !9
for.body10: ; preds = %for.cond8.preheader, %for.body10
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body10 ], [ 0, %for.cond8.preheader ]
%arrayidx12 = getelementptr inbounds [30 x i32], ptr %array, i64 0, i64 %indvars.iv
%7 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %w, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp9 = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp9, label %for.body10, label %for.end16, !llvm.loop !11
for.end16: ; preds = %for.body10, %for.cond8.preheader
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %array) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @sort(ptr nocapture noundef %array) 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.2, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
%1 = load i32, ptr %b, align 4, !tbaa !5
%dec1 = add nsw i32 %1, -1
%idx.ext = sext i32 %dec to i64
%add.ptr = getelementptr inbounds i32, ptr %array, i64 %idx.ext
%2 = load i32, ptr %add.ptr, align 4, !tbaa !5
%idx.ext2 = sext i32 %dec1 to i64
%add.ptr3 = getelementptr inbounds i32, ptr %array, i64 %idx.ext2
%3 = load i32, ptr %add.ptr3, align 4, !tbaa !5
store i32 %3, ptr %add.ptr, align 4, !tbaa !5
store i32 %2, ptr %add.ptr3, align 4, !tbaa !5
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 void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main() {
int w, n, i, a, b, c[30], temp;
scanf("%d", &w);
for (i = 0;i < w;i++) {
c[i] = i + 1;
}
scanf("%d", &n);
for(i=0;i<n;i++){
scanf("%d,%d", &a, &b);
temp=c[a-1];
c[a-1] = c[b-1];
c[b-1] = temp;
}
for (i = 0;i < w;i++) {
printf("%d\n", c[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189393/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189393/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d,%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%w = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca [30 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
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 void @llvm.lifetime.start.p0(i64 120, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%0 = load i32, ptr %w, align 4, !tbaa !5
%cmp37 = icmp sgt i32 %0, 0
br i1 %cmp37, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader48, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%1 = getelementptr inbounds [30 x i32], ptr %c, i64 0, i64 %index
%2 = trunc <4 x i64> %vec.ind to <4 x i32>
%3 = add <4 x i32> %2, <i32 1, i32 1, i32 1, i32 1>
%4 = trunc <4 x i64> %vec.ind to <4 x i32>
%5 = add <4 x i32> %4, <i32 5, i32 5, i32 5, i32 5>
store <4 x i32> %3, ptr %1, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> %5, ptr %6, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader48
for.body.preheader48: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader48, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader48 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [30 x i32], ptr %c, i64 0, i64 %indvars.iv
%8 = trunc i64 %indvars.iv.next to i32
store i32 %8, ptr %arrayidx, align 4, !tbaa !5
%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, %middle.block, %entry
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%9 = load i32, ptr %n, align 4, !tbaa !5
%cmp339 = icmp sgt i32 %9, 0
br i1 %cmp339, label %for.body4, label %for.cond20.preheader
for.cond20.preheader: ; preds = %for.body4, %for.end
%10 = load i32, ptr %w, align 4, !tbaa !5
%cmp2141 = icmp sgt i32 %10, 0
br i1 %cmp2141, label %for.body22, label %for.end28
for.body4: ; preds = %for.end, %for.body4
%i.140 = phi i32 [ %inc18, %for.body4 ], [ 0, %for.end ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%11 = load i32, ptr %a, align 4, !tbaa !5
%sub = add nsw i32 %11, -1
%idxprom6 = sext i32 %sub to i64
%arrayidx7 = getelementptr inbounds [30 x i32], ptr %c, i64 0, i64 %idxprom6
%12 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%13 = load i32, ptr %b, align 4, !tbaa !5
%sub8 = add nsw i32 %13, -1
%idxprom9 = sext i32 %sub8 to i64
%arrayidx10 = getelementptr inbounds [30 x i32], ptr %c, i64 0, i64 %idxprom9
%14 = load i32, ptr %arrayidx10, align 4, !tbaa !5
store i32 %14, ptr %arrayidx7, align 4, !tbaa !5
store i32 %12, ptr %arrayidx10, align 4, !tbaa !5
%inc18 = add nuw nsw i32 %i.140, 1
%15 = load i32, ptr %n, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc18, %15
br i1 %cmp3, label %for.body4, label %for.cond20.preheader, !llvm.loop !14
for.body22: ; preds = %for.cond20.preheader, %for.body22
%indvars.iv44 = phi i64 [ %indvars.iv.next45, %for.body22 ], [ 0, %for.cond20.preheader ]
%arrayidx24 = getelementptr inbounds [30 x i32], ptr %c, i64 0, i64 %indvars.iv44
%16 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%17 = load i32, ptr %w, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp21 = icmp slt i64 %indvars.iv.next45, %18
br i1 %cmp21, label %for.body22, label %for.end28, !llvm.loop !15
for.end28: ; preds = %for.body22, %for.cond20.preheader
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#define MAX 30
int main(void) {
int w, n; // cüÆ¡üÌ
int a, b; // ¡_Ìn_ÆI_
int result[MAX];
int i, t;
char c;
scanf("%d", &w);
scanf("%d", &n);
for(i = 0; i < w; i++) {
result[i] = i+1;
}
for(i = 0; i < n; i++) {
scanf("%d", &a);
scanf("%1c", &c);
scanf("%d", &b);
t = result[a-1];
result[a-1] = result[b-1];
result[b-1] = t;
}
for(i = 0; i < w; i++) {
printf("%d\n", result[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189450/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189450/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%1c\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%w = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%result = alloca [30 x i32], align 16
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
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 void @llvm.lifetime.start.p0(i64 120, ptr nonnull %result) #3
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %w, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.body.preheader, label %for.cond2.preheader
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader50, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%1 = getelementptr inbounds [30 x i32], ptr %result, i64 0, i64 %index
%2 = trunc <4 x i64> %vec.ind to <4 x i32>
%3 = add <4 x i32> %2, <i32 1, i32 1, i32 1, i32 1>
%4 = trunc <4 x i64> %vec.ind to <4 x i32>
%5 = add <4 x i32> %4, <i32 5, i32 5, i32 5, i32 5>
store <4 x i32> %3, ptr %1, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> %5, ptr %6, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond2.preheader, label %for.body.preheader50
for.body.preheader50: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond2.preheader: ; preds = %for.body, %middle.block, %entry
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp341 = icmp sgt i32 %8, 0
br i1 %cmp341, label %for.body4, label %for.cond22.preheader
for.body: ; preds = %for.body.preheader50, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader50 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [30 x i32], ptr %result, i64 0, i64 %indvars.iv
%9 = trunc i64 %indvars.iv.next to i32
store i32 %9, ptr %arrayidx, align 4, !tbaa !5
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond2.preheader, label %for.body, !llvm.loop !13
for.cond22.preheader.loopexit: ; preds = %for.body4
%.pre = load i32, ptr %w, align 4, !tbaa !5
br label %for.cond22.preheader
for.cond22.preheader: ; preds = %for.cond22.preheader.loopexit, %for.cond2.preheader
%10 = phi i32 [ %.pre, %for.cond22.preheader.loopexit ], [ %0, %for.cond2.preheader ]
%cmp2343 = icmp sgt i32 %10, 0
br i1 %cmp2343, label %for.body24, label %for.end30
for.body4: ; preds = %for.cond2.preheader, %for.body4
%i.142 = phi i32 [ %inc20, %for.body4 ], [ 0, %for.cond2.preheader ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %c)
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%11 = load i32, ptr %a, align 4, !tbaa !5
%sub = add nsw i32 %11, -1
%idxprom8 = sext i32 %sub to i64
%arrayidx9 = getelementptr inbounds [30 x i32], ptr %result, i64 0, i64 %idxprom8
%12 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%13 = load i32, ptr %b, align 4, !tbaa !5
%sub10 = add nsw i32 %13, -1
%idxprom11 = sext i32 %sub10 to i64
%arrayidx12 = getelementptr inbounds [30 x i32], ptr %result, i64 0, i64 %idxprom11
%14 = load i32, ptr %arrayidx12, align 4, !tbaa !5
store i32 %14, ptr %arrayidx9, align 4, !tbaa !5
store i32 %12, ptr %arrayidx12, align 4, !tbaa !5
%inc20 = add nuw nsw i32 %i.142, 1
%15 = load i32, ptr %n, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc20, %15
br i1 %cmp3, label %for.body4, label %for.cond22.preheader.loopexit, !llvm.loop !14
for.body24: ; preds = %for.cond22.preheader, %for.body24
%indvars.iv46 = phi i64 [ %indvars.iv.next47, %for.body24 ], [ 0, %for.cond22.preheader ]
%arrayidx26 = getelementptr inbounds [30 x i32], ptr %result, i64 0, i64 %indvars.iv46
%16 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%17 = load i32, ptr %w, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp23 = icmp slt i64 %indvars.iv.next47, %18
br i1 %cmp23, label %for.body24, label %for.end30, !llvm.loop !15
for.end30: ; preds = %for.body24, %for.cond22.preheader
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %result) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int main()
{
int n, m, i;
int a, b, t;
int buf[31];
scanf("%d", &n);
for (i = 1; i <= n; i++) {
buf[i] = i;
}
scanf("%d", &m);
for (i = 0; i < m; i++) {
scanf("%d,%d", &a, &b);
t = buf[a];
buf[a] = buf[b];
buf[b] = t;
}
for (i = 1; i <= n; i++) {
printf("%d\n", buf[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189508/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189508/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d,%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%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
%a = alloca i32, align 4
%b = alloca i32, align 4
%buf = alloca [31 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
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 void @llvm.lifetime.start.p0(i64 124, ptr nonnull %buf) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not34 = icmp slt i32 %0, 1
br i1 %cmp.not34, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = add nuw i32 %0, 1
%wide.trip.count = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader45, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %2, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%offset.idx = or i64 %index, 1
%3 = getelementptr inbounds [31 x i32], ptr %buf, i64 0, i64 %offset.idx
store <4 x i32> %vec.ind, ptr %3, align 4, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> %step.add, ptr %4, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %2, %n.vec
br i1 %cmp.n, label %for.end, label %for.body.preheader45
for.body.preheader45: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader45, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader45 ]
%arrayidx = getelementptr inbounds [31 x i32], ptr %buf, i64 0, i64 %indvars.iv
%6 = trunc i64 %indvars.iv to i32
store i32 %6, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%7 = load i32, ptr %m, align 4, !tbaa !5
%cmp336 = icmp sgt i32 %7, 0
br i1 %cmp336, label %for.body4, label %for.cond17.preheader
for.cond17.preheader: ; preds = %for.body4, %for.end
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp18.not38 = icmp slt i32 %8, 1
br i1 %cmp18.not38, label %for.end25, label %for.body19
for.body4: ; preds = %for.end, %for.body4
%i.137 = phi i32 [ %inc15, %for.body4 ], [ 0, %for.end ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%9 = load i32, ptr %a, align 4, !tbaa !5
%idxprom6 = sext i32 %9 to i64
%arrayidx7 = getelementptr inbounds [31 x i32], ptr %buf, i64 0, i64 %idxprom6
%10 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%11 = load i32, ptr %b, align 4, !tbaa !5
%idxprom8 = sext i32 %11 to i64
%arrayidx9 = getelementptr inbounds [31 x i32], ptr %buf, i64 0, i64 %idxprom8
%12 = load i32, ptr %arrayidx9, align 4, !tbaa !5
store i32 %12, ptr %arrayidx7, align 4, !tbaa !5
store i32 %10, ptr %arrayidx9, align 4, !tbaa !5
%inc15 = add nuw nsw i32 %i.137, 1
%13 = load i32, ptr %m, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc15, %13
br i1 %cmp3, label %for.body4, label %for.cond17.preheader, !llvm.loop !14
for.body19: ; preds = %for.cond17.preheader, %for.body19
%indvars.iv41 = phi i64 [ %indvars.iv.next42, %for.body19 ], [ 1, %for.cond17.preheader ]
%arrayidx21 = getelementptr inbounds [31 x i32], ptr %buf, i64 0, i64 %indvars.iv41
%14 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%15 = load i32, ptr %n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp18.not.not = icmp slt i64 %indvars.iv41, %16
br i1 %cmp18.not.not, label %for.body19, label %for.end25, !llvm.loop !15
for.end25: ; preds = %for.body19, %for.cond17.preheader
call void @llvm.lifetime.end.p0(i64 124, ptr nonnull %buf) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
int main()
{
int tate[150]={0},a,yoko,b1,b2,i,x;
scanf("%d",&a);
for(i=1;i<=a;i++)tate[i]=i;
scanf("%d",&yoko);
for(i=0;i<yoko;i++)
{
scanf("%d,%d",&b1,&b2);
x=tate[b1];
tate[b1]=tate[b2];
tate[b2]=x;
b1=0;b2=0;x=0;
}
for(i=1;i<100;i++)
{
if(tate[i]!=0)printf("%d\n",tate[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189551/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189551/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d,%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%tate = alloca [150 x i32], align 16
%a = alloca i32, align 4
%yoko = alloca i32, align 4
%b1 = alloca i32, align 4
%b2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 600, ptr nonnull %tate) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(600) %tate, i8 0, i64 600, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %yoko) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp.not38 = icmp slt i32 %0, 1
br i1 %cmp.not38, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = add nuw i32 %0, 1
%wide.trip.count = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader49, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %2, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%offset.idx = or i64 %index, 1
%3 = getelementptr inbounds [150 x i32], ptr %tate, i64 0, i64 %offset.idx
store <4 x i32> %vec.ind, ptr %3, align 4, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> %step.add, ptr %4, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %2, %n.vec
br i1 %cmp.n, label %for.end, label %for.body.preheader49
for.body.preheader49: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader49, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader49 ]
%arrayidx = getelementptr inbounds [150 x i32], ptr %tate, i64 0, i64 %indvars.iv
%6 = trunc i64 %indvars.iv to i32
store i32 %6, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %yoko)
%7 = load i32, ptr %yoko, align 4, !tbaa !5
%cmp340 = icmp sgt i32 %7, 0
br i1 %cmp340, label %for.body4, label %for.body19.preheader
for.body4: ; preds = %for.end, %for.body4
%i.141 = phi i32 [ %inc15, %for.body4 ], [ 0, %for.end ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b1, ptr noundef nonnull %b2)
%8 = load i32, ptr %b1, align 4, !tbaa !5
%idxprom6 = sext i32 %8 to i64
%arrayidx7 = getelementptr inbounds [150 x i32], ptr %tate, i64 0, i64 %idxprom6
%9 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%10 = load i32, ptr %b2, align 4, !tbaa !5
%idxprom8 = sext i32 %10 to i64
%arrayidx9 = getelementptr inbounds [150 x i32], ptr %tate, i64 0, i64 %idxprom8
%11 = load i32, ptr %arrayidx9, align 4, !tbaa !5
store i32 %11, ptr %arrayidx7, align 4, !tbaa !5
store i32 %9, ptr %arrayidx9, align 4, !tbaa !5
store i32 0, ptr %b1, align 4, !tbaa !5
store i32 0, ptr %b2, align 4, !tbaa !5
%inc15 = add nuw nsw i32 %i.141, 1
%12 = load i32, ptr %yoko, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc15, %12
br i1 %cmp3, label %for.body4, label %for.body19.preheader, !llvm.loop !14
for.body19.preheader: ; preds = %for.body4, %for.end
br label %for.body19
for.body19: ; preds = %for.body19.preheader, %for.inc26
%indvars.iv44 = phi i64 [ %indvars.iv.next45, %for.inc26 ], [ 1, %for.body19.preheader ]
%arrayidx21 = getelementptr inbounds [150 x i32], ptr %tate, i64 0, i64 %indvars.iv44
%13 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22.not = icmp eq i32 %13, 0
br i1 %cmp22.not, label %for.inc26, label %if.then
if.then: ; preds = %for.body19
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13)
br label %for.inc26
for.inc26: ; preds = %for.body19, %if.then
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%exitcond47.not = icmp eq i64 %indvars.iv.next45, 100
br i1 %exitcond47.not, label %for.end28, label %for.body19, !llvm.loop !15
for.end28: ; preds = %for.inc26
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b1) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %yoko) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 600, ptr nonnull %tate) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#define MAX_REG 30
int main()
{
int w, n;
int i;
int ver[MAX_REG] = {};
scanf("%d", &w);
scanf("%d", &n);
for(i = 0; i < w; i++)
ver[i] = i + 1;
for(i = 0; i < n; i++)
{
int sw1, sw2;
int tmp;
scanf("%d,%d", &sw1, &sw2);
tmp = ver[sw1 - 1];
ver[sw1 - 1] = ver[sw2 - 1];
ver[sw2 - 1] = tmp;
}
for(i = 0; i < w; i++)
printf("%d\n", ver[i]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189601/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189601/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d,%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%w = alloca i32, align 4
%n = alloca i32, align 4
%ver = alloca [30 x i32], align 16
%sw1 = alloca i32, align 4
%sw2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %ver) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(120) %ver, i8 0, i64 120, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %w, align 4, !tbaa !5
%cmp37 = icmp sgt i32 %0, 0
br i1 %cmp37, label %for.body.preheader, label %for.cond2.preheader
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader48, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%1 = getelementptr inbounds [30 x i32], ptr %ver, i64 0, i64 %index
%2 = trunc <4 x i64> %vec.ind to <4 x i32>
%3 = add <4 x i32> %2, <i32 1, i32 1, i32 1, i32 1>
%4 = trunc <4 x i64> %vec.ind to <4 x i32>
%5 = add <4 x i32> %4, <i32 5, i32 5, i32 5, i32 5>
store <4 x i32> %3, ptr %1, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> %5, ptr %6, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond2.preheader, label %for.body.preheader48
for.body.preheader48: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond2.preheader: ; preds = %for.body, %middle.block, %entry
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp339 = icmp sgt i32 %8, 0
br i1 %cmp339, label %for.body4, label %for.cond20.preheader
for.body: ; preds = %for.body.preheader48, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader48 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [30 x i32], ptr %ver, i64 0, i64 %indvars.iv
%9 = trunc i64 %indvars.iv.next to i32
store i32 %9, ptr %arrayidx, align 4, !tbaa !5
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond2.preheader, label %for.body, !llvm.loop !13
for.cond20.preheader.loopexit: ; preds = %for.body4
%.pre = load i32, ptr %w, align 4, !tbaa !5
br label %for.cond20.preheader
for.cond20.preheader: ; preds = %for.cond20.preheader.loopexit, %for.cond2.preheader
%10 = phi i32 [ %.pre, %for.cond20.preheader.loopexit ], [ %0, %for.cond2.preheader ]
%cmp2141 = icmp sgt i32 %10, 0
br i1 %cmp2141, label %for.body22, label %for.end28
for.body4: ; preds = %for.cond2.preheader, %for.body4
%i.140 = phi i32 [ %inc18, %for.body4 ], [ 0, %for.cond2.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sw1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sw2) #4
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %sw1, ptr noundef nonnull %sw2)
%11 = load i32, ptr %sw1, align 4, !tbaa !5
%sub = add nsw i32 %11, -1
%idxprom6 = sext i32 %sub to i64
%arrayidx7 = getelementptr inbounds [30 x i32], ptr %ver, i64 0, i64 %idxprom6
%12 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%13 = load i32, ptr %sw2, align 4, !tbaa !5
%sub8 = add nsw i32 %13, -1
%idxprom9 = sext i32 %sub8 to i64
%arrayidx10 = getelementptr inbounds [30 x i32], ptr %ver, i64 0, i64 %idxprom9
%14 = load i32, ptr %arrayidx10, align 4, !tbaa !5
store i32 %14, ptr %arrayidx7, align 4, !tbaa !5
store i32 %12, ptr %arrayidx10, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sw2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sw1) #4
%inc18 = add nuw nsw i32 %i.140, 1
%15 = load i32, ptr %n, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc18, %15
br i1 %cmp3, label %for.body4, label %for.cond20.preheader.loopexit, !llvm.loop !14
for.body22: ; preds = %for.cond20.preheader, %for.body22
%indvars.iv44 = phi i64 [ %indvars.iv.next45, %for.body22 ], [ 0, %for.cond20.preheader ]
%arrayidx24 = getelementptr inbounds [30 x i32], ptr %ver, i64 0, i64 %indvars.iv44
%16 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%17 = load i32, ptr %w, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp21 = icmp slt i64 %indvars.iv.next45, %18
br i1 %cmp21, label %for.body22, label %for.end28, !llvm.loop !15
for.end28: ; preds = %for.body22, %for.cond20.preheader
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %ver) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
// AOJ0011
#include<stdio.h>
#include<stdlib.h>
int main(){
int w, n;
int *L;
int **A;
int p;
int i;
scanf("%d", &w);
scanf("%d", &n);
L = (int *)malloc(w*sizeof(int));
for(i = 0; i < w; i++){
L[i] = i+1;
}
A = (int**)malloc(n*sizeof(int *));
for(i = 0; i < n; i++){
A[i] = (int*)malloc(2*sizeof(int));
scanf("%d,%d", &A[i][0], &A[i][1]);
p = L[A[i][0]-1];
L[A[i][0]-1] = L[A[i][1]-1];
L[A[i][1]-1] = p;
}
for(i = 0; i < w; i++){
printf("%d\n", L[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189645/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189645/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d,%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%w = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %w, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call2 = call noalias ptr @malloc(i64 noundef %mul) #5
%cmp83 = icmp sgt i32 %0, 0
br i1 %cmp83, label %for.body.preheader, label %for.cond7.preheader
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader94, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%1 = getelementptr inbounds i32, ptr %call2, i64 %index
%2 = trunc <4 x i64> %vec.ind to <4 x i32>
%3 = add <4 x i32> %2, <i32 1, i32 1, i32 1, i32 1>
%4 = trunc <4 x i64> %vec.ind to <4 x i32>
%5 = add <4 x i32> %4, <i32 5, i32 5, i32 5, i32 5>
store <4 x i32> %3, ptr %1, align 4, !tbaa !5
%6 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> %5, ptr %6, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond7.preheader, label %for.body.preheader94
for.body.preheader94: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond7.preheader: ; preds = %for.body, %middle.block, %entry
%8 = load i32, ptr %n, align 4, !tbaa !5
%cmp885 = icmp sgt i32 %8, 0
br i1 %cmp885, label %for.body10, label %for.cond47.preheader
for.body: ; preds = %for.body.preheader94, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader94 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds i32, ptr %call2, i64 %indvars.iv
%9 = trunc i64 %indvars.iv.next to i32
store i32 %9, ptr %arrayidx, align 4, !tbaa !5
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond7.preheader, label %for.body, !llvm.loop !13
for.cond47.preheader.loopexit: ; preds = %for.body10
%.pre = load i32, ptr %w, align 4, !tbaa !5
br label %for.cond47.preheader
for.cond47.preheader: ; preds = %for.cond47.preheader.loopexit, %for.cond7.preheader
%10 = phi i32 [ %.pre, %for.cond47.preheader.loopexit ], [ %0, %for.cond7.preheader ]
%cmp4887 = icmp sgt i32 %10, 0
br i1 %cmp4887, label %for.body50, label %for.end56
for.body10: ; preds = %for.cond7.preheader, %for.body10
%i.186 = phi i32 [ %inc45, %for.body10 ], [ 0, %for.cond7.preheader ]
%call11 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #5
%arrayidx19 = getelementptr inbounds i32, ptr %call11, i64 1
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %call11, ptr noundef nonnull %arrayidx19)
%11 = load i32, ptr %call11, align 4, !tbaa !5
%sub = add nsw i32 %11, -1
%idxprom24 = sext i32 %sub to i64
%arrayidx25 = getelementptr inbounds i32, ptr %call2, i64 %idxprom24
%12 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%13 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%sub29 = add nsw i32 %13, -1
%idxprom30 = sext i32 %sub29 to i64
%arrayidx31 = getelementptr inbounds i32, ptr %call2, i64 %idxprom30
%14 = load i32, ptr %arrayidx31, align 4, !tbaa !5
store i32 %14, ptr %arrayidx25, align 4, !tbaa !5
store i32 %12, ptr %arrayidx31, align 4, !tbaa !5
%inc45 = add nuw nsw i32 %i.186, 1
%15 = load i32, ptr %n, align 4, !tbaa !5
%cmp8 = icmp slt i32 %inc45, %15
br i1 %cmp8, label %for.body10, label %for.cond47.preheader.loopexit, !llvm.loop !14
for.body50: ; preds = %for.cond47.preheader, %for.body50
%indvars.iv90 = phi i64 [ %indvars.iv.next91, %for.body50 ], [ 0, %for.cond47.preheader ]
%arrayidx52 = getelementptr inbounds i32, ptr %call2, i64 %indvars.iv90
%16 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%call53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16)
%indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
%17 = load i32, ptr %w, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp48 = icmp slt i64 %indvars.iv.next91, %18
br i1 %cmp48, label %for.body50, label %for.end56, !llvm.loop !15
for.end56: ; preds = %for.body50, %for.cond47.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int max(int a, int b);
int main(void)
{
int w, h, n, i, j, cost = 0;
int sx, sy, gx, gy;
scanf("%d %d %d", &w, &h, &n);
scanf("%d %d", &sx, &sy);
for (i = 1; i < n; i++){
scanf("%d %d", &gx, &gy);
if (sx < gx && sy < gy){
if (gx - sx < gy - sy){
cost += gx - sx;
sy += gx - sx;
sx = gx;
}
else{
cost += gy - sy;;
sx += gy - sy;
sy = gy;
}
}
else if (sx > gx && sy > gy){
if (sx - gx < sy - gy){
cost += sx - gx;
sy -= sx - gx;
sx = gx;
}
else{
cost += sy - gy;;
sx -= sy - gy;
sy = gy;
}
}
cost += max(sx - gx, gx - sx);
cost += max(sy - gy, gy - sy);
sx = gx;sy = gy;
}
printf("%d\n", cost);
return (0);
}
int max(int a, int b)
{
if (a > b) return (a);
else return (b);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189696/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189696/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [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:
%w = alloca i32, align 4
%h = alloca i32, align 4
%n = alloca i32, align 4
%sx = alloca i32, align 4
%sy = alloca i32, align 4
%gx = alloca i32, align 4
%gy = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sx) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sy) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %gx) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %gy) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %h, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %sx, ptr noundef nonnull %sy)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp60 = icmp sgt i32 %0, 1
br i1 %cmp60, label %for.body, label %for.end
for.body: ; preds = %entry, %if.end35
%cost.062 = phi i32 [ %add43, %if.end35 ], [ 0, %entry ]
%i.061 = phi i32 [ %inc, %if.end35 ], [ 1, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %gx, ptr noundef nonnull %gy)
%1 = load i32, ptr %sx, align 4, !tbaa !5
%2 = load i32, ptr %gx, align 4, !tbaa !5
%cmp3 = icmp slt i32 %1, %2
%.pre.pre = load i32, ptr %sy, align 4, !tbaa !5
%.pre63.pre = load i32, ptr %gy, align 4, !tbaa !5
%cmp4 = icmp slt i32 %.pre.pre, %.pre63.pre
%or.cond = select i1 %cmp3, i1 %cmp4, i1 false
br i1 %or.cond, label %if.then, label %if.else15
if.then: ; preds = %for.body
%sub = sub nsw i32 %2, %1
%sub5 = sub nsw i32 %.pre63.pre, %.pre.pre
%cmp6 = icmp slt i32 %sub, %sub5
br i1 %cmp6, label %if.then7, label %if.else
if.then7: ; preds = %if.then
%add = add nsw i32 %sub, %cost.062
%add10 = add nsw i32 %.pre.pre, %sub
br label %if.end35
if.else: ; preds = %if.then
%add12 = add nsw i32 %sub5, %cost.062
%add14 = add nsw i32 %sub5, %1
br label %if.end35
if.else15: ; preds = %for.body
%cmp16 = icmp sgt i32 %1, %2
%cmp18 = icmp sgt i32 %.pre.pre, %.pre63.pre
%or.cond64 = select i1 %cmp16, i1 %cmp18, i1 false
br i1 %or.cond64, label %if.then19, label %if.end35
if.then19: ; preds = %if.else15
%sub20 = sub nsw i32 %1, %2
%sub21 = sub nsw i32 %.pre.pre, %.pre63.pre
%cmp22 = icmp slt i32 %sub20, %sub21
br i1 %cmp22, label %if.then23, label %if.else28
if.then23: ; preds = %if.then19
%add25 = add nsw i32 %sub20, %cost.062
%sub27 = sub nsw i32 %.pre.pre, %sub20
br label %if.end35
if.else28: ; preds = %if.then19
%add30 = add nsw i32 %sub21, %cost.062
%sub32 = sub nsw i32 %1, %sub21
br label %if.end35
if.end35: ; preds = %if.else15, %if.else28, %if.then23, %if.then7, %if.else
%3 = phi i32 [ %add10, %if.then7 ], [ %.pre63.pre, %if.else ], [ %sub27, %if.then23 ], [ %.pre63.pre, %if.else28 ], [ %.pre.pre, %if.else15 ]
%4 = phi i32 [ %2, %if.then7 ], [ %add14, %if.else ], [ %2, %if.then23 ], [ %sub32, %if.else28 ], [ %1, %if.else15 ]
%cost.1 = phi i32 [ %add, %if.then7 ], [ %add12, %if.else ], [ %add25, %if.then23 ], [ %add30, %if.else28 ], [ %cost.062, %if.else15 ]
%sub36 = sub nsw i32 %4, %2
%a.b.i = call i32 @llvm.abs.i32(i32 %sub36, i1 true)
%add39 = add nsw i32 %a.b.i, %cost.1
%sub40 = sub nsw i32 %3, %.pre63.pre
%a.b.i59 = call i32 @llvm.abs.i32(i32 %sub40, i1 true)
%add43 = add nsw i32 %add39, %a.b.i59
store i32 %2, ptr %sx, align 4, !tbaa !5
store i32 %.pre63.pre, ptr %sy, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.061, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %if.end35, %entry
%cost.0.lcssa = phi i32 [ 0, %entry ], [ %add43, %if.end35 ]
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cost.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %gy) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %gx) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sy) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sx) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #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) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; 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 nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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 K;
scanf("%d",&K);
int N = (K+1)/2;
if(N%2 == 1){
N++;
}
if(K == 1){
printf("1\n1\n");
return 0;
}
int data[N][N];
for(int r = 0;r<N;r++){
for(int c = 0;c<N;c++){
if(r%2 == 0){
data[r][c] = (r-c+N)%N;
}else{
data[r][c] = N+(r-c+N)%N;
}
if(data[r][c]>=K){
data[r][c] -= N;
}
}
}
printf("%d\n",N);
for(int r = 0;r<N;r++){
for(int c = 0;c<N;c++){
printf("%d",data[r][c]+1);
if(c != N-1){
printf(" ");
}
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189746/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189746/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [4 x i8] c"1\0A1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %K)
%0 = load i32, ptr %K, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%div = sdiv i32 %add, 2
%1 = and i32 %div, -2147483647
%cmp = icmp eq i32 %1, 1
%inc = zext i1 %cmp to i32
%spec.select = add nsw i32 %div, %inc
%cmp1 = icmp eq i32 %0, 1
br i1 %cmp1, label %if.then2, label %if.end4
if.then2: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
if.end4: ; preds = %entry
%2 = zext i32 %spec.select to i64
%3 = call ptr @llvm.stacksave.p0()
%4 = mul nuw i64 %2, %2
%vla = alloca i32, i64 %4, align 16
%cmp5111 = icmp sgt i32 %spec.select, 0
br i1 %cmp5111, label %for.cond6.preheader.lr.ph, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %if.end4
%call42156 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %spec.select)
br label %for.cond.cleanup46
for.cond6.preheader.lr.ph: ; preds = %if.end4
%5 = load i32, ptr %K, align 4
%6 = add nsw i64 %2, -1
%xtraiter = and i64 %2, 1
%7 = icmp eq i64 %6, 0
%unroll_iter = and i64 %2, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
%xtraiter162 = and i64 %2, 1
%8 = icmp eq i64 %6, 0
%unroll_iter164 = and i64 %2, 4294967294
%lcmp.mod163.not = icmp eq i64 %xtraiter162, 0
br label %for.cond6.preheader.us
for.cond6.preheader.us: ; preds = %for.cond6.for.cond.cleanup8_crit_edge.us, %for.cond6.preheader.lr.ph
%indvars.iv140 = phi i64 [ %indvars.iv.next141, %for.cond6.for.cond.cleanup8_crit_edge.us ], [ 0, %for.cond6.preheader.lr.ph ]
%9 = trunc i64 %indvars.iv140 to i32
%rem10.us = and i32 %9, 1
%cmp11.us = icmp eq i32 %rem10.us, 0
%sub17.us = add i32 %spec.select, %9
%10 = mul nuw nsw i64 %indvars.iv140, %2
%arrayidx22.us = getelementptr inbounds i32, ptr %vla, i64 %10
br i1 %cmp11.us, label %for.body9.us.us.preheader, label %for.body9.us113.preheader
for.body9.us113.preheader: ; preds = %for.cond6.preheader.us
br i1 %7, label %for.cond6.for.cond.cleanup8_crit_edge.us.loopexit161.unr-lcssa, label %for.body9.us113
for.body9.us.us.preheader: ; preds = %for.cond6.preheader.us
br i1 %8, label %for.cond6.for.cond.cleanup8_crit_edge.us.loopexit.unr-lcssa, label %for.body9.us.us
for.body9.us113: ; preds = %for.body9.us113.preheader, %for.body9.us113
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.body9.us113 ], [ 0, %for.body9.us113.preheader ]
%c.0.neg110.us114 = phi i32 [ %c.0.neg.us123.1, %for.body9.us113 ], [ 0, %for.body9.us113.preheader ]
%niter = phi i64 [ %niter.next.1, %for.body9.us113 ], [ 0, %for.body9.us113.preheader ]
%indvars133 = trunc i64 %indvars.iv to i32
%add18.us = add nsw i32 %sub17.us, %c.0.neg110.us114
%rem19.us = srem i32 %add18.us, %spec.select
%add20.us = add nsw i32 %rem19.us, %spec.select
%arrayidx24.us = getelementptr inbounds i32, ptr %arrayidx22.us, i64 %indvars.iv
%cmp30.not.us118 = icmp slt i32 %add20.us, %5
%spec.select158 = select i1 %cmp30.not.us118, i32 %add20.us, i32 %rem19.us
store i32 %spec.select158, ptr %arrayidx24.us, align 4, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%c.0.neg.us123 = xor i32 %indvars133, -1
%indvars133.1 = trunc i64 %indvars.iv.next to i32
%add18.us.1 = add nsw i32 %sub17.us, %c.0.neg.us123
%rem19.us.1 = srem i32 %add18.us.1, %spec.select
%add20.us.1 = add nsw i32 %rem19.us.1, %spec.select
%arrayidx24.us.1 = getelementptr inbounds i32, ptr %arrayidx22.us, i64 %indvars.iv.next
%cmp30.not.us118.1 = icmp slt i32 %add20.us.1, %5
%spec.select158.1 = select i1 %cmp30.not.us118.1, i32 %add20.us.1, i32 %rem19.us.1
store i32 %spec.select158.1, ptr %arrayidx24.us.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%c.0.neg.us123.1 = xor i32 %indvars133.1, -1
%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.cond6.for.cond.cleanup8_crit_edge.us.loopexit161.unr-lcssa, label %for.body9.us113, !llvm.loop !9
for.cond6.for.cond.cleanup8_crit_edge.us.loopexit.unr-lcssa: ; preds = %for.body9.us.us, %for.body9.us.us.preheader
%indvars.iv134.unr = phi i64 [ 0, %for.body9.us.us.preheader ], [ %indvars.iv.next135.1, %for.body9.us.us ]
%c.0.neg110.us.us.unr = phi i32 [ 0, %for.body9.us.us.preheader ], [ %c.0.neg.us.us.1, %for.body9.us.us ]
br i1 %lcmp.mod163.not, label %for.cond6.for.cond.cleanup8_crit_edge.us, label %for.body9.us.us.epil
for.body9.us.us.epil: ; preds = %for.cond6.for.cond.cleanup8_crit_edge.us.loopexit.unr-lcssa
%add13.us.us.epil = add nsw i32 %sub17.us, %c.0.neg110.us.us.unr
%rem14.us.us.epil = srem i32 %add13.us.us.epil, %spec.select
%arrayidx16.us.us.epil = getelementptr inbounds i32, ptr %arrayidx22.us, i64 %indvars.iv134.unr
%cmp30.not.us.us.epil = icmp slt i32 %rem14.us.us.epil, %5
%sub36.us.us.epil = select i1 %cmp30.not.us.us.epil, i32 0, i32 %spec.select
%spec.select159.epil = sub nsw i32 %rem14.us.us.epil, %sub36.us.us.epil
store i32 %spec.select159.epil, ptr %arrayidx16.us.us.epil, align 4, !tbaa !5
br label %for.cond6.for.cond.cleanup8_crit_edge.us
for.cond6.for.cond.cleanup8_crit_edge.us.loopexit161.unr-lcssa: ; preds = %for.body9.us113, %for.body9.us113.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body9.us113.preheader ], [ %indvars.iv.next.1, %for.body9.us113 ]
%c.0.neg110.us114.unr = phi i32 [ 0, %for.body9.us113.preheader ], [ %c.0.neg.us123.1, %for.body9.us113 ]
br i1 %lcmp.mod.not, label %for.cond6.for.cond.cleanup8_crit_edge.us, label %for.body9.us113.epil
for.body9.us113.epil: ; preds = %for.cond6.for.cond.cleanup8_crit_edge.us.loopexit161.unr-lcssa
%add18.us.epil = add nsw i32 %sub17.us, %c.0.neg110.us114.unr
%rem19.us.epil = srem i32 %add18.us.epil, %spec.select
%add20.us.epil = add nsw i32 %rem19.us.epil, %spec.select
%arrayidx24.us.epil = getelementptr inbounds i32, ptr %arrayidx22.us, i64 %indvars.iv.unr
%cmp30.not.us118.epil = icmp slt i32 %add20.us.epil, %5
%spec.select158.epil = select i1 %cmp30.not.us118.epil, i32 %add20.us.epil, i32 %rem19.us.epil
store i32 %spec.select158.epil, ptr %arrayidx24.us.epil, align 4, !tbaa !5
br label %for.cond6.for.cond.cleanup8_crit_edge.us
for.cond6.for.cond.cleanup8_crit_edge.us: ; preds = %for.body9.us113.epil, %for.cond6.for.cond.cleanup8_crit_edge.us.loopexit161.unr-lcssa, %for.body9.us.us.epil, %for.cond6.for.cond.cleanup8_crit_edge.us.loopexit.unr-lcssa
%indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1
%exitcond144.not = icmp eq i64 %indvars.iv.next141, %2
br i1 %exitcond144.not, label %for.cond.cleanup, label %for.cond6.preheader.us, !llvm.loop !11
for.body9.us.us: ; preds = %for.body9.us.us.preheader, %for.body9.us.us
%indvars.iv134 = phi i64 [ %indvars.iv.next135.1, %for.body9.us.us ], [ 0, %for.body9.us.us.preheader ]
%c.0.neg110.us.us = phi i32 [ %c.0.neg.us.us.1, %for.body9.us.us ], [ 0, %for.body9.us.us.preheader ]
%niter165 = phi i64 [ %niter165.next.1, %for.body9.us.us ], [ 0, %for.body9.us.us.preheader ]
%indvars137 = trunc i64 %indvars.iv134 to i32
%add13.us.us = add nsw i32 %sub17.us, %c.0.neg110.us.us
%rem14.us.us = srem i32 %add13.us.us, %spec.select
%arrayidx16.us.us = getelementptr inbounds i32, ptr %arrayidx22.us, i64 %indvars.iv134
%cmp30.not.us.us = icmp slt i32 %rem14.us.us, %5
%sub36.us.us = select i1 %cmp30.not.us.us, i32 0, i32 %spec.select
%spec.select159 = sub nsw i32 %rem14.us.us, %sub36.us.us
store i32 %spec.select159, ptr %arrayidx16.us.us, align 4, !tbaa !5
%indvars.iv.next135 = or i64 %indvars.iv134, 1
%c.0.neg.us.us = xor i32 %indvars137, -1
%indvars137.1 = trunc i64 %indvars.iv.next135 to i32
%add13.us.us.1 = add nsw i32 %sub17.us, %c.0.neg.us.us
%rem14.us.us.1 = srem i32 %add13.us.us.1, %spec.select
%arrayidx16.us.us.1 = getelementptr inbounds i32, ptr %arrayidx22.us, i64 %indvars.iv.next135
%cmp30.not.us.us.1 = icmp slt i32 %rem14.us.us.1, %5
%sub36.us.us.1 = select i1 %cmp30.not.us.us.1, i32 0, i32 %spec.select
%spec.select159.1 = sub nsw i32 %rem14.us.us.1, %sub36.us.us.1
store i32 %spec.select159.1, ptr %arrayidx16.us.us.1, align 4, !tbaa !5
%indvars.iv.next135.1 = add nuw nsw i64 %indvars.iv134, 2
%c.0.neg.us.us.1 = xor i32 %indvars137.1, -1
%niter165.next.1 = add i64 %niter165, 2
%niter165.ncmp.1 = icmp eq i64 %niter165.next.1, %unroll_iter164
br i1 %niter165.ncmp.1, label %for.cond6.for.cond.cleanup8_crit_edge.us.loopexit.unr-lcssa, label %for.body9.us.us, !llvm.loop !9
for.cond.cleanup: ; preds = %for.cond6.for.cond.cleanup8_crit_edge.us
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %spec.select)
br i1 %cmp5111, label %for.cond49.preheader.lr.ph, label %for.cond.cleanup46
for.cond49.preheader.lr.ph: ; preds = %for.cond.cleanup
%sub59 = add nsw i32 %spec.select, -1
%11 = zext i32 %sub59 to i64
br label %for.cond49.preheader.us
for.cond49.preheader.us: ; preds = %for.cond49.for.cond.cleanup51_crit_edge.us, %for.cond49.preheader.lr.ph
%indvars.iv150 = phi i64 [ %indvars.iv.next151, %for.cond49.for.cond.cleanup51_crit_edge.us ], [ 0, %for.cond49.preheader.lr.ph ]
%12 = mul nuw nsw i64 %indvars.iv150, %2
%arrayidx54.us = getelementptr inbounds i32, ptr %vla, i64 %12
br label %for.body52.us
for.body52.us: ; preds = %for.cond49.preheader.us, %for.inc64.us
%indvars.iv145 = phi i64 [ 0, %for.cond49.preheader.us ], [ %indvars.iv.next146, %for.inc64.us ]
%arrayidx56.us = getelementptr inbounds i32, ptr %arrayidx54.us, i64 %indvars.iv145
%13 = load i32, ptr %arrayidx56.us, align 4, !tbaa !5
%add57.us = add nsw i32 %13, 1
%call58.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add57.us)
%cmp60.not.us = icmp eq i64 %indvars.iv145, %11
br i1 %cmp60.not.us, label %for.inc64.us, label %if.then61.us
if.then61.us: ; preds = %for.body52.us
%putchar107.us = call i32 @putchar(i32 32)
br label %for.inc64.us
for.inc64.us: ; preds = %if.then61.us, %for.body52.us
%indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
%exitcond149.not = icmp eq i64 %indvars.iv.next146, %2
br i1 %exitcond149.not, label %for.cond49.for.cond.cleanup51_crit_edge.us, label %for.body52.us, !llvm.loop !12
for.cond49.for.cond.cleanup51_crit_edge.us: ; preds = %for.inc64.us
%putchar.us = call i32 @putchar(i32 10)
%indvars.iv.next151 = add nuw nsw i64 %indvars.iv150, 1
%exitcond154.not = icmp eq i64 %indvars.iv.next151, %2
br i1 %exitcond154.not, label %for.cond.cleanup46, label %for.cond49.preheader.us, !llvm.loop !13
for.cond.cleanup46: ; preds = %for.cond49.for.cond.cleanup51_crit_edge.us, %for.cond.cleanup.thread, %for.cond.cleanup
call void @llvm.stackrestore.p0(ptr %3)
br label %cleanup
cleanup: ; preds = %for.cond.cleanup46, %if.then2
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #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
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; 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 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}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#define MOD 1000000007
int fastPowSca(long long x, long long n) {
long long prod = 1;
while (n) {
if (n & 1) {
prod *= x;
prod %= MOD;
}
x *= x;
x %= MOD;
n >>= 1;
}
return prod;
}
int main(void) {
int m, n;
scanf("%d %d", &m, &n);
printf("%d\n", fastPowSca(m, n));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189797/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189797/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @fastPowSca(i64 noundef %x, i64 noundef %n) local_unnamed_addr #0 {
entry:
%tobool.not11 = icmp eq i64 %n, 0
br i1 %tobool.not11, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%prod.014 = phi i64 [ %prod.1, %if.end ], [ 1, %entry ]
%n.addr.013 = phi i64 [ %shr, %if.end ], [ %n, %entry ]
%x.addr.012 = phi i64 [ %rem3, %if.end ], [ %x, %entry ]
%and = and i64 %n.addr.013, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul nsw i64 %prod.014, %x.addr.012
%rem = srem i64 %mul, 1000000007
br label %if.end
if.end: ; preds = %if.then, %while.body
%prod.1 = phi i64 [ %rem, %if.then ], [ %prod.014, %while.body ]
%mul2 = mul nsw i64 %x.addr.012, %x.addr.012
%rem3 = urem i64 %mul2, 1000000007
%shr = ashr i64 %n.addr.013, 1
%tobool.not = icmp ult i64 %n.addr.013, 2
br i1 %tobool.not, label %while.end.loopexit, label %while.body, !llvm.loop !5
while.end.loopexit: ; preds = %if.end
%0 = trunc i64 %prod.1 to i32
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%prod.0.lcssa = phi i32 [ 1, %entry ], [ %0, %while.end.loopexit ]
ret i32 %prod.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:
%m = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #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 %m, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%tobool.not11.i = icmp eq i32 %0, 0
br i1 %tobool.not11.i, label %fastPowSca.exit, label %while.body.i.preheader
while.body.i.preheader: ; preds = %entry
%conv1 = sext i32 %0 to i64
%1 = load i32, ptr %m, align 4, !tbaa !7
%conv = sext i32 %1 to i64
br label %while.body.i
while.body.i: ; preds = %while.body.i.preheader, %if.end.i
%prod.014.i = phi i64 [ %prod.1.i, %if.end.i ], [ 1, %while.body.i.preheader ]
%n.addr.013.i = phi i64 [ %shr.i, %if.end.i ], [ %conv1, %while.body.i.preheader ]
%x.addr.012.i = phi i64 [ %rem3.i, %if.end.i ], [ %conv, %while.body.i.preheader ]
%and.i = and i64 %n.addr.013.i, 1
%tobool1.not.i = icmp eq i64 %and.i, 0
br i1 %tobool1.not.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %while.body.i
%mul.i = mul nsw i64 %x.addr.012.i, %prod.014.i
%rem.i = srem i64 %mul.i, 1000000007
br label %if.end.i
if.end.i: ; preds = %if.then.i, %while.body.i
%prod.1.i = phi i64 [ %rem.i, %if.then.i ], [ %prod.014.i, %while.body.i ]
%mul2.i = mul nsw i64 %x.addr.012.i, %x.addr.012.i
%rem3.i = urem i64 %mul2.i, 1000000007
%shr.i = ashr i64 %n.addr.013.i, 1
%tobool.not.i = icmp ult i64 %n.addr.013.i, 2
br i1 %tobool.not.i, label %while.end.loopexit.i, label %while.body.i, !llvm.loop !5
while.end.loopexit.i: ; preds = %if.end.i
%2 = trunc i64 %prod.1.i to i32
br label %fastPowSca.exit
fastPowSca.exit: ; preds = %entry, %while.end.loopexit.i
%prod.0.lcssa.i = phi i32 [ 1, %entry ], [ %2, %while.end.loopexit.i ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %prod.0.lcssa.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = 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"}
|
#include <stdio.h>
int main(void){
long m,n;
scanf("%ld %ld",&m,&n);
long y=1;
while(n>0){
if(n % 2 != 0){
y=(y*m) % 1000000007;
}
m=(m*m) % 1000000007;
n=n/2;
}
printf("%ld\n",y);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189847/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189847/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i64, align 8
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m, ptr noundef nonnull %n)
%.pr = load i64, ptr %n, align 8, !tbaa !5
%cmp10 = icmp sgt i64 %.pr, 0
br i1 %cmp10, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %entry
%m.promoted = load i64, ptr %m, align 8, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.preheader, %if.end
%y.012 = phi i64 [ %y.1, %if.end ], [ 1, %while.body.preheader ]
%0 = phi i64 [ %div78, %if.end ], [ %.pr, %while.body.preheader ]
%rem4911 = phi i64 [ %rem4, %if.end ], [ %m.promoted, %while.body.preheader ]
%rem = and i64 %0, 1
%cmp1.not = icmp eq i64 %rem, 0
br i1 %cmp1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul nsw i64 %rem4911, %y.012
%rem2 = srem i64 %mul, 1000000007
br label %if.end
if.end: ; preds = %if.then, %while.body
%y.1 = phi i64 [ %rem2, %if.then ], [ %y.012, %while.body ]
%mul3 = mul nsw i64 %rem4911, %rem4911
%rem4 = urem i64 %mul3, 1000000007
%div78 = lshr i64 %0, 1
%cmp.not = icmp ult i64 %0, 2
br i1 %cmp.not, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %if.end
store i64 %rem4, ptr %m, align 8, !tbaa !5
store i64 %div78, ptr %n, align 8, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%y.0.lcssa = phi i64 [ %y.1, %while.cond.while.end_crit_edge ], [ 1, %entry ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %y.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #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<stdlib.h>
#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MOD 1000000007
int main(void){
int N;
scanf("%d",&N);
//前3文字だけで文字列を決定する
//dp[i]は、長さi文字の文字列の数
long dp[N+1][64];
//初期値
for(int i=0;i<64;i++) dp[3][i]=1;
dp[3][6] = 0; //AGC
dp[3][9] = 0; //ACG
dp[3][18] = 0; //GAC
//dpの中を埋める
for(int i=4;i<=N;i++){
for(int j=0;j<64;j++){
dp[i][j]=0;
if(j==6 || j==9 ||j==18) continue; //末尾がAGC,ACG,GACになるものはdp=0のまま
//dp[i][j]にどんなdp[i-1][k]を足せばいいのか
for(int k=0;k<64;k++){
if( j%4==2 && k%16==1 ) continue; //*AG(k%16=1)にCを足そうとする(j%4=2)のはだめ
if( j%4==1 && k%16==2 ) continue; //*AC(k%16=2)にGを足そうとする(j%4=1)のはだめ
if (j%4==2 && k%16==4) continue; //*GAにCを足そうとするのはだめ
if (j%4==2 && k>>2==1) continue; //AG*にCを足そうとするのはだめ
if (j%4==2 && k>>4==0 && k%4==1)continue; // A*B + C
//上記以外で、kの末尾2文字とjの頭2文字が一致しているなら、足す
if((j>>2)==(k%16)) dp[i][j]=(dp[i][j]+dp[i-1][k])%MOD;
}
}
}
long ans=0;
for(int i=0;i<64;i++) ans=(ans+dp[N][i])%MOD;
printf("%ld\n",ans);
return 0;
}
/*
0 AAA 4 AGA 8 ACA 12 ATA
1 AAG 5 AGG 9 ACG 13 ATG
2 AAC 6 AGC 10 ACC 14 ATC
3 AAT 7 AGT 11 ACT 15 ATT
頭文字G +16
頭文字C +32
頭文字T +48
*/ | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189904/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189904/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%1 = zext i32 %add to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca [64 x i64], i64 %1, align 16
%arrayidx1 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 0
store i64 1, ptr %arrayidx1, align 16, !tbaa !9
%arrayidx1.1 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 1
store i64 1, ptr %arrayidx1.1, align 8, !tbaa !9
%arrayidx1.2 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 2
store i64 1, ptr %arrayidx1.2, align 16, !tbaa !9
%arrayidx1.3 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 3
store i64 1, ptr %arrayidx1.3, align 8, !tbaa !9
%arrayidx1.4 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 4
store i64 1, ptr %arrayidx1.4, align 16, !tbaa !9
%arrayidx1.5 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 5
store i64 1, ptr %arrayidx1.5, align 8, !tbaa !9
%arrayidx1.6 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 6
%arrayidx1.7 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 7
store i64 1, ptr %arrayidx1.7, align 8, !tbaa !9
%arrayidx1.8 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 8
store i64 1, ptr %arrayidx1.8, align 16, !tbaa !9
%arrayidx1.9 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 9
%arrayidx1.10 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 10
store i64 1, ptr %arrayidx1.10, align 16, !tbaa !9
%arrayidx1.11 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 11
store i64 1, ptr %arrayidx1.11, align 8, !tbaa !9
%arrayidx1.12 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 12
store i64 1, ptr %arrayidx1.12, align 16, !tbaa !9
%arrayidx1.13 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 13
store i64 1, ptr %arrayidx1.13, align 8, !tbaa !9
%arrayidx1.14 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 14
store i64 1, ptr %arrayidx1.14, align 16, !tbaa !9
%arrayidx1.15 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 15
store i64 1, ptr %arrayidx1.15, align 8, !tbaa !9
%arrayidx1.16 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 16
store i64 1, ptr %arrayidx1.16, align 16, !tbaa !9
%arrayidx1.17 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 17
store i64 1, ptr %arrayidx1.17, align 8, !tbaa !9
%arrayidx1.18 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 18
%arrayidx1.19 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 19
store i64 1, ptr %arrayidx1.19, align 8, !tbaa !9
%arrayidx1.20 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 20
store i64 1, ptr %arrayidx1.20, align 16, !tbaa !9
%arrayidx1.21 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 21
store i64 1, ptr %arrayidx1.21, align 8, !tbaa !9
%arrayidx1.22 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 22
store i64 1, ptr %arrayidx1.22, align 16, !tbaa !9
%arrayidx1.23 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 23
store i64 1, ptr %arrayidx1.23, align 8, !tbaa !9
%arrayidx1.24 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 24
store i64 1, ptr %arrayidx1.24, align 16, !tbaa !9
%arrayidx1.25 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 25
store i64 1, ptr %arrayidx1.25, align 8, !tbaa !9
%arrayidx1.26 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 26
store i64 1, ptr %arrayidx1.26, align 16, !tbaa !9
%arrayidx1.27 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 27
store i64 1, ptr %arrayidx1.27, align 8, !tbaa !9
%arrayidx1.28 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 28
store i64 1, ptr %arrayidx1.28, align 16, !tbaa !9
%arrayidx1.29 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 29
store i64 1, ptr %arrayidx1.29, align 8, !tbaa !9
%arrayidx1.30 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 30
store i64 1, ptr %arrayidx1.30, align 16, !tbaa !9
%arrayidx1.31 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 31
store i64 1, ptr %arrayidx1.31, align 8, !tbaa !9
%arrayidx1.32 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 32
store i64 1, ptr %arrayidx1.32, align 16, !tbaa !9
%arrayidx1.33 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 33
store i64 1, ptr %arrayidx1.33, align 8, !tbaa !9
%arrayidx1.34 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 34
store i64 1, ptr %arrayidx1.34, align 16, !tbaa !9
%arrayidx1.35 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 35
store i64 1, ptr %arrayidx1.35, align 8, !tbaa !9
%arrayidx1.36 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 36
store i64 1, ptr %arrayidx1.36, align 16, !tbaa !9
%arrayidx1.37 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 37
store i64 1, ptr %arrayidx1.37, align 8, !tbaa !9
%arrayidx1.38 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 38
store i64 1, ptr %arrayidx1.38, align 16, !tbaa !9
%arrayidx1.39 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 39
store i64 1, ptr %arrayidx1.39, align 8, !tbaa !9
%arrayidx1.40 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 40
store i64 1, ptr %arrayidx1.40, align 16, !tbaa !9
%arrayidx1.41 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 41
store i64 1, ptr %arrayidx1.41, align 8, !tbaa !9
%arrayidx1.42 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 42
store i64 1, ptr %arrayidx1.42, align 16, !tbaa !9
%arrayidx1.43 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 43
store i64 1, ptr %arrayidx1.43, align 8, !tbaa !9
%arrayidx1.44 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 44
store i64 1, ptr %arrayidx1.44, align 16, !tbaa !9
%arrayidx1.45 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 45
store i64 1, ptr %arrayidx1.45, align 8, !tbaa !9
%arrayidx1.46 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 46
store i64 1, ptr %arrayidx1.46, align 16, !tbaa !9
%arrayidx1.47 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 47
store i64 1, ptr %arrayidx1.47, align 8, !tbaa !9
%arrayidx1.48 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 48
store i64 1, ptr %arrayidx1.48, align 16, !tbaa !9
%arrayidx1.49 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 49
store i64 1, ptr %arrayidx1.49, align 8, !tbaa !9
%arrayidx1.50 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 50
store i64 1, ptr %arrayidx1.50, align 16, !tbaa !9
%arrayidx1.51 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 51
store i64 1, ptr %arrayidx1.51, align 8, !tbaa !9
%arrayidx1.52 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 52
store i64 1, ptr %arrayidx1.52, align 16, !tbaa !9
%arrayidx1.53 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 53
store i64 1, ptr %arrayidx1.53, align 8, !tbaa !9
%arrayidx1.54 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 54
store i64 1, ptr %arrayidx1.54, align 16, !tbaa !9
%arrayidx1.55 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 55
store i64 1, ptr %arrayidx1.55, align 8, !tbaa !9
%arrayidx1.56 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 56
store i64 1, ptr %arrayidx1.56, align 16, !tbaa !9
%arrayidx1.57 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 57
store i64 1, ptr %arrayidx1.57, align 8, !tbaa !9
%arrayidx1.58 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 58
store i64 1, ptr %arrayidx1.58, align 16, !tbaa !9
%arrayidx1.59 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 59
store i64 1, ptr %arrayidx1.59, align 8, !tbaa !9
%arrayidx1.60 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 60
store i64 1, ptr %arrayidx1.60, align 16, !tbaa !9
%arrayidx1.61 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 61
store i64 1, ptr %arrayidx1.61, align 8, !tbaa !9
%arrayidx1.62 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 62
store i64 1, ptr %arrayidx1.62, align 16, !tbaa !9
%arrayidx1.63 = getelementptr inbounds [64 x i64], ptr %vla, i64 3, i64 63
store i64 1, ptr %arrayidx1.63, align 8, !tbaa !9
store i64 0, ptr %arrayidx1.6, align 16, !tbaa !9
store i64 0, ptr %arrayidx1.9, align 8, !tbaa !9
store i64 0, ptr %arrayidx1.18, align 16, !tbaa !9
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp10.not150 = icmp slt i32 %3, 4
br i1 %cmp10.not150, label %for.cond93.preheader, label %for.cond13.preheader.preheader
for.cond13.preheader.preheader: ; preds = %entry
%4 = add nuw i32 %3, 1
%wide.trip.count = zext i32 %4 to i64
br label %for.cond13.preheader
for.cond13.preheader: ; preds = %for.cond13.preheader.preheader, %for.cond.cleanup15
%indvars.iv171 = phi i64 [ 4, %for.cond13.preheader.preheader ], [ %indvars.iv.next172, %for.cond.cleanup15 ]
%5 = add nsw i64 %indvars.iv171, -1
br label %for.body16
for.cond93.preheader: ; preds = %for.cond.cleanup15, %entry
%idxprom97 = sext i32 %3 to i64
br label %for.body96
for.cond.cleanup15: ; preds = %for.inc86
%indvars.iv.next172 = add nuw nsw i64 %indvars.iv171, 1
%exitcond175.not = icmp eq i64 %indvars.iv.next172, %wide.trip.count
br i1 %exitcond175.not, label %for.cond93.preheader, label %for.cond13.preheader, !llvm.loop !11
for.body16: ; preds = %for.cond13.preheader, %for.inc86
%indvars.iv167 = phi i64 [ 0, %for.cond13.preheader ], [ %indvars.iv.next168, %for.inc86 ]
%arrayidx20 = getelementptr inbounds [64 x i64], ptr %vla, i64 %indvars.iv171, i64 %indvars.iv167
store i64 0, ptr %arrayidx20, align 8, !tbaa !9
%6 = trunc i64 %indvars.iv167 to i32
switch i32 %6, label %for.cond25.preheader [
i32 18, label %for.inc86
i32 9, label %for.inc86
i32 6, label %for.inc86
]
for.cond25.preheader: ; preds = %for.body16
%rem = and i32 %6, 3
%cmp29 = icmp eq i32 %rem, 2
%cmp35 = icmp eq i32 %rem, 1
%shr64 = lshr i32 %6, 2
br i1 %cmp29, label %for.body28, label %for.cond25.preheader.split.us
for.cond25.preheader.split.us: ; preds = %for.cond25.preheader
br i1 %cmp35, label %for.body28.us, label %for.body28.us.us
for.body28.us.us: ; preds = %for.cond25.preheader.split.us, %for.inc83.us.us
%7 = phi i64 [ %10, %for.inc83.us.us ], [ 0, %for.cond25.preheader.split.us ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc83.us.us ], [ 0, %for.cond25.preheader.split.us ]
%8 = trunc i64 %indvars.iv to i32
%rem30.us.us = and i32 %8, 15
%cmp66.us.us.not = icmp eq i32 %shr64, %rem30.us.us
br i1 %cmp66.us.us.not, label %if.then67.us.us, label %for.inc83.us.us
if.then67.us.us: ; preds = %for.body28.us.us
%arrayidx75.us.us = getelementptr inbounds [64 x i64], ptr %vla, i64 %5, i64 %indvars.iv
%9 = load i64, ptr %arrayidx75.us.us, align 8, !tbaa !9
%add76.us.us = add nsw i64 %9, %7
%rem77.us.us = srem i64 %add76.us.us, 1000000007
store i64 %rem77.us.us, ptr %arrayidx20, align 8, !tbaa !9
br label %for.inc83.us.us
for.inc83.us.us: ; preds = %if.then67.us.us, %for.body28.us.us
%10 = phi i64 [ %rem77.us.us, %if.then67.us.us ], [ %7, %for.body28.us.us ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 64
br i1 %exitcond.not, label %for.inc86, label %for.body28.us.us, !llvm.loop !13
for.body28.us: ; preds = %for.cond25.preheader.split.us, %for.inc83.us
%11 = phi i64 [ %14, %for.inc83.us ], [ 0, %for.cond25.preheader.split.us ]
%indvars.iv159 = phi i64 [ %indvars.iv.next160, %for.inc83.us ], [ 0, %for.cond25.preheader.split.us ]
%12 = trunc i64 %indvars.iv159 to i32
%rem30.us = and i32 %12, 15
%cmp38.us = icmp eq i32 %rem30.us, 2
%cmp66.us = icmp ne i32 %shr64, %rem30.us
%or.cond = or i1 %cmp38.us, %cmp66.us
br i1 %or.cond, label %for.inc83.us, label %if.then67.us
if.then67.us: ; preds = %for.body28.us
%arrayidx75.us = getelementptr inbounds [64 x i64], ptr %vla, i64 %5, i64 %indvars.iv159
%13 = load i64, ptr %arrayidx75.us, align 8, !tbaa !9
%add76.us = add nsw i64 %13, %11
%rem77.us = srem i64 %add76.us, 1000000007
store i64 %rem77.us, ptr %arrayidx20, align 8, !tbaa !9
br label %for.inc83.us
for.inc83.us: ; preds = %if.then67.us, %for.body28.us
%14 = phi i64 [ %rem77.us, %if.then67.us ], [ %11, %for.body28.us ]
%indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
%exitcond162.not = icmp eq i64 %indvars.iv.next160, 64
br i1 %exitcond162.not, label %for.inc86, label %for.body28.us, !llvm.loop !13
for.body28: ; preds = %for.cond25.preheader, %for.inc83
%15 = phi i64 [ %20, %for.inc83 ], [ 0, %for.cond25.preheader ]
%indvars.iv163 = phi i64 [ %indvars.iv.next164, %for.inc83 ], [ 0, %for.cond25.preheader ]
%16 = trunc i64 %indvars.iv163 to i32
%rem30 = and i32 %16, 15
%cmp31 = icmp eq i32 %rem30, 1
br i1 %cmp31, label %for.inc83, label %if.end33
if.end33: ; preds = %for.body28
%cmp38 = icmp eq i32 %rem30, 2
%or.cond140 = and i1 %cmp35, %cmp38
%cmp45 = icmp eq i32 %rem30, 4
%or.cond145 = or i1 %or.cond140, %cmp45
%shr.mask = and i32 %16, 2147483644
%cmp51 = icmp eq i32 %shr.mask, 4
%or.cond154 = or i1 %or.cond145, %cmp51
br i1 %or.cond154, label %for.inc83, label %if.end53
if.end53: ; preds = %if.end33
%17 = and i32 %16, 2147483635
%18 = icmp eq i32 %17, 1
%cmp66 = icmp ne i32 %shr64, %rem30
%or.cond146.not = or i1 %cmp66, %18
br i1 %or.cond146.not, label %for.inc83, label %if.then67
if.then67: ; preds = %if.end53
%arrayidx75 = getelementptr inbounds [64 x i64], ptr %vla, i64 %5, i64 %indvars.iv163
%19 = load i64, ptr %arrayidx75, align 8, !tbaa !9
%add76 = add nsw i64 %19, %15
%rem77 = srem i64 %add76, 1000000007
store i64 %rem77, ptr %arrayidx20, align 8, !tbaa !9
br label %for.inc83
for.inc83: ; preds = %if.end53, %if.end33, %for.body28, %if.then67
%20 = phi i64 [ %15, %if.end53 ], [ %15, %if.end33 ], [ %15, %for.body28 ], [ %rem77, %if.then67 ]
%indvars.iv.next164 = add nuw nsw i64 %indvars.iv163, 1
%exitcond166.not = icmp eq i64 %indvars.iv.next164, 64
br i1 %exitcond166.not, label %for.inc86, label %for.body28, !llvm.loop !13
for.inc86: ; preds = %for.inc83.us.us, %for.inc83.us, %for.inc83, %for.body16, %for.body16, %for.body16
%indvars.iv.next168 = add nuw nsw i64 %indvars.iv167, 1
%exitcond170.not = icmp eq i64 %indvars.iv.next168, 64
br i1 %exitcond170.not, label %for.cond.cleanup15, label %for.body16, !llvm.loop !14
for.cond.cleanup95: ; preds = %for.body96
%call106 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %rem102.1)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
for.body96: ; preds = %for.body96, %for.cond93.preheader
%indvars.iv176 = phi i64 [ 0, %for.cond93.preheader ], [ %indvars.iv.next177.1, %for.body96 ]
%ans.0152 = phi i64 [ 0, %for.cond93.preheader ], [ %rem102.1, %for.body96 ]
%arrayidx100 = getelementptr inbounds [64 x i64], ptr %vla, i64 %idxprom97, i64 %indvars.iv176
%21 = load i64, ptr %arrayidx100, align 16, !tbaa !9
%add101 = add nsw i64 %21, %ans.0152
%rem102 = srem i64 %add101, 1000000007
%indvars.iv.next177 = or i64 %indvars.iv176, 1
%arrayidx100.1 = getelementptr inbounds [64 x i64], ptr %vla, i64 %idxprom97, i64 %indvars.iv.next177
%22 = load i64, ptr %arrayidx100.1, align 8, !tbaa !9
%add101.1 = add nsw i64 %22, %rem102
%rem102.1 = srem i64 %add101.1, 1000000007
%indvars.iv.next177.1 = add nuw nsw i64 %indvars.iv176, 2
%exitcond179.not.1 = icmp eq i64 %indvars.iv.next177.1, 64
br i1 %exitcond179.not.1, label %for.cond.cleanup95, label %for.body96, !llvm.loop !15
}
; 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 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
|
//set many funcs template
//Ver.20180717
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}
int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}
void shuffledget(int x[],int n){
srand(time(0));
int i,b[524288],p,c;
for(i=0;i<n;i++){
b[i]=i;
}
for(i=n;i>=1;i--){
p=rand()%i;
c=b[i-1];b[i-1]=b[p];b[p]=c;
}
for(i=0;i<n;i++){
scanf("%d",&x[b[i]]);
}
}
int dx4[4]={1,-1,0,0};
int dy4[4]={0,0,1,-1};
int dx8[8]={-1,-1,-1,0,0,1,1,1};
int dy8[8]={-1,0,1,-1,1,-1,0,1};
int search(int x,int a[],int n){
int st=0,fi=n-1,te;
while(st<=fi){
te=(st+fi)/2;
if(a[te]<x){st=te+1;}else{fi=te-1;}
}
return st;
}
typedef struct{
int val;
int node;
}sd;
int sdsortfnc(const void *a,const void *b){
if(((sd*)a)->val < ((sd*)b)->val){return -1;}
if(((sd*)a)->val > ((sd*)b)->val){return 1;}
return 0;
}
int main(void){
int i,j,n,m,k,a[524288],b[524288],c,h,w,r=inf,l,t,q;
int arr[524288],vallista[524288];
double d;
char s[524288];
scanf("%d%d%d",&n,&k,&q);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
b[i]=a[i];
}
qsort(b,n,sizeof(int),sortfncsj);
for(i=0;i<n;i++){
c=0;l=0;
for(j=0;j<=n;j++){
if(a[j]<b[i] || j==n){t=0;
for(h=l;h<j;h++){
arr[t]=a[h];
t++;
}
qsort(arr,t,sizeof(int),sortfncsj);
for(h=0;h<t-k+1;h++){
vallista[c]=arr[h];
c++;
}
l=j+1;
}
}
qsort(vallista,c,sizeof(int),sortfncsj);
if(c<q){continue;}
r=min(r,vallista[q-1]-vallista[0]);
}
printf("%d\n",r);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189948/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189948/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@dx4 = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 -1, i32 0, i32 0], align 16
@dy4 = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 0, i32 1, i32 -1], align 16
@dx8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 -1, i32 -1, i32 0, i32 0, i32 1, i32 1, i32 1], align 16
@dy8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 0, i32 1, i32 -1, i32 1, i32 -1, i32 0, i32 1], align 16
@.str.1 = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @zt(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i32 %a, %b
%sub = tail call i32 @llvm.abs.i32(i32 %sub5, i1 true)
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @round(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%mul = shl nsw i32 %rem, 1
%cmp.not = icmp sge i32 %mul, %b
%div1 = sdiv i32 %a, %b
%add = zext i1 %cmp.not to i32
%retval.0 = add nsw i32 %div1, %add
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @ceil(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%cmp = icmp ne i32 %rem, 0
%div = sdiv i32 %a, %b
%add = zext i1 %cmp to i32
%retval.0 = add nsw i32 %div, %add
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i32 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i32 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i32 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i32 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i32 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i32 %a.addr.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i32 %b, 0
br i1 %cmp.not4.i, label %gcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i32 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i32 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i32 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !5
gcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i32 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i32 %a, %a.addr.0.lcssa.i
%mul = mul nsw i32 %div, %b
ret i32 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nCr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i32 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i32 %a, 1
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i32 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i32 %add, %i.07
%mul = mul nsw i32 %r.08, %sub
%div = sdiv i32 %mul, %i.07
%inc = add nuw i32 %i.07, 1
%sub.1 = sub i32 %add, %inc
%mul.1 = mul nsw i32 %div, %sub.1
%div.1 = sdiv i32 %mul.1, %inc
%inc.1 = add nuw i32 %i.07, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !7
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i32 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i32 %add, %i.07.unr
%mul.epil = mul nsw i32 %r.08.unr, %sub.epil
%div.epil = sdiv i32 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nHr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i32 %b, %a
%cmp.not6.i = icmp slt i32 %b, 1
br i1 %cmp.not6.i, label %nCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i32 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i32 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i32 %add, %i.07.i
%mul.i = mul nsw i32 %sub.i, %r.08.i
%div.i = sdiv i32 %mul.i, %i.07.i
%inc.i = add nuw i32 %i.07.i, 1
%sub.i.1 = sub i32 %add, %inc.i
%mul.i.1 = mul nsw i32 %sub.i.1, %div.i
%div.i.1 = sdiv i32 %mul.i.1, %inc.i
%inc.i.1 = add nuw i32 %i.07.i, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !7
nCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %nCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %nCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i32 %add, %i.07.i.unr
%mul.i.epil = mul nsw i32 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i32 %mul.i.epil, %i.07.i.unr
br label %nCr.exit
nCr.exit: ; preds = %for.body.i.epil, %nCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i32 [ 1, %entry ], [ %div.i.lcssa.ph, %nCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i32 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @fact(i32 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i32 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %a, 8
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %a, -8
%ind.end = or i32 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi7 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = mul <4 x i32> %vec.phi, %vec.ind
%1 = mul <4 x i32> %vec.phi7, %step.add
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %a
br i1 %cmp.n, label %for.end, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%r.06.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.05.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader9, %for.body
%r.06 = phi i32 [ %mul, %for.body ], [ %r.06.ph, %for.body.preheader9 ]
%i.05 = phi i32 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader9 ]
%mul = mul nsw i32 %r.06, %i.05
%inc = add nuw i32 %i.05, 1
%exitcond.not = icmp eq i32 %i.05, %a
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @pow(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i32 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %b, 8
br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %b, -8
%ind.end = or i32 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi6 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%0 = mul <4 x i32> %vec.phi, %broadcast.splat
%1 = mul <4 x i32> %vec.phi6, %broadcast.splat
%index.next = add nuw i32 %index, 8
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %b
br i1 %cmp.n, label %for.end, label %for.body.preheader7
for.body.preheader7: ; preds = %for.body.preheader, %middle.block
%r.05.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.04.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader7, %for.body
%r.05 = phi i32 [ %mul, %for.body ], [ %r.05.ph, %for.body.preheader7 ]
%i.04 = phi i32 [ %inc, %for.body ], [ %i.04.ph, %for.body.preheader7 ]
%mul = mul nsw i32 %r.05, %a
%inc = add nuw i32 %i.04, 1
%exitcond.not = icmp eq i32 %i.04, %b
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsum(i32 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i32 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.05, 10
%add = add nsw i32 %r.06, %rem
%div = sdiv i32 %x.addr.05, 10
%x.addr.05.off = add i32 %x.addr.05, 9
%tobool.not = icmp ult i32 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsumb(i32 noundef %x, i32 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i32 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.06, %b
%add = add nsw i32 %rem, %r.07
%div = sdiv i32 %x.addr.06, %b
%tobool.not = icmp eq i32 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @sankaku(i32 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i32 %x, 1
%mul = mul nsw i32 %add, %x
%div = sdiv i32 %mul, 2
ret i32 %div
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmax(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmin(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llzt(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i64 %a, %b
%sub = tail call i64 @llvm.abs.i64(i64 %sub5, i1 true)
ret i64 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llround(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%mul = shl nsw i64 %rem, 1
%cmp.not = icmp sge i64 %mul, %b
%div1 = sdiv i64 %a, %b
%add = zext i1 %cmp.not to i64
%retval.0 = add nsw i64 %div1, %add
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llceil(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%cmp = icmp ne i64 %rem, 0
%div = sdiv i64 %a, %b
%add = zext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %add
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llgcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i64 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i64 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i64 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i64 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i64 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i64 %a.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lllcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i64 %b, 0
br i1 %cmp.not4.i, label %llgcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i64 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i64 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i64 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i64 %rem.i, 0
br i1 %cmp.not.i, label %llgcd.exit, label %while.body.i, !llvm.loop !16
llgcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i64 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i64 %a, %a.addr.0.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnCr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i64 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i64 %a, 1
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i64 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i64 %add, %i.07
%mul = mul nsw i64 %r.08, %sub
%div = sdiv i64 %mul, %i.07
%inc = add nuw i64 %i.07, 1
%sub.1 = sub i64 %add, %inc
%mul.1 = mul nsw i64 %div, %sub.1
%div.1 = sdiv i64 %mul.1, %inc
%inc.1 = add nuw i64 %i.07, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !17
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i64 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i64 %add, %i.07.unr
%mul.epil = mul nsw i64 %r.08.unr, %sub.epil
%div.epil = sdiv i64 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnHr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i64 %b, %a
%cmp.not6.i = icmp slt i64 %b, 1
br i1 %cmp.not6.i, label %llnCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i64 %add, %i.07.i
%mul.i = mul nsw i64 %sub.i, %r.08.i
%div.i = sdiv i64 %mul.i, %i.07.i
%inc.i = add nuw i64 %i.07.i, 1
%sub.i.1 = sub i64 %add, %inc.i
%mul.i.1 = mul nsw i64 %sub.i.1, %div.i
%div.i.1 = sdiv i64 %mul.i.1, %inc.i
%inc.i.1 = add nuw i64 %i.07.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 %llnCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !17
llnCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %llnCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %llnCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i64 %add, %i.07.i.unr
%mul.i.epil = mul nsw i64 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i64 %mul.i.epil, %i.07.i.unr
br label %llnCr.exit
llnCr.exit: ; preds = %for.body.i.epil, %llnCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i64 [ 1, %entry ], [ %div.i.lcssa.ph, %llnCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i64 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llfact(i64 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i64 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %a, 7
%0 = icmp ult i64 %a, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %a, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.06 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%i.05 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.06, %i.05
%inc = add nuw nsw i64 %i.05, 1
%mul.1 = mul nsw i64 %mul, %inc
%inc.1 = add nuw nsw i64 %i.05, 2
%mul.2 = mul nsw i64 %mul.1, %inc.1
%inc.2 = add nuw nsw i64 %i.05, 3
%mul.3 = mul nsw i64 %mul.2, %inc.2
%inc.3 = add nuw nsw i64 %i.05, 4
%mul.4 = mul nsw i64 %mul.3, %inc.3
%inc.4 = add nuw nsw i64 %i.05, 5
%mul.5 = mul nsw i64 %mul.4, %inc.4
%inc.5 = add nuw nsw i64 %i.05, 6
%mul.6 = mul nsw i64 %mul.5, %inc.5
%inc.6 = add nuw i64 %i.05, 7
%mul.7 = mul nsw i64 %mul.6, %inc.6
%inc.7 = add nuw i64 %i.05, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !18
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.06.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%i.05.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.06.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.06.unr, %for.end.loopexit.unr-lcssa ]
%i.05.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.06.epil, %i.05.epil
%inc.epil = add nuw i64 %i.05.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 !19
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llpow(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i64 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.05 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.05, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !21
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.05.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.05.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.05.epil, %a
%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 !22
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsum(i64 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i64 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.05, 10
%add = add nsw i64 %r.06, %rem
%div = sdiv i64 %x.addr.05, 10
%x.addr.05.off = add i64 %x.addr.05, 9
%tobool.not = icmp ult i64 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !23
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsumb(i64 noundef %x, i64 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i64 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.06, %b
%add = add nsw i64 %rem, %r.07
%div = sdiv i64 %x.addr.06, %b
%tobool.not = icmp eq i64 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !24
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llsankaku(i64 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i64 %x, 1
%mul = mul nsw i64 %add, %x
%div = sdiv i64 %mul, 2
ret i64 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmax(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp ogt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmin(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp olt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbzt(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp.i = fcmp ogt double %a, %b
%a.b.i = select i1 %cmp.i, double %a, double %b
%cmp.i4 = fcmp olt double %a, %b
%a.b.i5 = select i1 %cmp.i4, double %a, double %b
%sub = fsub double %a.b.i, %a.b.i5
ret double %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !25
%1 = load i32, ptr %b, align 4, !tbaa !25
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !25
%1 = load i32, ptr %b, align 4, !tbaa !25
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp ogt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #15
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #15
ret i32 %call
}
; Function Attrs: nounwind uwtable
define dso_local void @shuffledget(ptr noundef %x, i32 noundef %n) local_unnamed_addr #7 {
entry:
%b = alloca [524288 x i32], align 16
%call = tail call i64 @time(ptr noundef null) #16
%conv = trunc i64 %call to i32
tail call void @srand(i32 noundef %conv) #16
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b) #16
%cmp44 = icmp sgt i32 %n, 0
br i1 %cmp44, label %for.body.preheader, label %for.end29
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader61, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %index
store <4 x i32> %vec.ind, ptr %0, align 16, !tbaa !25
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 16, !tbaa !25
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !33
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond2.preheader, label %for.body.preheader61
for.body.preheader61: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond2.preheader: ; preds = %for.body, %middle.block
br i1 %cmp44, label %for.body5.preheader, label %for.end29
for.body5.preheader: ; preds = %for.cond2.preheader
%3 = zext i32 %n to i64
br label %for.body5
for.body: ; preds = %for.body.preheader61, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader61 ]
%arrayidx = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %arrayidx, align 4, !tbaa !25
%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.cond2.preheader, label %for.body, !llvm.loop !34
for.cond18.preheader: ; preds = %for.body5
br i1 %cmp44, label %for.body21.preheader, label %for.end29
for.body21.preheader: ; preds = %for.cond18.preheader
%wide.trip.count58 = zext i32 %n to i64
br label %for.body21
for.body5: ; preds = %for.body5.preheader, %for.body5
%indvars.iv51 = phi i64 [ %3, %for.body5.preheader ], [ %indvars.iv.next52, %for.body5 ]
%call6 = tail call i32 @rand() #16
%5 = trunc i64 %indvars.iv51 to i32
%rem = srem i32 %call6, %5
%indvars.iv.next52 = add nsw i64 %indvars.iv51, -1
%idxprom7 = and i64 %indvars.iv.next52, 4294967295
%arrayidx8 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom7
%6 = load i32, ptr %arrayidx8, align 4, !tbaa !25
%idxprom9 = sext i32 %rem to i64
%arrayidx10 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom9
%7 = load i32, ptr %arrayidx10, align 4, !tbaa !25
store i32 %7, ptr %arrayidx8, align 4, !tbaa !25
store i32 %6, ptr %arrayidx10, align 4, !tbaa !25
%cmp3 = icmp ugt i64 %indvars.iv51, 1
br i1 %cmp3, label %for.body5, label %for.cond18.preheader, !llvm.loop !35
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv54 = phi i64 [ 0, %for.body21.preheader ], [ %indvars.iv.next55, %for.body21 ]
%arrayidx23 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv54
%8 = load i32, ptr %arrayidx23, align 4, !tbaa !25
%idxprom24 = sext i32 %8 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %x, i64 %idxprom24
%call26 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx25)
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond59.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count58
br i1 %exitcond59.not, label %for.end29, label %for.body21, !llvm.loop !36
for.end29: ; preds = %for.body21, %entry, %for.cond2.preheader, %for.cond18.preheader
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b) #16
ret void
}
; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #8
; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #8
; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @search(i32 noundef %x, ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #10 {
entry:
%cmp.not9 = icmp slt i32 %n, 1
br i1 %cmp.not9, label %while.end, 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, %while.body
%st.011 = phi i32 [ %st.1, %while.body ], [ 0, %while.body.preheader ]
%fi.010 = phi i32 [ %fi.1, %while.body ], [ %sub, %while.body.preheader ]
%add = add nsw i32 %st.011, %fi.010
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !25
%cmp1 = icmp slt i32 %0, %x
%add2 = add nsw i32 %div, 1
%sub3 = add nsw i32 %div, -1
%fi.1 = select i1 %cmp1, i32 %fi.010, i32 %sub3
%st.1 = select i1 %cmp1, i32 %add2, i32 %st.011
%cmp.not = icmp sgt i32 %st.1, %fi.1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !37
while.end: ; preds = %while.body, %entry
%st.0.lcssa = phi i32 [ 0, %entry ], [ %st.1, %while.body ]
ret i32 %st.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sdsortfnc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !38
%1 = load i32, ptr %b, align 4, !tbaa !38
%cmp = icmp slt i32 %0, %1
%cmp4 = icmp sgt i32 %0, %1
%. = zext i1 %cmp4 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #11 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%a = alloca [524288 x i32], align 16
%b = alloca [524288 x i32], align 16
%q = alloca i32, align 4
%arr = alloca [524288 x i32], align 16
%vallista = alloca [524288 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #16
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %a) #16
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b) #16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #16
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %arr) #16
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %vallista) #16
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %k, ptr noundef nonnull %q)
%0 = load i32, ptr %n, align 4, !tbaa !25
%cmp94 = icmp sgt i32 %0, 0
br i1 %cmp94, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre139 = 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 [524288 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 !25
%arrayidx5 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv
store i32 %1, ptr %arrayidx5, align 4, !tbaa !25
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !25
%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 !40
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre139, %entry.for.end_crit_edge ], [ %3, %for.body ]
call void @qsort(ptr noundef nonnull %b, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @sortfncsj) #16
%4 = load i32, ptr %n, align 4, !tbaa !25
%cmp7109 = icmp sgt i32 %4, 0
br i1 %cmp7109, label %for.cond10.preheader, label %for.end66
for.cond10.preheader: ; preds = %for.end, %for.inc64
%5 = phi i32 [ %36, %for.inc64 ], [ %4, %for.end ]
%indvars.iv136 = phi i64 [ %indvars.iv.next137, %for.inc64 ], [ 0, %for.end ]
%r.0110 = phi i32 [ %r.1, %for.inc64 ], [ 1072114514, %for.end ]
%cmp11.not104 = icmp slt i32 %5, 0
br i1 %cmp11.not104, label %for.end51, label %for.body13.lr.ph
for.body13.lr.ph: ; preds = %for.cond10.preheader
%arrayidx17 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv136
br label %for.body13
for.body13: ; preds = %for.body13.lr.ph, %for.inc49
%6 = phi i32 [ %5, %for.body13.lr.ph ], [ %31, %for.inc49 ]
%indvars.iv132 = phi i64 [ 0, %for.body13.lr.ph ], [ %indvars.iv.next133.pre-phi, %for.inc49 ]
%l.0106 = phi i32 [ 0, %for.body13.lr.ph ], [ %l.1, %for.inc49 ]
%c.0105 = phi i32 [ 0, %for.body13.lr.ph ], [ %c.2, %for.inc49 ]
%arrayidx15 = getelementptr inbounds [524288 x i32], ptr %a, i64 0, i64 %indvars.iv132
%7 = load i32, ptr %arrayidx15, align 4, !tbaa !25
%8 = load i32, ptr %arrayidx17, align 4, !tbaa !25
%cmp18 = icmp slt i32 %7, %8
%9 = zext i32 %6 to i64
%cmp20 = icmp eq i64 %indvars.iv132, %9
%or.cond = or i1 %cmp20, %cmp18
br i1 %or.cond, label %for.cond22.preheader, label %for.body13.for.inc49_crit_edge
for.body13.for.inc49_crit_edge: ; preds = %for.body13
%.pre140 = add nuw nsw i64 %indvars.iv132, 1
br label %for.inc49
for.cond22.preheader: ; preds = %for.body13
%10 = sext i32 %l.0106 to i64
%cmp2396 = icmp sgt i64 %indvars.iv132, %10
br i1 %cmp2396, label %for.body25.preheader, label %for.end33
for.body25.preheader: ; preds = %for.cond22.preheader
%11 = shl nsw i64 %10, 2
%scevgep = getelementptr i8, ptr %a, i64 %11
%12 = trunc i64 %indvars.iv132 to i32
%13 = xor i32 %l.0106, -1
%14 = add i32 %13, %12
%15 = zext i32 %14 to i64
%16 = shl nuw nsw i64 %15, 2
%17 = add nuw nsw i64 %16, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %arr, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %17, i1 false), !tbaa !25
%18 = trunc i64 %indvars.iv132 to i32
%19 = sub i32 %18, %l.0106
br label %for.end33
for.end33: ; preds = %for.body25.preheader, %for.cond22.preheader
%t.0.lcssa = phi i32 [ 0, %for.cond22.preheader ], [ %19, %for.body25.preheader ]
%conv35 = zext i32 %t.0.lcssa to i64
call void @qsort(ptr noundef nonnull %arr, i64 noundef %conv35, i64 noundef 4, ptr noundef nonnull @sortfncsj) #16
%20 = load i32, ptr %k, align 4, !tbaa !25
%sub = sub nsw i32 %t.0.lcssa, %20
%cmp37.not100 = icmp slt i32 %sub, 0
br i1 %cmp37.not100, label %for.end47, label %for.body39.preheader
for.body39.preheader: ; preds = %for.end33
%21 = sext i32 %c.0105 to i64
%22 = shl nsw i64 %21, 2
%scevgep122 = getelementptr i8, ptr %vallista, i64 %22
%23 = add i32 %t.0.lcssa, 1
%24 = sub i32 %23, %20
%25 = zext i32 %24 to i64
%26 = shl nuw nsw i64 %25, 2
call void @llvm.memcpy.p0.p0.i64(ptr align 4 %scevgep122, ptr nonnull align 16 %arr, i64 %26, i1 false), !tbaa !25
%27 = add i32 %c.0105, 1
%28 = add i32 %27, %sub
br label %for.end47
for.end47: ; preds = %for.body39.preheader, %for.end33
%c.1.lcssa = phi i32 [ %c.0105, %for.end33 ], [ %28, %for.body39.preheader ]
%29 = add nuw nsw i64 %indvars.iv132, 1
%30 = trunc i64 %29 to i32
%.pre = load i32, ptr %n, align 4, !tbaa !25
br label %for.inc49
for.inc49: ; preds = %for.body13.for.inc49_crit_edge, %for.end47
%indvars.iv.next133.pre-phi = phi i64 [ %.pre140, %for.body13.for.inc49_crit_edge ], [ %29, %for.end47 ]
%31 = phi i32 [ %6, %for.body13.for.inc49_crit_edge ], [ %.pre, %for.end47 ]
%c.2 = phi i32 [ %c.0105, %for.body13.for.inc49_crit_edge ], [ %c.1.lcssa, %for.end47 ]
%l.1 = phi i32 [ %l.0106, %for.body13.for.inc49_crit_edge ], [ %30, %for.end47 ]
%32 = sext i32 %31 to i64
%cmp11.not.not = icmp slt i64 %indvars.iv132, %32
br i1 %cmp11.not.not, label %for.body13, label %for.end51, !llvm.loop !41
for.end51: ; preds = %for.inc49, %for.cond10.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond10.preheader ], [ %c.2, %for.inc49 ]
%conv53 = sext i32 %c.0.lcssa to i64
call void @qsort(ptr noundef nonnull %vallista, i64 noundef %conv53, i64 noundef 4, ptr noundef nonnull @sortfncsj) #16
%33 = load i32, ptr %q, align 4, !tbaa !25
%cmp54 = icmp slt i32 %c.0.lcssa, %33
br i1 %cmp54, label %for.inc64, label %if.end57
if.end57: ; preds = %for.end51
%sub58 = add nsw i32 %33, -1
%idxprom59 = sext i32 %sub58 to i64
%arrayidx60 = getelementptr inbounds [524288 x i32], ptr %vallista, i64 0, i64 %idxprom59
%34 = load i32, ptr %arrayidx60, align 4, !tbaa !25
%35 = load i32, ptr %vallista, align 16, !tbaa !25
%sub62 = sub nsw i32 %34, %35
%a.b.i = call i32 @llvm.smin.i32(i32 %r.0110, i32 %sub62)
br label %for.inc64
for.inc64: ; preds = %for.end51, %if.end57
%r.1 = phi i32 [ %r.0110, %for.end51 ], [ %a.b.i, %if.end57 ]
%indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
%36 = load i32, ptr %n, align 4, !tbaa !25
%37 = sext i32 %36 to i64
%cmp7 = icmp slt i64 %indvars.iv.next137, %37
br i1 %cmp7, label %for.cond10.preheader, label %for.end66, !llvm.loop !42
for.end66: ; preds = %for.inc64, %for.end
%r.0.lcssa = phi i32 [ 1072114514, %for.end ], [ %r.1, %for.inc64 ]
%call67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %r.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %vallista) #16
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %arr) #16
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #16
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b) #16
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %a) #16
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #16
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #16
ret i32 0
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #12
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #13
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #14
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #13
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(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 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { mustprogress nofree 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 #6 = { 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 #7 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { 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 #11 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #12 = { 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 #13 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #14 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #15 = { nounwind willreturn memory(read) }
attributes #16 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6, !9, !10}
!9 = !{!"llvm.loop.isvectorized", i32 1}
!10 = !{!"llvm.loop.unroll.runtime.disable"}
!11 = distinct !{!11, !6, !10, !9}
!12 = distinct !{!12, !6, !9, !10}
!13 = distinct !{!13, !6, !10, !9}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.unroll.disable"}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !20}
!23 = distinct !{!23, !6}
!24 = distinct !{!24, !6}
!25 = !{!26, !26, i64 0}
!26 = !{!"int", !27, i64 0}
!27 = !{!"omnipotent char", !28, i64 0}
!28 = !{!"Simple C/C++ TBAA"}
!29 = !{!30, !30, i64 0}
!30 = !{!"long long", !27, i64 0}
!31 = !{!32, !32, i64 0}
!32 = !{!"double", !27, i64 0}
!33 = distinct !{!33, !6, !9, !10}
!34 = distinct !{!34, !6, !10, !9}
!35 = distinct !{!35, !6}
!36 = distinct !{!36, !6}
!37 = distinct !{!37, !6}
!38 = !{!39, !26, i64 0}
!39 = !{!"", !26, i64 0, !26, i64 4}
!40 = distinct !{!40, !6}
!41 = distinct !{!41, !6}
!42 = distinct !{!42, !6}
|
#include <stdio.h>
int main(void)
{
int a,b,c;
scanf("%d %d",&a,&b);
c=a+b;
c=c/2;
printf("%d\n",c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_189999/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_189999/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%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
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%div = sdiv i32 %add, 2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int i, x, temp, min, max;
scanf("%d", &x);
scanf("%d", &min);
max = min;
for(i = 1; i < x; i++) {
scanf("%d", &temp);
if(temp < min) min = temp;
if(max < temp) max = temp;
}
printf("%d\n", (max - min + 1) - x);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_19004/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_19004/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%temp = alloca i32, align 4
%min = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %temp) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %min) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %min)
%0 = load i32, ptr %min, align 4, !tbaa !5
%1 = load i32, ptr %x, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %1, 1
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %if.end
%max.017 = phi i32 [ %spec.select, %if.end ], [ %0, %entry ]
%i.016 = phi i32 [ %inc, %if.end ], [ 1, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %temp)
%2 = load i32, ptr %temp, align 4, !tbaa !5
%3 = load i32, ptr %min, align 4, !tbaa !5
%cmp3 = icmp slt i32 %2, %3
br i1 %cmp3, label %if.then, label %if.end
if.then: ; preds = %for.body
store i32 %2, ptr %min, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %for.body
%4 = phi i32 [ %2, %if.then ], [ %3, %for.body ]
%spec.select = call i32 @llvm.smax.i32(i32 %max.017, i32 %2)
%inc = add nuw nsw i32 %i.016, 1
%5 = load i32, ptr %x, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %if.end, %entry
%6 = phi i32 [ %0, %entry ], [ %4, %if.end ]
%max.0.lcssa = phi i32 [ %0, %entry ], [ %spec.select, %if.end ]
%.lcssa = phi i32 [ %1, %entry ], [ %5, %if.end ]
%.neg14 = add i32 %max.0.lcssa, 1
%7 = add i32 %.lcssa, %6
%sub7 = sub i32 %.neg14, %7
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub7)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %min) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %temp) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#define PRIME_TABLE_SIZE 1000000
#define P_MAX 100
#define UNKNOWN -1
char is_prime[PRIME_TABLE_SIZE];
int next_prime[PRIME_TABLE_SIZE];
int comp_ints(const void* a, const void*b) { return *(int*)a - *(int*)b; }
void prime_table_init()
{
int i, j;
/* sieve */
is_prime[0] = is_prime[1] = 0;
for(i = 2; i < PRIME_TABLE_SIZE; i++)
is_prime[i] = 1;
i = 2;
while(i < PRIME_TABLE_SIZE)
{
for(j = i * 2; j < PRIME_TABLE_SIZE; j += i)
is_prime[j] = 0;
/* search for the next prime */
for(i++; !is_prime[i] && PRIME_TABLE_SIZE < i; i++);
}
for(i = UNKNOWN, j = PRIME_TABLE_SIZE - 1; j >= 0; j--)
{
next_prime[j] = i;
if(is_prime[j]) i = j;
}
}
int main(void)
{
int n, p, i, j, k, primes[P_MAX], sums[P_MAX * P_MAX];
prime_table_init();
while(scanf("%d %d", &n, &p), n != -1)
{
for(i = 0, j = next_prime[n]; i < p; i++, j = next_prime[j])
primes[i] = j;
for(i = k = 0; i < p; i++)
for(j = 0; j <= i; j++, k++)
sums[k] = primes[i] + primes[j];
qsort(sums, k, sizeof(int), comp_ints);
printf("%d\n", sums[p - 1]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_190083/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_190083/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@is_prime = dso_local local_unnamed_addr global [1000000 x i8] zeroinitializer, align 16
@next_prime = dso_local local_unnamed_addr global [1000000 x i32] zeroinitializer, align 16
@.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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @comp_ints(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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @prime_table_init() local_unnamed_addr #1 {
entry:
store i8 0, ptr getelementptr inbounds ([1000000 x i8], ptr @is_prime, i64 0, i64 1), align 1, !tbaa !9
store i8 0, ptr @is_prime, align 16, !tbaa !9
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(999998) getelementptr inbounds ([1000000 x i8], ptr @is_prime, i64 0, i64 2), i8 1, i64 999998, i1 false), !tbaa !9
br label %while.body
while.cond.loopexit: ; preds = %for.cond10
%0 = trunc i64 %indvars.iv53 to i32
%1 = trunc i64 %indvars.iv.next54 to i32
%cmp1 = icmp slt i32 %0, 999999
br i1 %cmp1, label %while.body, label %for.body20, !llvm.loop !10
while.body: ; preds = %entry, %while.cond.loopexit
%i.148 = phi i32 [ %1, %while.cond.loopexit ], [ 2, %entry ]
%cmp346 = icmp slt i32 %i.148, 500000
br i1 %cmp346, label %for.body4.preheader, label %while.body.for.cond10.preheader_crit_edge
while.body.for.cond10.preheader_crit_edge: ; preds = %while.body
%.pre = zext i32 %i.148 to i64
br label %for.cond10.preheader
for.body4.preheader: ; preds = %while.body
%mul = shl i32 %i.148, 1
%2 = sext i32 %mul to i64
%3 = sext i32 %i.148 to i64
br label %for.body4
for.cond10.preheader: ; preds = %for.body4, %while.body.for.cond10.preheader_crit_edge
%.pre-phi = phi i64 [ %.pre, %while.body.for.cond10.preheader_crit_edge ], [ %3, %for.body4 ]
%cmp13 = icmp sgt i32 %i.148, 999999
br label %for.cond10
for.body4: ; preds = %for.body4.preheader, %for.body4
%indvars.iv = phi i64 [ %2, %for.body4.preheader ], [ %indvars.iv.next, %for.body4 ]
%arrayidx6 = getelementptr inbounds [1000000 x i8], ptr @is_prime, i64 0, i64 %indvars.iv
store i8 0, ptr %arrayidx6, align 1, !tbaa !9
%indvars.iv.next = add i64 %indvars.iv, %3
%cmp3 = icmp slt i64 %indvars.iv.next, 1000000
br i1 %cmp3, label %for.body4, label %for.cond10.preheader, !llvm.loop !12
for.cond10: ; preds = %for.cond10, %for.cond10.preheader
%indvars.iv53 = phi i64 [ %indvars.iv.next54, %for.cond10 ], [ %.pre-phi, %for.cond10.preheader ]
%indvars.iv.next54 = add i64 %indvars.iv53, 1
%arrayidx12 = getelementptr inbounds [1000000 x i8], ptr @is_prime, i64 0, i64 %indvars.iv.next54
%4 = load i8, ptr %arrayidx12, align 1, !tbaa !9
%tobool.not = icmp eq i8 %4, 0
%5 = and i1 %cmp13, %tobool.not
br i1 %5, label %for.cond10, label %while.cond.loopexit, !llvm.loop !13
for.body20: ; preds = %while.cond.loopexit, %for.body20
%indvars.iv56 = phi i64 [ %indvars.iv.next57.1, %for.body20 ], [ 999999, %while.cond.loopexit ]
%i.349 = phi i32 [ %spec.select.1, %for.body20 ], [ -1, %while.cond.loopexit ]
%arrayidx22 = getelementptr inbounds [1000000 x i32], ptr @next_prime, i64 0, i64 %indvars.iv56
store i32 %i.349, ptr %arrayidx22, align 4, !tbaa !5
%arrayidx24 = getelementptr inbounds [1000000 x i8], ptr @is_prime, i64 0, i64 %indvars.iv56
%6 = load i8, ptr %arrayidx24, align 1, !tbaa !9
%tobool25.not = icmp eq i8 %6, 0
%7 = trunc i64 %indvars.iv56 to i32
%spec.select = select i1 %tobool25.not, i32 %i.349, i32 %7
%indvars.iv.next57 = add nsw i64 %indvars.iv56, -1
%arrayidx22.1 = getelementptr inbounds [1000000 x i32], ptr @next_prime, i64 0, i64 %indvars.iv.next57
store i32 %spec.select, ptr %arrayidx22.1, align 4, !tbaa !5
%arrayidx24.1 = getelementptr inbounds [1000000 x i8], ptr @is_prime, i64 0, i64 %indvars.iv.next57
%8 = load i8, ptr %arrayidx24.1, align 1, !tbaa !9
%tobool25.not.1 = icmp eq i8 %8, 0
%9 = trunc i64 %indvars.iv.next57 to i32
%spec.select.1 = select i1 %tobool25.not.1, i32 %spec.select, i32 %9
%indvars.iv.next57.1 = add nsw i64 %indvars.iv56, -2
%cmp19.not.1 = icmp eq i64 %indvars.iv.next57, 0
br i1 %cmp19.not.1, label %for.end27, label %for.body20, !llvm.loop !14
for.end27: ; preds = %for.body20
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%p = alloca i32, align 4
%primes = alloca [100 x i32], align 16
%sums = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #7
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %primes) #7
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %sums) #7
store i8 0, ptr getelementptr inbounds ([1000000 x i8], ptr @is_prime, i64 0, i64 1), align 1, !tbaa !9
store i8 0, ptr @is_prime, align 16, !tbaa !9
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(999998) getelementptr inbounds ([1000000 x i8], ptr @is_prime, i64 0, i64 2), i8 1, i64 999998, i1 false), !tbaa !9
br label %while.body.i
while.cond.loopexit.i: ; preds = %for.cond10.i, %for.cond10.preheader.i.split.us
%.us-phi = phi i64 [ %.pre-phi.i, %for.cond10.preheader.i.split.us ], [ %indvars.iv53.i, %for.cond10.i ]
%.us-phi40 = phi i64 [ %indvars.iv.next54.i.us, %for.cond10.preheader.i.split.us ], [ %indvars.iv.next54.i, %for.cond10.i ]
%0 = trunc i64 %.us-phi to i32
%1 = trunc i64 %.us-phi40 to i32
%cmp1.i = icmp slt i32 %0, 999999
br i1 %cmp1.i, label %while.body.i, label %for.body20.i, !llvm.loop !10
while.body.i: ; preds = %while.cond.loopexit.i, %entry
%i.148.i = phi i32 [ %1, %while.cond.loopexit.i ], [ 2, %entry ]
%cmp346.i = icmp slt i32 %i.148.i, 500000
br i1 %cmp346.i, label %for.body4.preheader.i, label %while.body.for.cond10.preheader_crit_edge.i
while.body.for.cond10.preheader_crit_edge.i: ; preds = %while.body.i
%.pre.i = zext i32 %i.148.i to i64
br label %for.cond10.preheader.i
for.body4.preheader.i: ; preds = %while.body.i
%mul.i = shl i32 %i.148.i, 1
%2 = sext i32 %mul.i to i64
%3 = sext i32 %i.148.i to i64
br label %for.body4.i
for.cond10.preheader.i: ; preds = %for.body4.i, %while.body.for.cond10.preheader_crit_edge.i
%.pre-phi.i = phi i64 [ %.pre.i, %while.body.for.cond10.preheader_crit_edge.i ], [ %3, %for.body4.i ]
%cmp13.i = icmp sgt i32 %i.148.i, 999999
br i1 %cmp13.i, label %for.cond10.i, label %for.cond10.preheader.i.split.us
for.cond10.preheader.i.split.us: ; preds = %for.cond10.preheader.i
%indvars.iv.next54.i.us = add nsw i64 %.pre-phi.i, 1
br label %while.cond.loopexit.i
for.body4.i: ; preds = %for.body4.i, %for.body4.preheader.i
%indvars.iv.i = phi i64 [ %2, %for.body4.preheader.i ], [ %indvars.iv.next.i, %for.body4.i ]
%arrayidx6.i = getelementptr inbounds [1000000 x i8], ptr @is_prime, i64 0, i64 %indvars.iv.i
store i8 0, ptr %arrayidx6.i, align 1, !tbaa !9
%indvars.iv.next.i = add i64 %indvars.iv.i, %3
%cmp3.i = icmp slt i64 %indvars.iv.next.i, 1000000
br i1 %cmp3.i, label %for.body4.i, label %for.cond10.preheader.i, !llvm.loop !12
for.cond10.i: ; preds = %for.cond10.preheader.i, %for.cond10.i
%indvars.iv53.i = phi i64 [ %indvars.iv.next54.i, %for.cond10.i ], [ %.pre-phi.i, %for.cond10.preheader.i ]
%indvars.iv.next54.i = add i64 %indvars.iv53.i, 1
%arrayidx12.i = getelementptr inbounds [1000000 x i8], ptr @is_prime, i64 0, i64 %indvars.iv.next54.i
%4 = load i8, ptr %arrayidx12.i, align 1, !tbaa !9
%tobool.not.i = icmp eq i8 %4, 0
br i1 %tobool.not.i, label %for.cond10.i, label %while.cond.loopexit.i, !llvm.loop !13
for.body20.i: ; preds = %while.cond.loopexit.i, %for.body20.i
%indvars.iv56.i = phi i64 [ %indvars.iv.next57.i.1, %for.body20.i ], [ 999999, %while.cond.loopexit.i ]
%i.349.i = phi i32 [ %spec.select.i.1, %for.body20.i ], [ -1, %while.cond.loopexit.i ]
%arrayidx22.i = getelementptr inbounds [1000000 x i32], ptr @next_prime, i64 0, i64 %indvars.iv56.i
store i32 %i.349.i, ptr %arrayidx22.i, align 4, !tbaa !5
%arrayidx24.i = getelementptr inbounds [1000000 x i8], ptr @is_prime, i64 0, i64 %indvars.iv56.i
%5 = load i8, ptr %arrayidx24.i, align 1, !tbaa !9
%tobool25.not.i = icmp eq i8 %5, 0
%6 = trunc i64 %indvars.iv56.i to i32
%spec.select.i = select i1 %tobool25.not.i, i32 %i.349.i, i32 %6
%indvars.iv.next57.i = add nsw i64 %indvars.iv56.i, -1
%arrayidx22.i.1 = getelementptr inbounds [1000000 x i32], ptr @next_prime, i64 0, i64 %indvars.iv.next57.i
store i32 %spec.select.i, ptr %arrayidx22.i.1, align 4, !tbaa !5
%arrayidx24.i.1 = getelementptr inbounds [1000000 x i8], ptr @is_prime, i64 0, i64 %indvars.iv.next57.i
%7 = load i8, ptr %arrayidx24.i.1, align 1, !tbaa !9
%tobool25.not.i.1 = icmp eq i8 %7, 0
%8 = trunc i64 %indvars.iv.next57.i to i32
%spec.select.i.1 = select i1 %tobool25.not.i.1, i32 %spec.select.i, i32 %8
%indvars.iv.next57.i.1 = add nsw i64 %indvars.iv56.i, -2
%cmp19.not.i.1 = icmp eq i64 %indvars.iv.next57.i, 0
br i1 %cmp19.not.i.1, label %while.cond.preheader, label %for.body20.i, !llvm.loop !14
while.cond.preheader: ; preds = %for.body20.i
%call50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %p)
%9 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not51 = icmp eq i32 %9, -1
br i1 %cmp.not51, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %while.cond.preheader, %for.end24
%10 = phi i32 [ %25, %for.end24 ], [ %9, %while.cond.preheader ]
%11 = load i32, ptr %p, align 4, !tbaa !5
%cmp141 = icmp sgt i32 %11, 0
br i1 %cmp141, label %for.body.preheader, label %for.end24
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %11 to i64
%xtraiter = and i64 %wide.trip.count, 3
%12 = icmp ult i32 %11, 4
br i1 %12, label %for.cond6.preheader.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.cond6.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%idxprom.pn.in43.unr = phi i32 [ %10, %for.body.preheader ], [ %j.0.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond6.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond6.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond6.preheader.unr-lcssa ]
%idxprom.pn.in43.epil = phi i32 [ %j.0.epil, %for.body.epil ], [ %idxprom.pn.in43.unr, %for.cond6.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond6.preheader.unr-lcssa ]
%idxprom.pn.epil = sext i32 %idxprom.pn.in43.epil to i64
%j.0.in.epil = getelementptr inbounds [1000000 x i32], ptr @next_prime, i64 0, i64 %idxprom.pn.epil
%j.0.epil = load i32, ptr %j.0.in.epil, align 4, !tbaa !5
%arrayidx3.epil = getelementptr inbounds [100 x i32], ptr %primes, i64 0, i64 %indvars.iv.epil
store i32 %j.0.epil, ptr %arrayidx3.epil, align 4, !tbaa !5
%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.cond6.preheader, label %for.body.epil, !llvm.loop !15
for.cond6.preheader: ; preds = %for.body.epil, %for.cond6.preheader.unr-lcssa
br i1 %cmp141, label %for.cond9.preheader.preheader, label %for.end24
for.cond9.preheader.preheader: ; preds = %for.cond6.preheader
%wide.trip.count71 = zext i32 %11 to i64
br label %for.cond9.preheader
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%idxprom.pn.in43 = phi i32 [ %10, %for.body.preheader.new ], [ %j.0.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%idxprom.pn = sext i32 %idxprom.pn.in43 to i64
%j.0.in = getelementptr inbounds [1000000 x i32], ptr @next_prime, i64 0, i64 %idxprom.pn
%j.0 = load i32, ptr %j.0.in, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [100 x i32], ptr %primes, i64 0, i64 %indvars.iv
store i32 %j.0, ptr %arrayidx3, align 16, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%idxprom.pn.1 = sext i32 %j.0 to i64
%j.0.in.1 = getelementptr inbounds [1000000 x i32], ptr @next_prime, i64 0, i64 %idxprom.pn.1
%j.0.1 = load i32, ptr %j.0.in.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [100 x i32], ptr %primes, i64 0, i64 %indvars.iv.next
store i32 %j.0.1, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%idxprom.pn.2 = sext i32 %j.0.1 to i64
%j.0.in.2 = getelementptr inbounds [1000000 x i32], ptr @next_prime, i64 0, i64 %idxprom.pn.2
%j.0.2 = load i32, ptr %j.0.in.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [100 x i32], ptr %primes, i64 0, i64 %indvars.iv.next.1
store i32 %j.0.2, ptr %arrayidx3.2, align 8, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%idxprom.pn.3 = sext i32 %j.0.2 to i64
%j.0.in.3 = getelementptr inbounds [1000000 x i32], ptr @next_prime, i64 0, i64 %idxprom.pn.3
%j.0.3 = load i32, ptr %j.0.in.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [100 x i32], ptr %primes, i64 0, i64 %indvars.iv.next.2
store i32 %j.0.3, ptr %arrayidx3.3, align 4, !tbaa !5
%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.cond6.preheader.unr-lcssa, label %for.body, !llvm.loop !17
for.cond9.preheader: ; preds = %for.cond9.preheader.preheader, %for.inc22
%indvars.iv66 = phi i64 [ 0, %for.cond9.preheader.preheader ], [ %indvars.iv.next67, %for.inc22 ]
%indvars.iv64 = phi i64 [ 1, %for.cond9.preheader.preheader ], [ %indvars.iv.next65, %for.inc22 ]
%k.048 = phi i64 [ 0, %for.cond9.preheader.preheader ], [ %indvars.iv.next54.lcssa, %for.inc22 ]
%arrayidx13 = getelementptr inbounds [100 x i32], ptr %primes, i64 0, i64 %indvars.iv66
%13 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%sext = shl i64 %k.048, 32
%14 = ashr exact i64 %sext, 32
%min.iters.check = icmp ult i64 %indvars.iv64, 8
br i1 %min.iters.check, label %for.body11.preheader, label %vector.ph
vector.ph: ; preds = %for.cond9.preheader
%n.vec = and i64 %indvars.iv64, 9223372036854775800
%ind.end = add i64 %14, %n.vec
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %13, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <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 ]
%offset.idx = add i64 %14, %index
%15 = getelementptr inbounds [100 x i32], ptr %primes, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %15, align 16, !tbaa !5
%16 = getelementptr inbounds i32, ptr %15, i64 4
%wide.load75 = load <4 x i32>, ptr %16, align 16, !tbaa !5
%17 = add nsw <4 x i32> %wide.load, %broadcast.splat
%18 = add nsw <4 x i32> %wide.load75, %broadcast.splat
%19 = getelementptr inbounds [10000 x i32], ptr %sums, i64 0, i64 %offset.idx
store <4 x i32> %17, ptr %19, align 4, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %18, ptr %20, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%21 = icmp eq i64 %index.next, %n.vec
br i1 %21, label %middle.block, label %vector.body, !llvm.loop !18
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %indvars.iv64, %n.vec
br i1 %cmp.n, label %for.inc22, label %for.body11.preheader
for.body11.preheader: ; preds = %for.cond9.preheader, %middle.block
%indvars.iv55.ph = phi i64 [ 0, %for.cond9.preheader ], [ %n.vec, %middle.block ]
%indvars.iv53.ph = phi i64 [ %14, %for.cond9.preheader ], [ %ind.end, %middle.block ]
br label %for.body11
for.body11: ; preds = %for.body11.preheader, %for.body11
%indvars.iv55 = phi i64 [ %indvars.iv.next56, %for.body11 ], [ %indvars.iv55.ph, %for.body11.preheader ]
%indvars.iv53 = phi i64 [ %indvars.iv.next54, %for.body11 ], [ %indvars.iv53.ph, %for.body11.preheader ]
%arrayidx15 = getelementptr inbounds [100 x i32], ptr %primes, i64 0, i64 %indvars.iv55
%22 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%add = add nsw i32 %22, %13
%arrayidx17 = getelementptr inbounds [10000 x i32], ptr %sums, i64 0, i64 %indvars.iv53
store i32 %add, ptr %arrayidx17, align 4, !tbaa !5
%indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
%indvars.iv.next54 = add nsw i64 %indvars.iv53, 1
%exitcond63.not = icmp eq i64 %indvars.iv.next56, %indvars.iv64
br i1 %exitcond63.not, label %for.inc22, label %for.body11, !llvm.loop !21
for.inc22: ; preds = %for.body11, %middle.block
%indvars.iv.next54.lcssa = phi i64 [ %ind.end, %middle.block ], [ %indvars.iv.next54, %for.body11 ]
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
%exitcond72.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count71
br i1 %exitcond72.not, label %for.end24, label %for.cond9.preheader, !llvm.loop !22
for.end24: ; preds = %for.inc22, %for.cond.preheader, %for.cond6.preheader
%k.0.lcssa = phi i64 [ 0, %for.cond6.preheader ], [ 0, %for.cond.preheader ], [ %indvars.iv.next54.lcssa, %for.inc22 ]
%sext73 = shl i64 %k.0.lcssa, 32
%conv = ashr exact i64 %sext73, 32
call void @qsort(ptr noundef nonnull %sums, i64 noundef %conv, i64 noundef 4, ptr noundef nonnull @comp_ints) #7
%23 = load i32, ptr %p, align 4, !tbaa !5
%sub = add nsw i32 %23, -1
%idxprom25 = sext i32 %sub to i64
%arrayidx26 = getelementptr inbounds [10000 x i32], ptr %sums, i64 0, i64 %idxprom25
%24 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %24)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %p)
%25 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not = icmp eq i32 %25, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !23
while.end: ; preds = %for.end24, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %sums) #7
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %primes) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #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 #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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree "no-trapping-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 nounwind willreturn memory(argmem: write) }
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 = !{!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, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11, !19, !20}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = distinct !{!21, !11, !20, !19}
!22 = distinct !{!22, !11}
!23 = distinct !{!23, !11}
|
#include <stdio.h>
#include <stdlib.h>
#define MAX_N 100291
int isPrime[ MAX_N + 1 ] = { 0, 0, 1, 1 };
void quickSort( int *, int, int );
int median( int, int, int );
void insertionSort( int *, int );
int main( void ) {
int i, j, N, P, cnt, p[ 22 ], sum[ 253 ];
for ( i = 5; i <= MAX_N; i += 6 )
isPrime[ i ] = 1;
for ( i = 7; i <= MAX_N; i += 6 )
isPrime[ i ] = 1;
for ( i = 5; i * i <= MAX_N; i += 6 )
if ( isPrime[ i ] )
for ( j = i * 2; j <= MAX_N; j += i )
isPrime[ j ] = 0;
for ( i = 7; i * i <= MAX_N; i += 6 )
if ( isPrime[ i ] )
for ( j = i * 2; j <= MAX_N; j += i )
isPrime[ j ] = 0;
for ( ; scanf( "%d %d", &N, &P ), N != -1; printf( "%d\n", sum[ P - 1 ] ) ) {
cnt = 0;
for ( i = N + 1; cnt < 22; i++ )
if ( isPrime[ i ] )
p[ cnt++ ] = i;
cnt = 0;
for ( i = 0; i < 22; i++ )
for ( j = i; j < 22; j++ )
sum[ cnt++ ] = p[ i ] + p[ j ];
quickSort( sum, 0, 252 );
}
return 0;
}
void quickSort( int *data, int l, int r ) {
if ( l < r ) {
int i = l, j = r, pivot = median( data[ i ], data[ ( i + j ) / 2 ], data[ j ] ), tmp;
while ( 1 ) {
for ( ; data[ i ] < pivot; i++ ) ;
for ( ; pivot < data [ j ]; j-- ) ;
if ( i >= j )
break;
tmp = data[ i ];
data[ i ] = data[ j ];
data[ j ] = tmp;
i++;
j--;
}
if ( i - l < 20 )
insertionSort( data + l, i - l );
else
quickSort( data, l, i - 1 );
if ( r - j < 20 )
insertionSort( data + j + 1, r - j );
else
quickSort( data, j + 1, r );
}
}
int median( int x, int y, int z ) {
if ( x < y )
if ( y < z )
return y;
else if ( z < x )
return x;
else
return z;
else if ( z < y )
return y;
else if ( x < z )
return x;
else
return z;
}
void insertionSort( int *data, int n ) {
int i, j, tmp;
for ( i = 1; i < n; i++ ) {
tmp = data[ i ];
for ( j = i; j && data[ j - 1 ] > tmp; j-- )
data[ j ] = data[ j - 1 ];
data[ j ] = tmp;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_190126/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_190126/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@isPrime = dso_local local_unnamed_addr global <{ i32, i32, i32, i32, [100288 x i32] }> <{ i32 0, i32 0, i32 1, i32 1, [100288 x i32] zeroinitializer }>, align 16
@.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:
%N = alloca i32, align 4
%P = alloca i32, align 4
%p = alloca [22 x i32], align 16
%sum = alloca [253 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %P) #7
call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %p) #7
call void @llvm.lifetime.start.p0(i64 1012, ptr nonnull %sum) #7
br label %for.body
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 5, %entry ], [ %indvars.iv.next.4, %for.body ]
%arrayidx = getelementptr inbounds [100292 x i32], ptr @isPrime, i64 0, i64 %indvars.iv
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 6
%arrayidx.1 = getelementptr inbounds [100292 x i32], ptr @isPrime, i64 0, i64 %indvars.iv.next
store i32 1, ptr %arrayidx.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 12
%arrayidx.2 = getelementptr inbounds [100292 x i32], ptr @isPrime, i64 0, i64 %indvars.iv.next.1
store i32 1, ptr %arrayidx.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 18
%arrayidx.3 = getelementptr inbounds [100292 x i32], ptr @isPrime, i64 0, i64 %indvars.iv.next.2
store i32 1, ptr %arrayidx.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 24
%arrayidx.4 = getelementptr inbounds [100292 x i32], ptr @isPrime, i64 0, i64 %indvars.iv.next.3
store i32 1, ptr %arrayidx.4, align 4, !tbaa !5
%indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 30
%cmp.4 = icmp ult i64 %indvars.iv, 100262
br i1 %cmp.4, label %for.body, label %for.body3, !llvm.loop !9
for.body3: ; preds = %for.body, %for.body3
%indvars.iv142 = phi i64 [ %indvars.iv.next143.4, %for.body3 ], [ 7, %for.body ]
%arrayidx5 = getelementptr inbounds [100292 x i32], ptr @isPrime, i64 0, i64 %indvars.iv142
store i32 1, ptr %arrayidx5, align 4, !tbaa !5
%indvars.iv.next143 = add nuw nsw i64 %indvars.iv142, 6
%arrayidx5.1 = getelementptr inbounds [100292 x i32], ptr @isPrime, i64 0, i64 %indvars.iv.next143
store i32 1, ptr %arrayidx5.1, align 4, !tbaa !5
%indvars.iv.next143.1 = add nuw nsw i64 %indvars.iv142, 12
%arrayidx5.2 = getelementptr inbounds [100292 x i32], ptr @isPrime, i64 0, i64 %indvars.iv.next143.1
store i32 1, ptr %arrayidx5.2, align 4, !tbaa !5
%indvars.iv.next143.2 = add nuw nsw i64 %indvars.iv142, 18
%arrayidx5.3 = getelementptr inbounds [100292 x i32], ptr @isPrime, i64 0, i64 %indvars.iv.next143.2
store i32 1, ptr %arrayidx5.3, align 4, !tbaa !5
%indvars.iv.next143.3 = add nuw nsw i64 %indvars.iv142, 24
%arrayidx5.4 = getelementptr inbounds [100292 x i32], ptr @isPrime, i64 0, i64 %indvars.iv.next143.3
store i32 1, ptr %arrayidx5.4, align 4, !tbaa !5
%indvars.iv.next143.4 = add nuw nsw i64 %indvars.iv142, 30
%cmp2.4 = icmp ult i64 %indvars.iv142, 100262
br i1 %cmp2.4, label %for.body3, label %for.body11, !llvm.loop !11
for.body11: ; preds = %for.body3, %for.inc23
%indvars.iv147 = phi i64 [ %indvars.iv.next148, %for.inc23 ], [ 5, %for.body3 ]
%indvars.iv145 = phi i64 [ %indvars.iv.next146, %for.inc23 ], [ 10, %for.body3 ]
%arrayidx13 = getelementptr inbounds [100292 x i32], ptr @isPrime, i64 0, i64 %indvars.iv147
%0 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%tobool.not.not = icmp eq i32 %0, 0
br i1 %tobool.not.not, label %for.inc23, label %for.body17
for.body17: ; preds = %for.body11, %for.body17
%indvars.iv149 = phi i64 [ %indvars.iv.next150, %for.body17 ], [ %indvars.iv145, %for.body11 ]
%arrayidx19 = getelementptr inbounds [100292 x i32], ptr @isPrime, i64 0, i64 %indvars.iv149
store i32 0, ptr %arrayidx19, align 4, !tbaa !5
%indvars.iv.next150 = add nuw nsw i64 %indvars.iv149, %indvars.iv147
%cmp16 = icmp ult i64 %indvars.iv.next150, 100292
br i1 %cmp16, label %for.body17, label %for.inc23, !llvm.loop !12
for.inc23: ; preds = %for.body17, %for.body11
%indvars.iv.next148 = add nuw nsw i64 %indvars.iv147, 6
%indvars = trunc i64 %indvars.iv.next148 to i32
%mul = mul nsw i32 %indvars, %indvars
%cmp10 = icmp ult i32 %mul, 100292
%indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 12
br i1 %cmp10, label %for.body11, label %for.body29, !llvm.loop !13
for.cond47.preheader: ; preds = %for.inc44
%call138 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %P)
%1 = load i32, ptr %N, align 4, !tbaa !5
%cmp48.not139 = icmp eq i32 %1, -1
br i1 %cmp48.not139, label %for.end88, label %for.cond51.preheader.preheader
for.cond51.preheader.preheader: ; preds = %for.cond47.preheader
%arrayidx73.1180 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 1
%arrayidx77.1182 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 1
%arrayidx73.2184 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 2
%arrayidx73.3188 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 3
%arrayidx73.5196 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 5
%arrayidx77.5198 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 5
%arrayidx73.6200 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 6
%arrayidx73.7204 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 7
%arrayidx73.8208 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 8
%arrayidx73.9212 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 9
%arrayidx77.9214 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 9
%arrayidx73.10216 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 10
%arrayidx73.11220 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 11
%arrayidx73.12224 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 12
%arrayidx73.13228 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 13
%arrayidx77.13230 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 13
%arrayidx73.14232 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 14
%arrayidx73.15236 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 15
%arrayidx73.16240 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 16
%arrayidx73.17244 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 17
%arrayidx77.17246 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 17
%arrayidx73.18248 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 18
%arrayidx73.19252 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 19
%arrayidx73.20256 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 20
%arrayidx73.21260 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 21
%arrayidx77.21262 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 21
%arrayidx77.1.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 23
%arrayidx77.1.5 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 27
%arrayidx77.1.9 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 31
%arrayidx77.1.13 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 35
%arrayidx77.1.17 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 39
%arrayidx77.2 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 43
%arrayidx77.2.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 44
%arrayidx77.2.5 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 48
%arrayidx77.2.9 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 52
%arrayidx77.2.13 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 56
%arrayidx77.2.17 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 60
%arrayidx77.2.19 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 62
%arrayidx77.3 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 63
%arrayidx77.3.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 64
%arrayidx77.3.5 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 68
%arrayidx77.3.9 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 72
%arrayidx77.3.13 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 76
%arrayidx77.3.17 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 80
%arrayidx77.3.18 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 81
%arrayidx77.4 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 82
%arrayidx77.4.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 83
%arrayidx77.4.2 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 84
%arrayidx77.4.6 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 88
%arrayidx77.4.10 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 92
%arrayidx77.4.14 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 96
%arrayidx77.5 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 100
%arrayidx77.5.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 101
%arrayidx77.5.5 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 105
%arrayidx77.5.9 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 109
%arrayidx77.5.13 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 113
%arrayidx77.6 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 117
%arrayidx77.6.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 118
%arrayidx77.6.5 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 122
%arrayidx77.6.9 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 126
%arrayidx77.6.13 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 130
%arrayidx77.6.15 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 132
%arrayidx77.7 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 133
%arrayidx77.7.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 134
%arrayidx77.7.5 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 138
%arrayidx77.7.9 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 142
%arrayidx77.7.13 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 146
%arrayidx77.7.14 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 147
%arrayidx77.8 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 148
%arrayidx77.8.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 149
%arrayidx77.8.5 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 153
%arrayidx77.8.9 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 157
%arrayidx77.8.13 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 161
%arrayidx77.9 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 162
%arrayidx77.9.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 163
%arrayidx77.9.5 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 167
%arrayidx77.9.9 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 171
%arrayidx77.10 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 175
%arrayidx77.10.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 176
%arrayidx77.10.5 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 180
%arrayidx77.10.9 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 184
%arrayidx77.10.10 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 185
%arrayidx77.10.11 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 186
%arrayidx77.11 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 187
%arrayidx77.11.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 188
%arrayidx77.11.5 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 192
%arrayidx77.11.9 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 196
%arrayidx77.12 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 198
%arrayidx77.12.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 199
%arrayidx77.12.5 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 203
%arrayidx77.12.9 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 207
%arrayidx77.13 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 208
%arrayidx77.13.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 209
%arrayidx77.13.5 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 213
%arrayidx77.13.6 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 214
%arrayidx77.13.7 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 215
%arrayidx77.14 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 217
%arrayidx77.14.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 218
%arrayidx77.14.5 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 222
%arrayidx77.14.6 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 223
%arrayidx77.15 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 225
%arrayidx77.15.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 226
%arrayidx77.15.5 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 230
%arrayidx77.16 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 232
%arrayidx77.16.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 233
%arrayidx77.16.5 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 237
%arrayidx77.17 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 238
%arrayidx77.17.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 239
%arrayidx77.17.2 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 240
%arrayidx77.17.3 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 241
%arrayidx77.18 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 243
%arrayidx77.18.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 244
%arrayidx77.18.2 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 245
%arrayidx77.19 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 247
%arrayidx77.19.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 248
%arrayidx77.20 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 250
%arrayidx77.20.1 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 251
%arrayidx77.21 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 252
br label %for.cond51.preheader
for.body29: ; preds = %for.inc23, %for.inc44
%indvars.iv155 = phi i64 [ %indvars.iv.next156, %for.inc44 ], [ 7, %for.inc23 ]
%indvars.iv153 = phi i64 [ %indvars.iv.next154, %for.inc44 ], [ 14, %for.inc23 ]
%arrayidx31 = getelementptr inbounds [100292 x i32], ptr @isPrime, i64 0, i64 %indvars.iv155
%2 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%tobool32.not.not = icmp eq i32 %2, 0
br i1 %tobool32.not.not, label %for.inc44, label %for.body37
for.body37: ; preds = %for.body29, %for.body37
%indvars.iv157 = phi i64 [ %indvars.iv.next158, %for.body37 ], [ %indvars.iv153, %for.body29 ]
%arrayidx39 = getelementptr inbounds [100292 x i32], ptr @isPrime, i64 0, i64 %indvars.iv157
store i32 0, ptr %arrayidx39, align 4, !tbaa !5
%indvars.iv.next158 = add nuw nsw i64 %indvars.iv157, %indvars.iv155
%cmp36 = icmp ult i64 %indvars.iv.next158, 100292
br i1 %cmp36, label %for.body37, label %for.inc44, !llvm.loop !14
for.inc44: ; preds = %for.body37, %for.body29
%indvars.iv.next156 = add nuw nsw i64 %indvars.iv155, 6
%indvars161 = trunc i64 %indvars.iv.next156 to i32
%mul27 = mul nsw i32 %indvars161, %indvars161
%cmp28 = icmp ult i32 %mul27, 100292
%indvars.iv.next154 = add nuw nsw i64 %indvars.iv153, 12
br i1 %cmp28, label %for.body29, label %for.cond47.preheader, !llvm.loop !15
for.cond51.preheader: ; preds = %for.cond51.preheader.preheader, %for.cond67.preheader.preheader
%3 = phi i32 [ %204, %for.cond67.preheader.preheader ], [ %1, %for.cond51.preheader.preheader ]
%4 = sext i32 %3 to i64
br label %for.body53
for.body53: ; preds = %for.cond51.preheader, %for.inc61
%indvars.iv163 = phi i64 [ %4, %for.cond51.preheader ], [ %indvars.iv.next164, %for.inc61 ]
%cnt.0132 = phi i32 [ 0, %for.cond51.preheader ], [ %cnt.1, %for.inc61 ]
%indvars.iv.next164 = add nsw i64 %indvars.iv163, 1
%arrayidx55 = getelementptr inbounds [100292 x i32], ptr @isPrime, i64 0, i64 %indvars.iv.next164
%5 = load i32, ptr %arrayidx55, align 4, !tbaa !5
%tobool56.not = icmp eq i32 %5, 0
br i1 %tobool56.not, label %for.inc61, label %if.then57
if.then57: ; preds = %for.body53
%inc = add nsw i32 %cnt.0132, 1
%idxprom58 = sext i32 %cnt.0132 to i64
%arrayidx59 = getelementptr inbounds [22 x i32], ptr %p, i64 0, i64 %idxprom58
%6 = trunc i64 %indvars.iv.next164 to i32
store i32 %6, ptr %arrayidx59, align 4, !tbaa !5
br label %for.inc61
for.inc61: ; preds = %for.body53, %if.then57
%cnt.1 = phi i32 [ %inc, %if.then57 ], [ %cnt.0132, %for.body53 ]
%cmp52 = icmp slt i32 %cnt.1, 22
br i1 %cmp52, label %for.body53, label %for.cond67.preheader.preheader, !llvm.loop !16
for.cond67.preheader.preheader: ; preds = %for.inc61
%7 = load <4 x i32>, ptr %arrayidx73.1180, align 4, !tbaa !5
%8 = load <4 x i32>, ptr %arrayidx73.5196, align 4, !tbaa !5
%9 = load <4 x i32>, ptr %arrayidx73.9212, align 4, !tbaa !5
%10 = load <4 x i32>, ptr %arrayidx73.13228, align 4, !tbaa !5
%11 = load <4 x i32>, ptr %arrayidx73.17244, align 4, !tbaa !5
%12 = load i32, ptr %arrayidx73.21260, align 4, !tbaa !5
%13 = load <2 x i32>, ptr %p, align 16, !tbaa !5
%14 = extractelement <2 x i32> %13, i64 0
%add74 = shl nsw i32 %14, 1
store i32 %add74, ptr %sum, align 16, !tbaa !5
%15 = shufflevector <2 x i32> %13, <2 x i32> poison, <4 x i32> <i32 poison, i32 1, i32 poison, i32 poison>
%16 = shufflevector <2 x i32> %13, <2 x i32> poison, <4 x i32> zeroinitializer
%17 = add nsw <4 x i32> %7, %16
store <4 x i32> %17, ptr %arrayidx77.1182, align 4, !tbaa !5
%18 = add nsw <4 x i32> %8, %16
store <4 x i32> %18, ptr %arrayidx77.5198, align 4, !tbaa !5
%19 = add nsw <4 x i32> %9, %16
store <4 x i32> %19, ptr %arrayidx77.9214, align 4, !tbaa !5
%20 = add nsw <4 x i32> %10, %16
store <4 x i32> %20, ptr %arrayidx77.13230, align 4, !tbaa !5
%21 = add nsw <4 x i32> %11, %16
store <4 x i32> %21, ptr %arrayidx77.17246, align 4, !tbaa !5
%22 = insertelement <2 x i32> <i32 poison, i32 1>, i32 %12, i64 0
%23 = add nsw <2 x i32> %13, %22
%24 = shl nsw <2 x i32> %13, %22
%25 = shufflevector <2 x i32> %23, <2 x i32> %24, <2 x i32> <i32 0, i32 3>
store <2 x i32> %25, ptr %arrayidx77.21262, align 4, !tbaa !5
%26 = load <4 x i32>, ptr %arrayidx73.2184, align 8, !tbaa !5
%27 = shufflevector <2 x i32> %13, <2 x i32> poison, <4 x i32> <i32 1, i32 poison, i32 poison, i32 poison>
%28 = shufflevector <2 x i32> %13, <2 x i32> poison, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
%29 = add nsw <4 x i32> %26, %28
store <4 x i32> %29, ptr %arrayidx77.1.1, align 4, !tbaa !5
%30 = shufflevector <4 x i32> %8, <4 x i32> %9, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
%31 = add nsw <4 x i32> %30, %28
store <4 x i32> %31, ptr %arrayidx77.1.5, align 4, !tbaa !5
%32 = shufflevector <4 x i32> %9, <4 x i32> %10, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
%33 = add nsw <4 x i32> %32, %28
store <4 x i32> %33, ptr %arrayidx77.1.9, align 4, !tbaa !5
%34 = shufflevector <4 x i32> %10, <4 x i32> %11, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
%35 = add nsw <4 x i32> %34, %28
store <4 x i32> %35, ptr %arrayidx77.1.13, align 4, !tbaa !5
%36 = insertelement <4 x i32> %27, i32 %12, i64 1
%37 = shufflevector <4 x i32> %36, <4 x i32> poison, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
%38 = shufflevector <4 x i32> %11, <4 x i32> poison, <4 x i32> <i32 1, i32 2, i32 3, i32 poison>
%39 = shufflevector <4 x i32> %38, <4 x i32> %15, <4 x i32> <i32 0, i32 1, i32 2, i32 5>
%40 = add nsw <4 x i32> %37, %39
store <4 x i32> %40, ptr %arrayidx77.1.17, align 4, !tbaa !5
%41 = extractelement <4 x i32> %26, i64 0
%add74.2 = shl nsw i32 %41, 1
store i32 %add74.2, ptr %arrayidx77.2, align 4, !tbaa !5
%42 = shufflevector <4 x i32> %26, <4 x i32> poison, <4 x i32> <i32 1, i32 2, i32 3, i32 poison>
%43 = shufflevector <4 x i32> %26, <4 x i32> poison, <4 x i32> zeroinitializer
%44 = load <4 x i32>, ptr %arrayidx73.7204, align 4, !tbaa !5
%45 = add nsw <4 x i32> %44, %43
store <4 x i32> %45, ptr %arrayidx77.2.5, align 16, !tbaa !5
%46 = load <4 x i32>, ptr %arrayidx73.11220, align 4, !tbaa !5
%47 = add nsw <4 x i32> %46, %43
store <4 x i32> %47, ptr %arrayidx77.2.9, align 16, !tbaa !5
%48 = load <4 x i32>, ptr %arrayidx73.15236, align 4, !tbaa !5
%49 = add nsw <4 x i32> %48, %43
store <4 x i32> %49, ptr %arrayidx77.2.13, align 16, !tbaa !5
%50 = load <2 x i32>, ptr %arrayidx73.19252, align 4, !tbaa !5
%51 = shufflevector <4 x i32> %26, <4 x i32> poison, <2 x i32> zeroinitializer
%52 = add nsw <2 x i32> %50, %51
store <2 x i32> %52, ptr %arrayidx77.2.17, align 16, !tbaa !5
%53 = load i32, ptr %arrayidx73.21260, align 4, !tbaa !5
%add74.2.19 = add nsw i32 %53, %41
store i32 %add74.2.19, ptr %arrayidx77.2.19, align 8, !tbaa !5
%54 = load <4 x i32>, ptr %arrayidx73.3188, align 4, !tbaa !5
%55 = shufflevector <4 x i32> %42, <4 x i32> %54, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
%56 = add nsw <4 x i32> %55, %43
store <4 x i32> %56, ptr %arrayidx77.2.1, align 16, !tbaa !5
%57 = extractelement <4 x i32> %54, i64 0
%add74.3 = shl nsw i32 %57, 1
store i32 %add74.3, ptr %arrayidx77.3, align 4, !tbaa !5
%58 = shufflevector <4 x i32> %44, <4 x i32> %54, <2 x i32> <i32 4, i32 0>
%59 = shufflevector <2 x i32> %58, <2 x i32> poison, <4 x i32> <i32 1, i32 0, i32 0, i32 0>
%60 = add nsw <4 x i32> %59, %54
%61 = shufflevector <4 x i32> %60, <4 x i32> poison, <4 x i32> <i32 1, i32 2, i32 3, i32 0>
store <4 x i32> %61, ptr %arrayidx77.3.1, align 16, !tbaa !5
%62 = shufflevector <4 x i32> %44, <4 x i32> %46, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
%63 = shufflevector <4 x i32> %54, <4 x i32> poison, <4 x i32> zeroinitializer
%64 = add nsw <4 x i32> %62, %63
store <4 x i32> %64, ptr %arrayidx77.3.5, align 16, !tbaa !5
%65 = shufflevector <4 x i32> %46, <4 x i32> %48, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
%66 = add nsw <4 x i32> %65, %63
store <4 x i32> %66, ptr %arrayidx77.3.9, align 16, !tbaa !5
%67 = shufflevector <4 x i32> %48, <4 x i32> poison, <4 x i32> <i32 1, i32 2, i32 3, i32 poison>
%68 = shufflevector <2 x i32> %50, <2 x i32> poison, <4 x i32> <i32 0, i32 poison, i32 poison, i32 poison>
%69 = shufflevector <4 x i32> %67, <4 x i32> %68, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
%70 = add nsw <4 x i32> %69, %63
store <4 x i32> %70, ptr %arrayidx77.3.13, align 16, !tbaa !5
%71 = extractelement <2 x i32> %50, i64 1
%add74.3.17 = add nsw i32 %71, %57
store i32 %add74.3.17, ptr %arrayidx77.3.17, align 16, !tbaa !5
%add74.3.18 = add nsw i32 %53, %57
store i32 %add74.3.18, ptr %arrayidx77.3.18, align 4, !tbaa !5
%72 = extractelement <4 x i32> %54, i64 1
%add74.4 = shl nsw i32 %72, 1
store i32 %add74.4, ptr %arrayidx77.4, align 8, !tbaa !5
%73 = extractelement <4 x i32> %54, i64 2
%add74.4.1 = add nsw i32 %73, %72
store i32 %add74.4.1, ptr %arrayidx77.4.1, align 4, !tbaa !5
%74 = load <4 x i32>, ptr %arrayidx73.6200, align 8, !tbaa !5
%75 = shufflevector <4 x i32> %54, <4 x i32> poison, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
%76 = add nsw <4 x i32> %74, %75
store <4 x i32> %76, ptr %arrayidx77.4.2, align 16, !tbaa !5
%77 = load <4 x i32>, ptr %arrayidx73.10216, align 8, !tbaa !5
%78 = add nsw <4 x i32> %77, %75
store <4 x i32> %78, ptr %arrayidx77.4.6, align 16, !tbaa !5
%79 = load <4 x i32>, ptr %arrayidx73.14232, align 8, !tbaa !5
%80 = add nsw <4 x i32> %79, %75
store <4 x i32> %80, ptr %arrayidx77.4.10, align 16, !tbaa !5
%81 = load <4 x i32>, ptr %arrayidx73.18248, align 8, !tbaa !5
%82 = add nsw <4 x i32> %81, %75
store <4 x i32> %82, ptr %arrayidx77.4.14, align 16, !tbaa !5
%83 = load i32, ptr %arrayidx73.5196, align 4, !tbaa !5
%add74.5 = shl nsw i32 %83, 1
store i32 %add74.5, ptr %arrayidx77.5, align 16, !tbaa !5
%84 = insertelement <4 x i32> poison, i32 %83, i64 0
%85 = shufflevector <4 x i32> %84, <4 x i32> poison, <4 x i32> zeroinitializer
%86 = add nsw <4 x i32> %74, %85
store <4 x i32> %86, ptr %arrayidx77.5.1, align 4, !tbaa !5
%87 = add nsw <4 x i32> %77, %85
store <4 x i32> %87, ptr %arrayidx77.5.5, align 4, !tbaa !5
%88 = add nsw <4 x i32> %79, %85
store <4 x i32> %88, ptr %arrayidx77.5.9, align 4, !tbaa !5
%89 = add nsw <4 x i32> %81, %85
store <4 x i32> %89, ptr %arrayidx77.5.13, align 4, !tbaa !5
%90 = load i32, ptr %arrayidx73.6200, align 8, !tbaa !5
%add74.6 = shl nsw i32 %90, 1
store i32 %add74.6, ptr %arrayidx77.6, align 4, !tbaa !5
%91 = load <4 x i32>, ptr %arrayidx73.7204, align 4, !tbaa !5
%92 = insertelement <4 x i32> poison, i32 %90, i64 0
%93 = shufflevector <4 x i32> %92, <4 x i32> poison, <4 x i32> zeroinitializer
%94 = add nsw <4 x i32> %91, %93
store <4 x i32> %94, ptr %arrayidx77.6.1, align 8, !tbaa !5
%95 = load <4 x i32>, ptr %arrayidx73.11220, align 4, !tbaa !5
%96 = add nsw <4 x i32> %95, %93
store <4 x i32> %96, ptr %arrayidx77.6.5, align 8, !tbaa !5
%97 = load <4 x i32>, ptr %arrayidx73.15236, align 4, !tbaa !5
%98 = add nsw <4 x i32> %97, %93
store <4 x i32> %98, ptr %arrayidx77.6.9, align 8, !tbaa !5
%99 = load <2 x i32>, ptr %arrayidx73.19252, align 4, !tbaa !5
%100 = insertelement <2 x i32> poison, i32 %90, i64 0
%101 = shufflevector <2 x i32> %100, <2 x i32> poison, <2 x i32> zeroinitializer
%102 = add nsw <2 x i32> %99, %101
store <2 x i32> %102, ptr %arrayidx77.6.13, align 8, !tbaa !5
%103 = load i32, ptr %arrayidx73.21260, align 4, !tbaa !5
%add74.6.15 = add nsw i32 %103, %90
store i32 %add74.6.15, ptr %arrayidx77.6.15, align 16, !tbaa !5
%104 = extractelement <4 x i32> %91, i64 0
%add74.7 = shl nsw i32 %104, 1
store i32 %add74.7, ptr %arrayidx77.7, align 4, !tbaa !5
%105 = shufflevector <4 x i32> %91, <4 x i32> %95, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
%106 = shufflevector <4 x i32> %91, <4 x i32> poison, <4 x i32> zeroinitializer
%107 = add nsw <4 x i32> %105, %106
store <4 x i32> %107, ptr %arrayidx77.7.1, align 8, !tbaa !5
%108 = shufflevector <4 x i32> %95, <4 x i32> %97, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
%109 = add nsw <4 x i32> %108, %106
store <4 x i32> %109, ptr %arrayidx77.7.5, align 8, !tbaa !5
%110 = shufflevector <4 x i32> %97, <4 x i32> poison, <4 x i32> <i32 1, i32 2, i32 3, i32 poison>
%111 = shufflevector <2 x i32> %99, <2 x i32> poison, <4 x i32> <i32 0, i32 poison, i32 poison, i32 poison>
%112 = shufflevector <4 x i32> %110, <4 x i32> %111, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
%113 = add nsw <4 x i32> %112, %106
store <4 x i32> %113, ptr %arrayidx77.7.9, align 8, !tbaa !5
%114 = extractelement <2 x i32> %99, i64 1
%add74.7.13 = add nsw i32 %114, %104
store i32 %add74.7.13, ptr %arrayidx77.7.13, align 8, !tbaa !5
%add74.7.14 = add nsw i32 %103, %104
store i32 %add74.7.14, ptr %arrayidx77.7.14, align 4, !tbaa !5
%115 = load i32, ptr %arrayidx73.8208, align 16, !tbaa !5
%add74.8 = shl nsw i32 %115, 1
store i32 %add74.8, ptr %arrayidx77.8, align 16, !tbaa !5
%116 = load <4 x i32>, ptr %arrayidx73.9212, align 4, !tbaa !5
%117 = insertelement <4 x i32> poison, i32 %115, i64 0
%118 = shufflevector <4 x i32> %117, <4 x i32> poison, <4 x i32> zeroinitializer
%119 = add nsw <4 x i32> %116, %118
store <4 x i32> %119, ptr %arrayidx77.8.1, align 4, !tbaa !5
%120 = load <4 x i32>, ptr %arrayidx73.13228, align 4, !tbaa !5
%121 = add nsw <4 x i32> %120, %118
store <4 x i32> %121, ptr %arrayidx77.8.5, align 4, !tbaa !5
%122 = load <4 x i32>, ptr %arrayidx73.17244, align 4, !tbaa !5
%123 = add nsw <4 x i32> %122, %118
store <4 x i32> %123, ptr %arrayidx77.8.9, align 4, !tbaa !5
%124 = load i32, ptr %arrayidx73.21260, align 4, !tbaa !5
%add74.8.13 = add nsw i32 %124, %115
store i32 %add74.8.13, ptr %arrayidx77.8.13, align 4, !tbaa !5
%125 = extractelement <4 x i32> %116, i64 0
%add74.9 = shl nsw i32 %125, 1
store i32 %add74.9, ptr %arrayidx77.9, align 8, !tbaa !5
%126 = extractelement <4 x i32> %116, i64 1
%127 = shufflevector <4 x i32> %116, <4 x i32> %120, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
%128 = shufflevector <4 x i32> %116, <4 x i32> poison, <4 x i32> zeroinitializer
%129 = add nsw <4 x i32> %127, %128
store <4 x i32> %129, ptr %arrayidx77.9.1, align 4, !tbaa !5
%130 = shufflevector <4 x i32> %120, <4 x i32> %122, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
%131 = add nsw <4 x i32> %130, %128
store <4 x i32> %131, ptr %arrayidx77.9.5, align 4, !tbaa !5
%132 = extractelement <4 x i32> %122, i64 2
%133 = extractelement <4 x i32> %122, i64 3
%134 = shufflevector <4 x i32> %122, <4 x i32> poison, <4 x i32> <i32 1, i32 2, i32 3, i32 poison>
%135 = insertelement <4 x i32> %134, i32 %124, i64 3
%136 = add nsw <4 x i32> %135, %128
store <4 x i32> %136, ptr %arrayidx77.9.9, align 4, !tbaa !5
%add74.10 = shl nsw i32 %126, 1
store i32 %add74.10, ptr %arrayidx77.10, align 4, !tbaa !5
%137 = shufflevector <4 x i32> %116, <4 x i32> %120, <4 x i32> <i32 2, i32 3, i32 4, i32 5>
%138 = shufflevector <4 x i32> %116, <4 x i32> poison, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
%139 = add nsw <4 x i32> %137, %138
store <4 x i32> %139, ptr %arrayidx77.10.1, align 16, !tbaa !5
%140 = shufflevector <4 x i32> %120, <4 x i32> %122, <4 x i32> <i32 2, i32 3, i32 4, i32 5>
%141 = add nsw <4 x i32> %140, %138
store <4 x i32> %141, ptr %arrayidx77.10.5, align 16, !tbaa !5
%add74.10.9 = add nsw i32 %132, %126
store i32 %add74.10.9, ptr %arrayidx77.10.9, align 16, !tbaa !5
%add74.10.10 = add nsw i32 %133, %126
store i32 %add74.10.10, ptr %arrayidx77.10.10, align 4, !tbaa !5
%add74.10.11 = add nsw i32 %124, %126
store i32 %add74.10.11, ptr %arrayidx77.10.11, align 8, !tbaa !5
%142 = load i32, ptr %arrayidx73.11220, align 4, !tbaa !5
%add74.11 = shl nsw i32 %142, 1
store i32 %add74.11, ptr %arrayidx77.11, align 4, !tbaa !5
%143 = load <4 x i32>, ptr %arrayidx73.12224, align 16, !tbaa !5
%144 = insertelement <4 x i32> poison, i32 %142, i64 0
%145 = shufflevector <4 x i32> %144, <4 x i32> poison, <4 x i32> zeroinitializer
%146 = add nsw <4 x i32> %143, %145
store <4 x i32> %146, ptr %arrayidx77.11.1, align 16, !tbaa !5
%147 = load <4 x i32>, ptr %arrayidx73.16240, align 16, !tbaa !5
%148 = add nsw <4 x i32> %147, %145
store <4 x i32> %148, ptr %arrayidx77.11.5, align 16, !tbaa !5
%149 = load <2 x i32>, ptr %arrayidx73.20256, align 16, !tbaa !5
%150 = insertelement <2 x i32> poison, i32 %142, i64 0
%151 = shufflevector <2 x i32> %150, <2 x i32> poison, <2 x i32> zeroinitializer
%152 = add nsw <2 x i32> %149, %151
store <2 x i32> %152, ptr %arrayidx77.11.9, align 16, !tbaa !5
%153 = extractelement <4 x i32> %143, i64 0
%add74.12 = shl nsw i32 %153, 1
store i32 %add74.12, ptr %arrayidx77.12, align 8, !tbaa !5
%154 = extractelement <4 x i32> %143, i64 1
%155 = extractelement <4 x i32> %143, i64 2
%156 = shufflevector <4 x i32> %143, <4 x i32> %147, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
%157 = shufflevector <4 x i32> %143, <4 x i32> poison, <4 x i32> zeroinitializer
%158 = add nsw <4 x i32> %156, %157
store <4 x i32> %158, ptr %arrayidx77.12.1, align 4, !tbaa !5
%159 = extractelement <4 x i32> %147, i64 2
%160 = extractelement <4 x i32> %147, i64 3
%161 = shufflevector <4 x i32> %147, <4 x i32> poison, <4 x i32> <i32 1, i32 2, i32 3, i32 poison>
%162 = shufflevector <2 x i32> %149, <2 x i32> poison, <4 x i32> <i32 0, i32 poison, i32 poison, i32 poison>
%163 = shufflevector <4 x i32> %161, <4 x i32> %162, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
%164 = add nsw <4 x i32> %163, %157
store <4 x i32> %164, ptr %arrayidx77.12.5, align 4, !tbaa !5
%165 = extractelement <2 x i32> %149, i64 1
%add74.12.9 = add nsw i32 %165, %153
store i32 %add74.12.9, ptr %arrayidx77.12.9, align 4, !tbaa !5
%add74.13 = shl nsw i32 %154, 1
store i32 %add74.13, ptr %arrayidx77.13, align 16, !tbaa !5
%166 = shufflevector <4 x i32> %143, <4 x i32> %147, <4 x i32> <i32 2, i32 3, i32 4, i32 5>
%167 = shufflevector <4 x i32> %143, <4 x i32> poison, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
%168 = add nsw <4 x i32> %166, %167
store <4 x i32> %168, ptr %arrayidx77.13.1, align 4, !tbaa !5
%add74.13.5 = add nsw i32 %159, %154
store i32 %add74.13.5, ptr %arrayidx77.13.5, align 4, !tbaa !5
%add74.13.6 = add nsw i32 %160, %154
store i32 %add74.13.6, ptr %arrayidx77.13.6, align 8, !tbaa !5
%169 = shufflevector <4 x i32> %143, <4 x i32> poison, <2 x i32> <i32 1, i32 1>
%170 = add nsw <2 x i32> %149, %169
store <2 x i32> %170, ptr %arrayidx77.13.7, align 4, !tbaa !5
%add74.14 = shl nsw i32 %155, 1
store i32 %add74.14, ptr %arrayidx77.14, align 4, !tbaa !5
%171 = shufflevector <4 x i32> %143, <4 x i32> %147, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%172 = shufflevector <4 x i32> %143, <4 x i32> poison, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
%173 = add nsw <4 x i32> %171, %172
store <4 x i32> %173, ptr %arrayidx77.14.1, align 8, !tbaa !5
%add74.14.5 = add nsw i32 %160, %155
store i32 %add74.14.5, ptr %arrayidx77.14.5, align 8, !tbaa !5
%174 = shufflevector <4 x i32> %143, <4 x i32> poison, <2 x i32> <i32 2, i32 2>
%175 = add nsw <2 x i32> %149, %174
store <2 x i32> %175, ptr %arrayidx77.14.6, align 4, !tbaa !5
%176 = load i32, ptr %arrayidx73.15236, align 4, !tbaa !5
%add74.15 = shl nsw i32 %176, 1
store i32 %add74.15, ptr %arrayidx77.15, align 4, !tbaa !5
%177 = load <4 x i32>, ptr %arrayidx73.16240, align 16, !tbaa !5
%178 = insertelement <4 x i32> poison, i32 %176, i64 0
%179 = shufflevector <4 x i32> %178, <4 x i32> poison, <4 x i32> zeroinitializer
%180 = add nsw <4 x i32> %177, %179
store <4 x i32> %180, ptr %arrayidx77.15.1, align 8, !tbaa !5
%181 = load <2 x i32>, ptr %arrayidx73.20256, align 16, !tbaa !5
%182 = insertelement <2 x i32> poison, i32 %176, i64 0
%183 = shufflevector <2 x i32> %182, <2 x i32> poison, <2 x i32> zeroinitializer
%184 = add nsw <2 x i32> %181, %183
store <2 x i32> %184, ptr %arrayidx77.15.5, align 8, !tbaa !5
%185 = extractelement <4 x i32> %177, i64 0
%add74.16 = shl nsw i32 %185, 1
store i32 %add74.16, ptr %arrayidx77.16, align 16, !tbaa !5
%186 = extractelement <4 x i32> %177, i64 1
%187 = extractelement <4 x i32> %177, i64 2
%188 = extractelement <4 x i32> %177, i64 3
%189 = shufflevector <4 x i32> %177, <4 x i32> poison, <4 x i32> <i32 1, i32 2, i32 3, i32 poison>
%190 = shufflevector <2 x i32> %181, <2 x i32> poison, <4 x i32> <i32 0, i32 poison, i32 poison, i32 poison>
%191 = shufflevector <4 x i32> %189, <4 x i32> %190, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
%192 = shufflevector <4 x i32> %177, <4 x i32> poison, <4 x i32> zeroinitializer
%193 = add nsw <4 x i32> %191, %192
store <4 x i32> %193, ptr %arrayidx77.16.1, align 4, !tbaa !5
%194 = extractelement <2 x i32> %181, i64 1
%add74.16.5 = add nsw i32 %194, %185
store i32 %add74.16.5, ptr %arrayidx77.16.5, align 4, !tbaa !5
%add74.17 = shl nsw i32 %186, 1
store i32 %add74.17, ptr %arrayidx77.17, align 8, !tbaa !5
%add74.17.1 = add nsw i32 %187, %186
store i32 %add74.17.1, ptr %arrayidx77.17.1, align 4, !tbaa !5
%add74.17.2 = add nsw i32 %188, %186
store i32 %add74.17.2, ptr %arrayidx77.17.2, align 16, !tbaa !5
%195 = shufflevector <4 x i32> %177, <4 x i32> poison, <2 x i32> <i32 1, i32 1>
%196 = add nsw <2 x i32> %181, %195
store <2 x i32> %196, ptr %arrayidx77.17.3, align 4, !tbaa !5
%add74.18 = shl nsw i32 %187, 1
store i32 %add74.18, ptr %arrayidx77.18, align 4, !tbaa !5
%add74.18.1 = add nsw i32 %188, %187
store i32 %add74.18.1, ptr %arrayidx77.18.1, align 16, !tbaa !5
%197 = shufflevector <4 x i32> %177, <4 x i32> poison, <2 x i32> <i32 2, i32 2>
%198 = add nsw <2 x i32> %181, %197
store <2 x i32> %198, ptr %arrayidx77.18.2, align 4, !tbaa !5
%add74.19 = shl nsw i32 %188, 1
store i32 %add74.19, ptr %arrayidx77.19, align 4, !tbaa !5
%199 = shufflevector <4 x i32> %177, <4 x i32> poison, <2 x i32> <i32 3, i32 3>
%200 = add nsw <2 x i32> %181, %199
store <2 x i32> %200, ptr %arrayidx77.19.1, align 16, !tbaa !5
%201 = extractelement <2 x i32> %181, i64 0
%add74.20 = shl nsw i32 %201, 1
store i32 %add74.20, ptr %arrayidx77.20, align 8, !tbaa !5
%add74.20.1 = add nsw i32 %194, %201
store i32 %add74.20.1, ptr %arrayidx77.20.1, align 4, !tbaa !5
%add74.21 = shl nsw i32 %194, 1
store i32 %add74.21, ptr %arrayidx77.21, align 16, !tbaa !5
call void @quickSort(ptr noundef nonnull %sum, i32 noundef 0, i32 noundef 252)
%202 = load i32, ptr %P, align 4, !tbaa !5
%sub = add nsw i32 %202, -1
%idxprom85 = sext i32 %sub to i64
%arrayidx86 = getelementptr inbounds [253 x i32], ptr %sum, i64 0, i64 %idxprom85
%203 = load i32, ptr %arrayidx86, align 4, !tbaa !5
%call87 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %203)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %P)
%204 = load i32, ptr %N, align 4, !tbaa !5
%cmp48.not = icmp eq i32 %204, -1
br i1 %cmp48.not, label %for.end88, label %for.cond51.preheader, !llvm.loop !17
for.end88: ; preds = %for.cond67.preheader.preheader, %for.cond47.preheader
call void @llvm.lifetime.end.p0(i64 1012, ptr nonnull %sum) #7
call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %p) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %P) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @quickSort(ptr nocapture noundef %data, i32 noundef %l, i32 noundef %r) local_unnamed_addr #3 {
entry:
%cmp109 = icmp slt i32 %l, %r
br i1 %cmp109, label %if.then.lr.ph, label %if.end42
if.then.lr.ph: ; preds = %entry
%idxprom3 = sext i32 %r to i64
%arrayidx4 = getelementptr inbounds i32, ptr %data, i64 %idxprom3
br label %if.then
tailrecurse: ; preds = %if.end31
%add40 = add nsw i32 %8, 1
%cmp = icmp slt i32 %add40, %r
br i1 %cmp, label %if.then, label %if.end42
if.then: ; preds = %if.then.lr.ph, %tailrecurse
%l.tr110 = phi i32 [ %l, %if.then.lr.ph ], [ %add40, %tailrecurse ]
%idxprom = sext i32 %l.tr110 to i64
%arrayidx = getelementptr inbounds i32, ptr %data, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %l.tr110, %r
%div = sdiv i32 %add, 2
%idxprom1 = sext i32 %div to i64
%arrayidx2 = getelementptr inbounds i32, ptr %data, i64 %idxprom1
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%2 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp.i = icmp slt i32 %0, %1
br i1 %cmp.i, label %if.then.i, label %if.else6.i
if.then.i: ; preds = %if.then
%cmp1.i = icmp slt i32 %1, %2
br i1 %cmp1.i, label %median.exit, label %if.else.i
if.else.i: ; preds = %if.then.i
%x.z.i = tail call i32 @llvm.smax.i32(i32 %2, i32 %0)
br label %median.exit
if.else6.i: ; preds = %if.then
%cmp7.i = icmp slt i32 %2, %1
br i1 %cmp7.i, label %median.exit, label %if.else9.i
if.else9.i: ; preds = %if.else6.i
%x.z26.i = tail call i32 @llvm.smin.i32(i32 %0, i32 %2)
br label %median.exit
median.exit: ; preds = %if.then.i, %if.else.i, %if.else6.i, %if.else9.i
%retval.0.i = phi i32 [ %1, %if.then.i ], [ %x.z.i, %if.else.i ], [ %1, %if.else6.i ], [ %x.z26.i, %if.else9.i ]
br label %while.cond
while.cond: ; preds = %if.end, %median.exit
%j.0 = phi i32 [ %r, %median.exit ], [ %dec26, %if.end ]
%i.0 = phi i32 [ %l.tr110, %median.exit ], [ %inc25, %if.end ]
%3 = sext i32 %i.0 to i64
br label %for.cond
for.cond: ; preds = %for.cond, %while.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ %3, %while.cond ]
%arrayidx6 = getelementptr inbounds i32, ptr %data, i64 %indvars.iv
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp slt i32 %4, %retval.0.i
%indvars.iv.next = add i64 %indvars.iv, 1
br i1 %cmp7, label %for.cond, label %for.cond8.preheader, !llvm.loop !18
for.cond8.preheader: ; preds = %for.cond
%arrayidx6.le = getelementptr inbounds i32, ptr %data, i64 %indvars.iv
%5 = trunc i64 %indvars.iv to i32
%6 = sext i32 %j.0 to i64
br label %for.cond8
for.cond8: ; preds = %for.cond8, %for.cond8.preheader
%indvars.iv116 = phi i64 [ %indvars.iv.next117, %for.cond8 ], [ %6, %for.cond8.preheader ]
%arrayidx10 = getelementptr inbounds i32, ptr %data, i64 %indvars.iv116
%7 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp slt i32 %retval.0.i, %7
%indvars.iv.next117 = add i64 %indvars.iv116, -1
br i1 %cmp11, label %for.cond8, label %for.end14, !llvm.loop !19
for.end14: ; preds = %for.cond8
%arrayidx10.le = getelementptr inbounds i32, ptr %data, i64 %indvars.iv116
%8 = trunc i64 %indvars.iv116 to i32
%cmp15.not = icmp slt i32 %5, %8
br i1 %cmp15.not, label %if.end, label %while.end
if.end: ; preds = %for.end14
store i32 %7, ptr %arrayidx6.le, align 4, !tbaa !5
store i32 %4, ptr %arrayidx10.le, align 4, !tbaa !5
%inc25 = add nsw i32 %5, 1
%dec26 = add nsw i32 %8, -1
br label %while.cond
while.end: ; preds = %for.end14
%sub = sub nsw i32 %5, %l.tr110
%cmp27 = icmp slt i32 %sub, 20
br i1 %cmp27, label %if.then28, label %if.else
if.then28: ; preds = %while.end
%cmp29.i = icmp sgt i32 %sub, 1
br i1 %cmp29.i, label %for.body.preheader.i, label %if.end31
for.body.preheader.i: ; preds = %if.then28
%wide.trip.count.i = zext i32 %sub to i64
br label %for.body.i
for.body.i: ; preds = %for.end.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ 1, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.end.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %arrayidx, i64 %indvars.iv.i
%9 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
br label %land.rhs.i
land.rhs.i: ; preds = %for.body5.i, %for.body.i
%indvars.iv31.i = phi i64 [ %indvars.iv.i, %for.body.i ], [ %indvars.iv.next32.i, %for.body5.i ]
%indvars.iv.next32.i = add nsw i64 %indvars.iv31.i, -1
%arrayidx3.i = getelementptr inbounds i32, ptr %arrayidx, i64 %indvars.iv.next32.i
%10 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%cmp4.i = icmp sgt i32 %10, %9
br i1 %cmp4.i, label %for.body5.i, label %for.end.i
for.body5.i: ; preds = %land.rhs.i
%arrayidx10.i = getelementptr inbounds i32, ptr %arrayidx, i64 %indvars.iv31.i
store i32 %10, ptr %arrayidx10.i, align 4, !tbaa !5
%11 = icmp eq i64 %indvars.iv.next32.i, 0
br i1 %11, label %for.end.i, label %land.rhs.i, !llvm.loop !20
for.end.i: ; preds = %for.body5.i, %land.rhs.i
%j.0.lcssa.i = phi i64 [ 0, %for.body5.i ], [ %indvars.iv31.i, %land.rhs.i ]
%sext.i = shl i64 %j.0.lcssa.i, 32
%idxprom11.i = ashr exact i64 %sext.i, 32
%arrayidx12.i = getelementptr inbounds i32, ptr %arrayidx, i64 %idxprom11.i
store i32 %9, ptr %arrayidx12.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %if.end31, label %for.body.i, !llvm.loop !21
if.else: ; preds = %while.end
%sub30 = add nsw i32 %5, -1
tail call void @quickSort(ptr noundef nonnull %data, i32 noundef %l.tr110, i32 noundef %sub30)
br label %if.end31
if.end31: ; preds = %for.end.i, %if.then28, %if.else
%sub32 = sub nsw i32 %r, %8
%cmp33 = icmp slt i32 %sub32, 20
br i1 %cmp33, label %if.then34, label %tailrecurse
if.then34: ; preds = %if.end31
%add.ptr37 = getelementptr inbounds i32, ptr %arrayidx10.le, i64 1
%cmp29.i86 = icmp sgt i32 %sub32, 1
br i1 %cmp29.i86, label %for.body.preheader.i87, label %if.end42
for.body.preheader.i87: ; preds = %if.then34
%wide.trip.count.i88 = zext i32 %sub32 to i64
br label %for.body.i89
for.body.i89: ; preds = %for.end.i97, %for.body.preheader.i87
%indvars.iv.i90 = phi i64 [ 1, %for.body.preheader.i87 ], [ %indvars.iv.next.i102, %for.end.i97 ]
%arrayidx.i91 = getelementptr inbounds i32, ptr %add.ptr37, i64 %indvars.iv.i90
%12 = load i32, ptr %arrayidx.i91, align 4, !tbaa !5
br label %land.rhs.i92
land.rhs.i92: ; preds = %for.body5.i104, %for.body.i89
%indvars.iv31.i93 = phi i64 [ %indvars.iv.i90, %for.body.i89 ], [ %indvars.iv.next32.i94, %for.body5.i104 ]
%arrayidx3.i95 = getelementptr inbounds i32, ptr %arrayidx10.le, i64 %indvars.iv31.i93
%13 = load i32, ptr %arrayidx3.i95, align 4, !tbaa !5
%cmp4.i96 = icmp sgt i32 %13, %12
br i1 %cmp4.i96, label %for.body5.i104, label %for.end.i97
for.body5.i104: ; preds = %land.rhs.i92
%indvars.iv.next32.i94 = add nsw i64 %indvars.iv31.i93, -1
%arrayidx10.i105 = getelementptr inbounds i32, ptr %add.ptr37, i64 %indvars.iv31.i93
store i32 %13, ptr %arrayidx10.i105, align 4, !tbaa !5
%14 = icmp eq i64 %indvars.iv.next32.i94, 0
br i1 %14, label %for.end.i97, label %land.rhs.i92, !llvm.loop !20
for.end.i97: ; preds = %for.body5.i104, %land.rhs.i92
%j.0.lcssa.i98 = phi i64 [ 0, %for.body5.i104 ], [ %indvars.iv31.i93, %land.rhs.i92 ]
%sext.i99 = shl i64 %j.0.lcssa.i98, 32
%idxprom11.i100 = ashr exact i64 %sext.i99, 32
%arrayidx12.i101 = getelementptr inbounds i32, ptr %add.ptr37, i64 %idxprom11.i100
store i32 %12, ptr %arrayidx12.i101, align 4, !tbaa !5
%indvars.iv.next.i102 = add nuw nsw i64 %indvars.iv.i90, 1
%exitcond.not.i103 = icmp eq i64 %indvars.iv.next.i102, %wide.trip.count.i88
br i1 %exitcond.not.i103, label %if.end42, label %for.body.i89, !llvm.loop !21
if.end42: ; preds = %tailrecurse, %for.end.i97, %entry, %if.then34
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @median(i32 noundef %x, i32 noundef %y, i32 noundef %z) local_unnamed_addr #4 {
entry:
%cmp = icmp slt i32 %x, %y
br i1 %cmp, label %if.then, label %if.else6
if.then: ; preds = %entry
%cmp1 = icmp slt i32 %y, %z
br i1 %cmp1, label %return, label %if.else
if.else: ; preds = %if.then
%x.z = tail call i32 @llvm.smax.i32(i32 %z, i32 %x)
br label %return
if.else6: ; preds = %entry
%cmp7 = icmp slt i32 %z, %y
br i1 %cmp7, label %return, label %if.else9
if.else9: ; preds = %if.else6
%x.z26 = tail call i32 @llvm.smin.i32(i32 %x, i32 %z)
br label %return
return: ; preds = %if.else9, %if.else6, %if.else, %if.then
%retval.0 = phi i32 [ %y, %if.then ], [ %x.z, %if.else ], [ %y, %if.else6 ], [ %x.z26, %if.else9 ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @insertionSort(ptr nocapture noundef %data, i32 noundef %n) local_unnamed_addr #5 {
entry:
%cmp29 = icmp sgt i32 %n, 1
br i1 %cmp29, label %for.body.preheader, label %for.end14
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.end
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.end ]
%arrayidx = getelementptr inbounds i32, ptr %data, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
br label %land.rhs
land.rhs: ; preds = %for.body, %for.body5
%indvars.iv31 = phi i64 [ %indvars.iv, %for.body ], [ %indvars.iv.next32, %for.body5 ]
%indvars.iv.next32 = add nsw i64 %indvars.iv31, -1
%arrayidx3 = getelementptr inbounds i32, ptr %data, i64 %indvars.iv.next32
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %1, %0
br i1 %cmp4, label %for.body5, label %for.end
for.body5: ; preds = %land.rhs
%arrayidx10 = getelementptr inbounds i32, ptr %data, i64 %indvars.iv31
store i32 %1, ptr %arrayidx10, align 4, !tbaa !5
%2 = icmp eq i64 %indvars.iv.next32, 0
br i1 %2, label %for.end, label %land.rhs, !llvm.loop !20
for.end: ; preds = %for.body5, %land.rhs
%j.0.lcssa = phi i64 [ 0, %for.body5 ], [ %indvars.iv31, %land.rhs ]
%sext = shl i64 %j.0.lcssa, 32
%idxprom11 = ashr exact i64 %sext, 32
%arrayidx12 = getelementptr inbounds i32, ptr %data, i64 %idxprom11
store i32 %0, ptr %arrayidx12, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end14, label %for.body, !llvm.loop !21
for.end14: ; preds = %for.end, %entry
ret void
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #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 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
|
#include <stdio.h>
#include <stdlib.h>
int compare(const void* a, const void* b){
return(*(int*)a-*(int*)b);
}
int main(void){
int n, i;
scanf("%d", &n);
long long key[n];
for(i=0;i<n;i++){
scanf("%I64d", &key[i]);
}
qsort(key, n, sizeof(long long), compare);
int stolen=0;
for(i=0;i<n;i++){
if(i!=n-1){
if(key[i]+1 != key[i+1]){
stolen+= ((key[i+1] - key[i]) - 1);
}
}
}
printf("%d\n", stolen);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_19017/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_19017/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%I64d\00", align 1
@.str.2 = 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(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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp43 = icmp sgt i32 %3, 0
br i1 %cmp43, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %3 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 i64, ptr %vla, 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
%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.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %5, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv.pre-phi, i64 noundef 8, ptr noundef nonnull @compare) #6
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp345 = icmp sgt i32 %6, 0
br i1 %cmp345, label %for.body5.lr.ph, label %for.end29
for.body5.lr.ph: ; preds = %for.end
%sub = add nsw i32 %6, -1
%7 = zext i32 %sub to i64
%wide.trip.count = zext i32 %6 to i64
br label %for.body5
for.body5: ; preds = %for.body5.lr.ph, %for.inc27
%indvars.iv51 = phi i64 [ 0, %for.body5.lr.ph ], [ %indvars.iv.next52.pre-phi, %for.inc27 ]
%stolen.047 = phi i32 [ 0, %for.body5.lr.ph ], [ %stolen.1, %for.inc27 ]
%cmp6.not = icmp eq i64 %indvars.iv51, %7
br i1 %cmp6.not, label %for.body5.for.inc27_crit_edge, label %if.then
for.body5.for.inc27_crit_edge: ; preds = %for.body5
%.pre55 = add nuw nsw i64 %indvars.iv51, 1
br label %for.inc27
if.then: ; preds = %for.body5
%arrayidx9 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv51
%8 = load i64, ptr %arrayidx9, align 8, !tbaa !11
%add = add nsw i64 %8, 1
%9 = add nuw nsw i64 %indvars.iv51, 1
%arrayidx12 = getelementptr inbounds i64, ptr %vla, i64 %9
%10 = load i64, ptr %arrayidx12, align 8, !tbaa !11
%cmp13.not = icmp eq i64 %add, %10
br i1 %cmp13.not, label %for.inc27, label %if.then15
if.then15: ; preds = %if.then
%11 = xor i64 %8, -1
%sub22 = add i64 %10, %11
%12 = trunc i64 %sub22 to i32
%conv25 = add i32 %stolen.047, %12
br label %for.inc27
for.inc27: ; preds = %for.body5.for.inc27_crit_edge, %if.then15, %if.then
%indvars.iv.next52.pre-phi = phi i64 [ %.pre55, %for.body5.for.inc27_crit_edge ], [ %9, %if.then15 ], [ %9, %if.then ]
%stolen.1 = phi i32 [ %stolen.047, %for.body5.for.inc27_crit_edge ], [ %conv25, %if.then15 ], [ %stolen.047, %if.then ]
%exitcond.not = icmp eq i64 %indvars.iv.next52.pre-phi, %wide.trip.count
br i1 %exitcond.not, label %for.end29, label %for.body5, !llvm.loop !13
for.end29: ; preds = %for.inc27, %for.end
%stolen.0.lcssa = phi i32 [ 0, %for.end ], [ %stolen.1, %for.inc27 ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %stolen.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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
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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind 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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main(){
int i,N,cnt = 0;
int a[100];
scanf("%d",&N);
for(i=0;i<N-1;i++)
scanf("%d ",&a[i]);
scanf("%d",&a[N-1]);
for(i=0;i<N-1;i++){
if(a[i] == a[i+1]){
cnt++;
i++;
}
}
printf("%d",cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_190212/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_190212/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%a = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 1
br i1 %cmp31, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%sub30 = add nsw i32 %0, -1
%.pre = sext i32 %sub30 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 [100 x i32], 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
%1 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %1, -1
%2 = sext i32 %sub 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
%idxprom3.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %2, %for.body ]
%arrayidx4 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom3.pre-phi
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx4)
%3 = load i32, ptr %N, align 4, !tbaa !5
%sub7 = add nsw i32 %3, -1
%cmp833 = icmp sgt i32 %3, 1
br i1 %cmp833, label %for.body9, label %for.end19
for.body9: ; preds = %for.end, %for.body9
%cnt.035 = phi i32 [ %spec.select29, %for.body9 ], [ 0, %for.end ]
%i.134 = phi i32 [ %inc18, %for.body9 ], [ 0, %for.end ]
%idxprom10 = sext i32 %i.134 to i64
%arrayidx11 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom10
%4 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%add = add nsw i32 %i.134, 1
%idxprom12 = sext i32 %add to i64
%arrayidx13 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom12
%5 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%cmp14 = icmp eq i32 %4, %5
%spec.select = select i1 %cmp14, i32 %add, i32 %i.134
%inc15 = zext i1 %cmp14 to i32
%spec.select29 = add nuw nsw i32 %cnt.035, %inc15
%inc18 = add nsw i32 %spec.select, 1
%cmp8 = icmp slt i32 %inc18, %sub7
br i1 %cmp8, label %for.body9, label %for.end19, !llvm.loop !11
for.end19: ; preds = %for.body9, %for.end
%cnt.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select29, %for.body9 ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))
uint64_t a[100];
static int compare_int(const void *a, const void *b) {
return (int)(*(int64_t *)a - *(int64_t *)b);
}
int main(void) {
uint64_t N;
uint32_t count = 0;
scanf("%"PRIu64"\n", &N);
for (uint64_t idx = 0; idx < N; idx++) {
scanf(idx != N - 1 ? "%"PRIu64" " : "%"PRIu64, &(a[idx]));
if (idx != 0) {
if (a[idx] == a[idx - 1]) {
count++;
a[idx] = 100 + count;
}
}
}
printf("%"PRIu32, count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_190263/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_190263/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lu\0A\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lu \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%lu\00", align 1
@a = dso_local global [100 x i64] zeroinitializer, align 16
@.str.3 = private unnamed_addr constant [3 x i8] c"%u\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !5
%cmp22.not = icmp eq i64 %0, 0
br i1 %cmp22.not, label %for.cond.cleanup, label %for.inc.peel
for.inc.peel: ; preds = %entry
%cmp1.not.peel = icmp eq i64 %0, 1
%cond.peel = select i1 %cmp1.not.peel, ptr @.str.2, ptr @.str.1
%call2.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull %cond.peel, ptr noundef nonnull @a)
%1 = load i64, ptr %N, align 8, !tbaa !5
%cmp.peel = icmp ugt i64 %1, 1
br i1 %cmp.peel, label %if.then, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.inc, %for.inc.peel, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ 0, %for.inc.peel ], [ %count.1, %for.inc ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #3
ret i32 0
if.then: ; preds = %for.inc.peel, %for.inc
%2 = phi i64 [ %5, %for.inc ], [ %1, %for.inc.peel ]
%idx.024 = phi i64 [ %inc11, %for.inc ], [ 1, %for.inc.peel ]
%count.023 = phi i32 [ %count.1, %for.inc ], [ 0, %for.inc.peel ]
%sub = add i64 %2, -1
%cmp1.not = icmp eq i64 %idx.024, %sub
%cond = select i1 %cmp1.not, ptr @.str.2, ptr @.str.1
%arrayidx = getelementptr inbounds [100 x i64], ptr @a, i64 0, i64 %idx.024
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull %cond, ptr noundef nonnull %arrayidx)
%3 = load i64, ptr %arrayidx, align 8, !tbaa !5
%sub5 = add i64 %idx.024, -1
%arrayidx6 = getelementptr inbounds [100 x i64], ptr @a, i64 0, i64 %sub5
%4 = load i64, ptr %arrayidx6, align 8, !tbaa !5
%cmp7 = icmp eq i64 %3, %4
br i1 %cmp7, label %if.then8, label %for.inc
if.then8: ; preds = %if.then
%inc = add i32 %count.023, 1
%add = add i32 %count.023, 101
%conv = zext i32 %add to i64
store i64 %conv, ptr %arrayidx, align 8, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then8, %if.then
%count.1 = phi i32 [ %inc, %if.then8 ], [ %count.023, %if.then ]
%inc11 = add nuw i64 %idx.024, 1
%5 = load i64, ptr %N, align 8, !tbaa !5
%cmp = icmp ult i64 %inc11, %5
br i1 %cmp, label %if.then, 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
#include <stdlib.h>
int cmp(const void* x, const void* y) {
int a = *(const int *)x, b = *(const int*)y;
return a < b ? -1 : a > b;
}
int N;
int a[114514];
int tomatuharuka;
int igutiyuka[114514];
int igarasihiromi[114514];
int futigamimai(int fuzitasaki) {
int l = 0, r = tomatuharuka - 1;
while (l <= r) {
int m = l + (r - l) / 2;
if (igutiyuka[m] == fuzitasaki) return m;
else if (igutiyuka[m] < fuzitasaki) l = m + 1;
else r = m - 1;
}
exit(2);
return 0;
}
int main(void) {
int i;
int gourikiayame = 0;
if (scanf("%d", &N) != 1) return 1;
for (i = 0; i < N; i++) {
if (scanf("%d", &a[i]) != 1) return 1;
igutiyuka[i] = a[i];
}
qsort(igutiyuka, N, sizeof(*igutiyuka), cmp);
tomatuharuka = 1;
for (i = 1; i < N; i++) {
if (igutiyuka[tomatuharuka - 1] != igutiyuka[i]) {
igutiyuka[tomatuharuka++] = igutiyuka[i];
}
}
for (i = 0; i < N; i++) {
igarasihiromi[futigamimai(a[i])]++;
}
for (i = 0; i < tomatuharuka; i++) {
if (igarasihiromi[i] != igutiyuka[i]) {
if (igarasihiromi[i] > igutiyuka[i]) {
gourikiayame += igarasihiromi[i] - igutiyuka[i];
} else {
gourikiayame += igarasihiromi[i];
}
}
}
printf("%d\n", gourikiayame);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_190313/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_190313/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@tomatuharuka = dso_local local_unnamed_addr global i32 0, align 4
@igutiyuka = dso_local global [114514 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@N = dso_local global i32 0, align 4
@a = dso_local global [114514 x i32] zeroinitializer, align 16
@igarasihiromi = dso_local local_unnamed_addr global [114514 x i32] zeroinitializer, align 16
@.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 @cmp(ptr nocapture noundef readonly %x, ptr nocapture noundef readonly %y) #0 {
entry:
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp sgt i32 %0, %1
%conv = zext i1 %cmp1 to i32
%cond = select i1 %cmp, i32 -1, i32 %conv
ret i32 %cond
}
; Function Attrs: nounwind uwtable
define dso_local i32 @futigamimai(i32 noundef %fuzitasaki) local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @tomatuharuka, align 4, !tbaa !5
%cmp.not25 = icmp slt i32 %0, 1
br i1 %cmp.not25, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%sub = add nsw i32 %0, -1
br label %while.body
while.body: ; preds = %while.body.preheader, %cleanup
%r.027 = phi i32 [ %r.1, %cleanup ], [ %sub, %while.body.preheader ]
%l.026 = phi i32 [ %l.1, %cleanup ], [ 0, %while.body.preheader ]
%sub1 = sub nsw i32 %r.027, %l.026
%div = sdiv i32 %sub1, 2
%add = add nsw i32 %div, %l.026
%idxprom = sext i32 %add to i64
%arrayidx = getelementptr inbounds [114514 x i32], ptr @igutiyuka, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp2.not = icmp eq i32 %1, %fuzitasaki
br i1 %cmp2.not, label %cleanup11, label %cleanup
cleanup: ; preds = %while.body
%cmp5 = icmp slt i32 %1, %fuzitasaki
%add7 = add nsw i32 %add, 1
%sub9 = add nsw i32 %add, -1
%l.1 = select i1 %cmp5, i32 %add7, i32 %l.026
%r.1 = select i1 %cmp5, i32 %r.027, i32 %sub9
%cmp.not = icmp sgt i32 %l.1, %r.1
br i1 %cmp.not, label %while.end, label %while.body
while.end: ; preds = %cleanup, %entry
tail call void @exit(i32 noundef 2) #5
unreachable
cleanup11: ; preds = %while.body
ret i32 %add
}
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N)
%cmp.not = icmp eq i32 %call, 1
br i1 %cmp.not, label %for.cond.preheader, label %cleanup
for.cond.preheader: ; preds = %entry
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp1105 = icmp sgt i32 %0, 0
br i1 %cmp1105, label %for.body, label %for.cond.preheader.for.end_crit_edge
for.cond.preheader.for.end_crit_edge: ; preds = %for.cond.preheader
%.pre = sext i32 %0 to i64
br label %for.end
for.body: ; preds = %for.cond.preheader, %if.end5
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end5 ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [114514 x i32], ptr @a, i64 0, i64 %indvars.iv
%call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%cmp3.not = icmp eq i32 %call2, 1
br i1 %cmp3.not, label %if.end5, label %cleanup
if.end5: ; preds = %for.body
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx9 = getelementptr inbounds [114514 x i32], ptr @igutiyuka, i64 0, i64 %indvars.iv
store i32 %1, ptr %arrayidx9, align 4, !tbaa !5
%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 = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %if.end5, %for.cond.preheader.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %for.cond.preheader.for.end_crit_edge ], [ %3, %if.end5 ]
tail call void @qsort(ptr noundef nonnull @igutiyuka, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @cmp) #6
store i32 1, ptr @tomatuharuka, align 4, !tbaa !5
%4 = load i32, ptr @N, align 4, !tbaa !5
%cmp11109 = icmp sgt i32 %4, 1
br i1 %cmp11109, label %for.body13.preheader, label %for.cond30.preheader.thread
for.body13.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %4 to i64
br label %for.body13
for.cond30.preheader: ; preds = %for.inc27
%cmp31113 = icmp sgt i32 %4, 0
br i1 %cmp31113, label %for.body33.lr.ph, label %for.cond43.preheader
for.cond30.preheader.thread: ; preds = %for.end
%cmp31113134 = icmp eq i32 %4, 1
br i1 %cmp31113134, label %for.body33.preheader, label %for.body46.preheader
for.body33.lr.ph: ; preds = %for.cond30.preheader
%cmp.not25.i = icmp slt i32 %inc23107, 1
%sub.i = add nsw i32 %inc23107, -1
br i1 %cmp.not25.i, label %while.end.i, label %for.body33.preheader
for.body33.preheader: ; preds = %for.cond30.preheader.thread, %for.body33.lr.ph
%sub.i137 = phi i32 [ %sub.i, %for.body33.lr.ph ], [ 0, %for.cond30.preheader.thread ]
%5 = phi i32 [ %inc23107, %for.body33.lr.ph ], [ 1, %for.cond30.preheader.thread ]
%wide.trip.count127 = zext i32 %4 to i64
br label %for.body33
for.body13: ; preds = %for.body13.preheader, %for.inc27
%indvars.iv121 = phi i64 [ 1, %for.body13.preheader ], [ %indvars.iv.next122, %for.inc27 ]
%inc23108110 = phi i32 [ 1, %for.body13.preheader ], [ %inc23107, %for.inc27 ]
%sub = add nsw i32 %inc23108110, -1
%idxprom14 = sext i32 %sub to i64
%arrayidx15 = getelementptr inbounds [114514 x i32], ptr @igutiyuka, i64 0, i64 %idxprom14
%6 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%arrayidx17 = getelementptr inbounds [114514 x i32], ptr @igutiyuka, i64 0, i64 %indvars.iv121
%7 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%cmp18.not = icmp eq i32 %6, %7
br i1 %cmp18.not, label %for.inc27, label %if.then20
if.then20: ; preds = %for.body13
%inc23 = add nsw i32 %inc23108110, 1
store i32 %inc23, ptr @tomatuharuka, align 4, !tbaa !5
%idxprom24 = sext i32 %inc23108110 to i64
%arrayidx25 = getelementptr inbounds [114514 x i32], ptr @igutiyuka, i64 0, i64 %idxprom24
store i32 %7, ptr %arrayidx25, align 4, !tbaa !5
br label %for.inc27
for.inc27: ; preds = %for.body13, %if.then20
%inc23107 = phi i32 [ %inc23108110, %for.body13 ], [ %inc23, %if.then20 ]
%indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1
%exitcond.not = icmp eq i64 %indvars.iv.next122, %wide.trip.count
br i1 %exitcond.not, label %for.cond30.preheader, label %for.body13, !llvm.loop !11
for.cond43.preheader: ; preds = %for.cond30.preheader
%cmp44115 = icmp sgt i32 %inc23107, 0
br i1 %cmp44115, label %for.body46.preheader, label %for.end73
for.body46.preheader: ; preds = %futigamimai.exit, %for.cond30.preheader.thread, %for.cond43.preheader
%8 = phi i32 [ %inc23107, %for.cond43.preheader ], [ 1, %for.cond30.preheader.thread ], [ %5, %futigamimai.exit ]
%wide.trip.count132 = zext i32 %8 to i64
%xtraiter = and i64 %wide.trip.count132, 1
%9 = icmp eq i32 %8, 1
br i1 %9, label %for.end73.loopexit.unr-lcssa, label %for.body46.preheader.new
for.body46.preheader.new: ; preds = %for.body46.preheader
%unroll_iter = and i64 %wide.trip.count132, 4294967294
br label %for.body46
for.body33: ; preds = %for.body33.preheader, %futigamimai.exit
%indvars.iv124 = phi i64 [ 0, %for.body33.preheader ], [ %indvars.iv.next125, %futigamimai.exit ]
%arrayidx35 = getelementptr inbounds [114514 x i32], ptr @a, i64 0, i64 %indvars.iv124
%10 = load i32, ptr %arrayidx35, align 4, !tbaa !5
br label %while.body.i
while.body.i: ; preds = %cleanup.i, %for.body33
%r.027.i = phi i32 [ %r.1.i, %cleanup.i ], [ %sub.i137, %for.body33 ]
%l.026.i = phi i32 [ %l.1.i, %cleanup.i ], [ 0, %for.body33 ]
%sub1.i = sub nsw i32 %r.027.i, %l.026.i
%div.i = sdiv i32 %sub1.i, 2
%add.i = add nsw i32 %div.i, %l.026.i
%idxprom.i = sext i32 %add.i to i64
%arrayidx.i = getelementptr inbounds [114514 x i32], ptr @igutiyuka, i64 0, i64 %idxprom.i
%11 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp2.not.i = icmp eq i32 %11, %10
br i1 %cmp2.not.i, label %futigamimai.exit, label %cleanup.i
cleanup.i: ; preds = %while.body.i
%cmp5.i = icmp slt i32 %11, %10
%add7.i = add nsw i32 %add.i, 1
%sub9.i = add nsw i32 %add.i, -1
%l.1.i = select i1 %cmp5.i, i32 %add7.i, i32 %l.026.i
%r.1.i = select i1 %cmp5.i, i32 %r.027.i, i32 %sub9.i
%cmp.not.i = icmp sgt i32 %l.1.i, %r.1.i
br i1 %cmp.not.i, label %while.end.i, label %while.body.i
while.end.i: ; preds = %cleanup.i, %for.body33.lr.ph
tail call void @exit(i32 noundef 2) #5
unreachable
futigamimai.exit: ; preds = %while.body.i
%arrayidx38 = getelementptr inbounds [114514 x i32], ptr @igarasihiromi, i64 0, i64 %idxprom.i
%12 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%inc39 = add nsw i32 %12, 1
store i32 %inc39, ptr %arrayidx38, align 4, !tbaa !5
%indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
%exitcond128.not = icmp eq i64 %indvars.iv.next125, %wide.trip.count127
br i1 %exitcond128.not, label %for.body46.preheader, label %for.body33, !llvm.loop !12
for.body46: ; preds = %for.body46, %for.body46.preheader.new
%indvars.iv129 = phi i64 [ 0, %for.body46.preheader.new ], [ %indvars.iv.next130.1, %for.body46 ]
%gourikiayame.0117 = phi i32 [ 0, %for.body46.preheader.new ], [ %gourikiayame.1.1, %for.body46 ]
%niter = phi i64 [ 0, %for.body46.preheader.new ], [ %niter.next.1, %for.body46 ]
%arrayidx48 = getelementptr inbounds [114514 x i32], ptr @igarasihiromi, i64 0, i64 %indvars.iv129
%13 = load i32, ptr %arrayidx48, align 8, !tbaa !5
%arrayidx50 = getelementptr inbounds [114514 x i32], ptr @igutiyuka, i64 0, i64 %indvars.iv129
%14 = load i32, ptr %arrayidx50, align 8, !tbaa !5
%cmp51.not = icmp eq i32 %13, %14
%cmp58 = icmp sgt i32 %13, %14
%sub65 = add i32 %13, %gourikiayame.0117
%add = select i1 %cmp58, i32 %14, i32 0
%spec.select = sub i32 %sub65, %add
%gourikiayame.1 = select i1 %cmp51.not, i32 %gourikiayame.0117, i32 %spec.select
%indvars.iv.next130 = or i64 %indvars.iv129, 1
%arrayidx48.1 = getelementptr inbounds [114514 x i32], ptr @igarasihiromi, i64 0, i64 %indvars.iv.next130
%15 = load i32, ptr %arrayidx48.1, align 4, !tbaa !5
%arrayidx50.1 = getelementptr inbounds [114514 x i32], ptr @igutiyuka, i64 0, i64 %indvars.iv.next130
%16 = load i32, ptr %arrayidx50.1, align 4, !tbaa !5
%cmp51.not.1 = icmp eq i32 %15, %16
%cmp58.1 = icmp sgt i32 %15, %16
%sub65.1 = add i32 %15, %gourikiayame.1
%add.1 = select i1 %cmp58.1, i32 %16, i32 0
%spec.select.1 = sub i32 %sub65.1, %add.1
%gourikiayame.1.1 = select i1 %cmp51.not.1, i32 %gourikiayame.1, i32 %spec.select.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.end73.loopexit.unr-lcssa, label %for.body46, !llvm.loop !13
for.end73.loopexit.unr-lcssa: ; preds = %for.body46, %for.body46.preheader
%gourikiayame.1.lcssa.ph = phi i32 [ undef, %for.body46.preheader ], [ %gourikiayame.1.1, %for.body46 ]
%indvars.iv129.unr = phi i64 [ 0, %for.body46.preheader ], [ %indvars.iv.next130.1, %for.body46 ]
%gourikiayame.0117.unr = phi i32 [ 0, %for.body46.preheader ], [ %gourikiayame.1.1, %for.body46 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end73, label %for.body46.epil
for.body46.epil: ; preds = %for.end73.loopexit.unr-lcssa
%arrayidx48.epil = getelementptr inbounds [114514 x i32], ptr @igarasihiromi, i64 0, i64 %indvars.iv129.unr
%17 = load i32, ptr %arrayidx48.epil, align 4, !tbaa !5
%arrayidx50.epil = getelementptr inbounds [114514 x i32], ptr @igutiyuka, i64 0, i64 %indvars.iv129.unr
%18 = load i32, ptr %arrayidx50.epil, align 4, !tbaa !5
%cmp51.not.epil = icmp eq i32 %17, %18
%cmp58.epil = icmp sgt i32 %17, %18
%sub65.epil = add i32 %17, %gourikiayame.0117.unr
%add.epil = select i1 %cmp58.epil, i32 %18, i32 0
%spec.select.epil = sub i32 %sub65.epil, %add.epil
%gourikiayame.1.epil = select i1 %cmp51.not.epil, i32 %gourikiayame.0117.unr, i32 %spec.select.epil
br label %for.end73
for.end73: ; preds = %for.body46.epil, %for.end73.loopexit.unr-lcssa, %for.cond43.preheader
%gourikiayame.0.lcssa = phi i32 [ 0, %for.cond43.preheader ], [ %gourikiayame.1.lcssa.ph, %for.end73.loopexit.unr-lcssa ], [ %gourikiayame.1.epil, %for.body46.epil ]
%call74 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %gourikiayame.0.lcssa)
br label %cleanup
cleanup: ; preds = %for.body, %entry, %for.end73
%retval.0 = phi i32 [ 0, %for.end73 ], [ 1, %entry ], [ 1, %for.body ]
ret i32 %retval.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(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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { noreturn 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>
#define L 100001
int main(){
int N, min_sub = 0;
int i, j, k, a, count = 0;
int v[L] = {0};
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d",&a);
k = N;
if(k >= L) k = 100000;
if(k < a)
min_sub++;
else
v[a] += 1;
}
for(i=1;i<=k;i++){
if(v[i] > i)
min_sub += v[i] - i;
else if(v[i] < i)
min_sub += v[i];
}
printf("%d\n",min_sub);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_190357/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_190357/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%a = alloca i32, align 4
%v = alloca [100001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %v) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400004) %v, i8 0, i64 400004, 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
%cmp47 = icmp sgt i32 %0, 0
br i1 %cmp47, label %for.body, label %for.body9.preheader
for.cond7.preheader: ; preds = %for.inc
%cmp8.not51 = icmp slt i32 %22, 1
br i1 %cmp8.not51, label %for.end29, label %for.body9.preheader
for.body9.preheader: ; preds = %entry, %for.cond7.preheader
%min_sub.0.lcssa60 = phi i32 [ %min_sub.1, %for.cond7.preheader ], [ 0, %entry ]
%k.0.lcssa59 = phi i32 [ %spec.store.select, %for.cond7.preheader ], [ undef, %entry ]
%1 = add nuw nsw i32 %k.0.lcssa59, 1
%wide.trip.count = zext i32 %1 to i64
%2 = zext i32 %k.0.lcssa59 to i64
%min.iters.check = icmp ult i32 %k.0.lcssa59, 8
br i1 %min.iters.check, label %for.body9.preheader68, label %vector.ph
vector.ph: ; preds = %for.body9.preheader
%n.vec = and i64 %2, 4294967288
%ind.end = or i64 %n.vec, 1
%3 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %min_sub.0.lcssa60, i64 0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 1, i64 2, i64 3, i64 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %3, %vector.ph ], [ %18, %vector.body ]
%vec.phi62 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %19, %vector.body ]
%vec.ind63 = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next66, %vector.body ]
%step.add = add <4 x i64> %vec.ind, <i64 4, i64 4, i64 4, i64 4>
%step.add64 = add <4 x i32> %vec.ind63, <i32 4, i32 4, i32 4, i32 4>
%offset.idx = or i64 %index, 1
%4 = getelementptr inbounds [100001 x i32], ptr %v, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load67 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = sext <4 x i32> %wide.load to <4 x i64>
%7 = sext <4 x i32> %wide.load67 to <4 x i64>
%8 = icmp slt <4 x i64> %vec.ind, %6
%9 = icmp slt <4 x i64> %step.add, %7
%10 = sub nsw <4 x i32> %wide.load, %vec.ind63
%11 = sub nsw <4 x i32> %wide.load67, %step.add64
%12 = icmp sgt <4 x i64> %vec.ind, %6
%13 = icmp sgt <4 x i64> %step.add, %7
%14 = select <4 x i1> %12, <4 x i32> %wide.load, <4 x i32> zeroinitializer
%15 = select <4 x i1> %13, <4 x i32> %wide.load67, <4 x i32> zeroinitializer
%16 = select <4 x i1> %8, <4 x i32> %10, <4 x i32> %14
%17 = select <4 x i1> %9, <4 x i32> %11, <4 x i32> %15
%18 = add <4 x i32> %16, %vec.phi
%19 = add <4 x i32> %17, %vec.phi62
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%vec.ind.next66 = add <4 x i32> %vec.ind63, <i32 8, i32 8, i32 8, i32 8>
%20 = icmp eq i64 %index.next, %n.vec
br i1 %20, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %19, %18
%21 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %2
br i1 %cmp.n, label %for.end29, label %for.body9.preheader68
for.body9.preheader68: ; preds = %for.body9.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 1, %for.body9.preheader ], [ %ind.end, %middle.block ]
%min_sub.253.ph = phi i32 [ %min_sub.0.lcssa60, %for.body9.preheader ], [ %21, %middle.block ]
br label %for.body9
for.body: ; preds = %entry, %for.inc
%min_sub.049 = phi i32 [ %min_sub.1, %for.inc ], [ 0, %entry ]
%i.048 = phi i32 [ %inc6, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%22 = load i32, ptr %N, align 4, !tbaa !5
%spec.store.select = call i32 @llvm.smin.i32(i32 %22, i32 100000)
%23 = load i32, ptr %a, align 4, !tbaa !5
%cmp3 = icmp slt i32 %spec.store.select, %23
br i1 %cmp3, label %if.then4, label %if.else
if.then4: ; preds = %for.body
%inc = add nsw i32 %min_sub.049, 1
br label %for.inc
if.else: ; preds = %for.body
%idxprom = sext i32 %23 to i64
%arrayidx = getelementptr inbounds [100001 x i32], ptr %v, i64 0, i64 %idxprom
%24 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %24, 1
store i32 %add, ptr %arrayidx, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then4, %if.else
%min_sub.1 = phi i32 [ %inc, %if.then4 ], [ %min_sub.049, %if.else ]
%inc6 = add nuw nsw i32 %i.048, 1
%cmp = icmp slt i32 %inc6, %22
br i1 %cmp, label %for.body, label %for.cond7.preheader, !llvm.loop !13
for.body9: ; preds = %for.body9.preheader68, %for.body9
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body9 ], [ %indvars.iv.ph, %for.body9.preheader68 ]
%min_sub.253 = phi i32 [ %min_sub.3, %for.body9 ], [ %min_sub.253.ph, %for.body9.preheader68 ]
%arrayidx11 = getelementptr inbounds [100001 x i32], ptr %v, i64 0, i64 %indvars.iv
%25 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%26 = sext i32 %25 to i64
%cmp12 = icmp slt i64 %indvars.iv, %26
%27 = trunc i64 %indvars.iv to i32
%sub = sub nsw i32 %25, %27
%cmp20 = icmp sgt i64 %indvars.iv, %26
%add24 = select i1 %cmp20, i32 %25, i32 0
%sub.pn = select i1 %cmp12, i32 %sub, i32 %add24
%min_sub.3 = add nsw i32 %sub.pn, %min_sub.253
%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.end29, label %for.body9, !llvm.loop !14
for.end29: ; preds = %for.body9, %middle.block, %for.cond7.preheader
%min_sub.2.lcssa = phi i32 [ %min_sub.1, %for.cond7.preheader ], [ %21, %middle.block ], [ %min_sub.3, %for.body9 ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min_sub.2.lcssa)
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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>
#define maxn 40001
int n,m,k,t;
typedef struct
{
int x;
int y;
}waste;
waste w[1001];
int count[maxn];
int main()
{
scanf("%d%d%d%d",&n,&m,&k,&t);
int i,x,y,j;
for(i=1;i<=k;i++)
{
scanf("%d%d",&w[i].x,&w[i].y);
count[w[i].x]++;
}
int prev,cells,temp,flag=0;
for(i=1;i<=t;i++)
{
prev=0;cells=-1,flag=0;
scanf("%d%d",&x,&y);
for(j=1;j<x;j++)
{
prev+=count[j];
}
temp=0;
for(temp=1;temp<=k;temp++)
if(w[temp].x==x && w[temp].y==y)
{
printf("Waste\n");
flag=1;
break;
}
else if(w[temp].x==x && w[temp].y<y)
prev++;
cells=(x-1)*m+y-prev;
//printf("%d\n",cells);
if(flag==0)
{
if(cells%3==0)
printf("Grapes\n");
else if(cells%3==1)
printf("Carrots\n");
else printf("Kiwis\n");
//printf("%d %d DOne\n",x,y);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_19040/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_19040/source.c"
target datalayout = "e-m:e-p270: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.waste = type { i32, i32 }
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@n = dso_local global i32 0, align 4
@m = dso_local global i32 0, align 4
@k = dso_local global i32 0, align 4
@t = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@w = dso_local global [1001 x %struct.waste] zeroinitializer, align 16
@count = dso_local local_unnamed_addr global [40001 x i32] zeroinitializer, align 16
@str = private unnamed_addr constant [6 x i8] c"Waste\00", align 1
@str.6 = private unnamed_addr constant [6 x i8] c"Kiwis\00", align 1
@str.7 = private unnamed_addr constant [8 x i8] c"Carrots\00", align 1
@str.8 = private unnamed_addr constant [7 x i8] c"Grapes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @k, ptr noundef nonnull @t)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #5
%0 = load i32, ptr @k, align 4, !tbaa !5
%cmp.not91 = icmp slt i32 %0, 1
br i1 %cmp.not91, label %for.cond12.preheader, label %for.body
for.cond12.preheader: ; preds = %for.body, %entry
%1 = load i32, ptr @t, align 4, !tbaa !5
%cmp13.not101 = icmp slt i32 %1, 1
br i1 %cmp13.not101, label %for.end70, label %for.body14
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [1001 x %struct.waste], ptr @w, i64 0, i64 %indvars.iv
%y4 = getelementptr inbounds [1001 x %struct.waste], ptr @w, i64 0, i64 %indvars.iv, i32 1
%call5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %y4)
%2 = load i32, ptr %arrayidx, align 8, !tbaa !9
%idxprom9 = sext i32 %2 to i64
%arrayidx10 = getelementptr inbounds [40001 x i32], ptr @count, i64 0, i64 %idxprom9
%3 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%inc = add nsw i32 %3, 1
store i32 %inc, ptr %arrayidx10, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr @k, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %5
br i1 %cmp.not.not, label %for.body, label %for.cond12.preheader, !llvm.loop !11
for.body14: ; preds = %for.cond12.preheader, %for.inc68
%i.1102 = phi i32 [ %inc69, %for.inc68 ], [ 1, %for.cond12.preheader ]
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%6 = load i32, ptr %x, align 4, !tbaa !5
%cmp1793 = icmp sgt i32 %6, 1
br i1 %cmp1793, label %for.body18.preheader, label %for.cond24.preheader
for.body18.preheader: ; preds = %for.body14
%wide.trip.count = zext i32 %6 to i64
%7 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %6, 9
br i1 %min.iters.check, label %for.body18.preheader116, label %vector.ph
vector.ph: ; preds = %for.body18.preheader
%n.vec = and i64 %7, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%vec.phi114 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%offset.idx = or i64 %index, 1
%8 = getelementptr inbounds [40001 x i32], ptr @count, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load115 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = add <4 x i32> %wide.load, %vec.phi
%11 = add <4 x i32> %wide.load115, %vec.phi114
%index.next = add nuw i64 %index, 8
%12 = icmp eq i64 %index.next, %n.vec
br i1 %12, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %11, %10
%13 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %7, %n.vec
br i1 %cmp.n, label %for.cond24.preheader, label %for.body18.preheader116
for.body18.preheader116: ; preds = %for.body18.preheader, %middle.block
%indvars.iv104.ph = phi i64 [ 1, %for.body18.preheader ], [ %ind.end, %middle.block ]
%prev.095.ph = phi i32 [ 0, %for.body18.preheader ], [ %13, %middle.block ]
br label %for.body18
for.cond24.preheader: ; preds = %for.body18, %middle.block, %for.body14
%prev.0.lcssa = phi i32 [ 0, %for.body14 ], [ %13, %middle.block ], [ %add, %for.body18 ]
%14 = load i32, ptr @k, align 4, !tbaa !5
%cmp25.not97 = icmp slt i32 %14, 1
%.pre = load i32, ptr %y, align 4
br i1 %cmp25.not97, label %if.then54, label %for.body26.lr.ph
for.body26.lr.ph: ; preds = %for.cond24.preheader
%15 = add nuw i32 %14, 1
%wide.trip.count110 = zext i32 %15 to i64
br label %for.body26
for.body18: ; preds = %for.body18.preheader116, %for.body18
%indvars.iv104 = phi i64 [ %indvars.iv.next105, %for.body18 ], [ %indvars.iv104.ph, %for.body18.preheader116 ]
%prev.095 = phi i32 [ %add, %for.body18 ], [ %prev.095.ph, %for.body18.preheader116 ]
%arrayidx20 = getelementptr inbounds [40001 x i32], ptr @count, i64 0, i64 %indvars.iv104
%16 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%add = add nsw i32 %16, %prev.095
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%exitcond.not = icmp eq i64 %indvars.iv.next105, %wide.trip.count
br i1 %exitcond.not, label %for.cond24.preheader, label %for.body18, !llvm.loop !16
for.body26: ; preds = %for.body26.lr.ph, %for.inc48
%indvars.iv107 = phi i64 [ 1, %for.body26.lr.ph ], [ %indvars.iv.next108, %for.inc48 ]
%prev.198 = phi i32 [ %prev.0.lcssa, %for.body26.lr.ph ], [ %prev.2, %for.inc48 ]
%arrayidx28 = getelementptr inbounds [1001 x %struct.waste], ptr @w, i64 0, i64 %indvars.iv107
%17 = load i32, ptr %arrayidx28, align 8, !tbaa !9
%cmp30 = icmp eq i32 %17, %6
br i1 %cmp30, label %land.lhs.true, label %for.inc48
land.lhs.true: ; preds = %for.body26
%y33 = getelementptr inbounds [1001 x %struct.waste], ptr @w, i64 0, i64 %indvars.iv107, i32 1
%18 = load i32, ptr %y33, align 4, !tbaa !17
%cmp34 = icmp eq i32 %18, %.pre
br i1 %cmp34, label %for.inc68, label %land.lhs.true40
land.lhs.true40: ; preds = %land.lhs.true
%cmp44 = icmp slt i32 %18, %.pre
%inc46 = zext i1 %cmp44 to i32
%spec.select = add nsw i32 %prev.198, %inc46
br label %for.inc48
for.inc48: ; preds = %for.body26, %land.lhs.true40
%prev.2 = phi i32 [ %spec.select, %land.lhs.true40 ], [ %prev.198, %for.body26 ]
%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 %if.then54, label %for.body26, !llvm.loop !18
if.then54: ; preds = %for.inc48, %for.cond24.preheader
%prev.1.lcssa = phi i32 [ %prev.0.lcssa, %for.cond24.preheader ], [ %prev.2, %for.inc48 ]
%sub = add nsw i32 %6, -1
%19 = load i32, ptr @m, align 4, !tbaa !5
%mul = mul nsw i32 %sub, %19
%add51 = sub i32 %.pre, %prev.1.lcssa
%sub52 = add i32 %add51, %mul
%rem = srem i32 %sub52, 3
%switch.selectcmp = icmp eq i32 %rem, 1
%switch.select = select i1 %switch.selectcmp, ptr @str.7, ptr @str.6
%switch.selectcmp112 = icmp eq i32 %rem, 0
%switch.select113 = select i1 %switch.selectcmp112, ptr @str.8, ptr %switch.select
br label %for.inc68
for.inc68: ; preds = %land.lhs.true, %if.then54
%str.sink = phi ptr [ %switch.select113, %if.then54 ], [ @str, %land.lhs.true ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%inc69 = add nuw nsw i32 %i.1102, 1
%20 = load i32, ptr @t, align 4, !tbaa !5
%cmp13.not.not = icmp slt i32 %i.1102, %20
br i1 %cmp13.not.not, label %for.body14, label %for.end70, !llvm.loop !19
for.end70: ; preds = %for.inc68, %for.cond12.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; 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
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-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 }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"", !6, i64 0, !6, i64 4}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !12, !15, !14}
!17 = !{!10, !6, i64 4}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
|
#include<stdio.h>
void main()
{
int a,b,s,k;
scanf("%d %d",&a,&b);
s=a+b;
k=s/2;
if((a%2==1&&b%2==1)||(a%2==0&&b%2==0))
printf("%d",k);
else
printf("IMPOSSIBLE");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_190450/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_190450/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d\00", align 1
@.str.2 = private unnamed_addr constant [11 x i8] c"IMPOSSIBLE\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @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
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%div = sdiv i32 %add, 2
%2 = and i32 %0, -2147483647
%cmp = icmp eq i32 %2, 1
%3 = and i32 %1, -2147483647
%cmp2 = icmp eq i32 %3, 1
%or.cond = select i1 %cmp, i1 %cmp2, i1 false
br i1 %or.cond, label %if.then, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%4 = and i32 %0, 1
%cmp4 = icmp eq i32 %4, 0
%5 = and i32 %1, 1
%cmp7 = icmp eq i32 %5, 0
%or.cond10 = select i1 %cmp4, i1 %cmp7, i1 false
br i1 %or.cond10, label %if.then, label %if.else
if.then: ; preds = %lor.lhs.false, %entry
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
br label %if.end
if.else: ; preds = %lor.lhs.false
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end
if.end: ; preds = %if.else, %if.then
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 void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int a, b, k, i, j;
scanf("%d %d", &a, &b);
for (k = 0; k < 1000000000; k++) {
i = abs(a - k);
j = abs(k - b);
if (i == j) {
printf("%d\n", k);
return 0;
}
}
printf("IMPOSSIBLE\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_190494/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_190494/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [11 x i8] c"IMPOSSIBLE\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) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
%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
%1 = load i32, ptr %b, align 4, !tbaa !5
br label %for.body
for.body: ; preds = %for.inc.1, %entry
%k.014 = phi i32 [ 0, %entry ], [ %inc.1, %for.inc.1 ]
%sub = sub nsw i32 %0, %k.014
%2 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%sub1 = sub nsw i32 %k.014, %1
%3 = call i32 @llvm.abs.i32(i32 %sub1, i1 true)
%cmp2 = icmp eq i32 %2, %3
br i1 %cmp2, label %if.then, label %for.inc
if.then: ; preds = %for.inc, %for.body
%k.014.lcssa = phi i32 [ %k.014, %for.body ], [ %inc, %for.inc ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %k.014.lcssa)
br label %cleanup
for.inc: ; preds = %for.body
%inc = or i32 %k.014, 1
%sub.1 = sub nsw i32 %0, %inc
%4 = call i32 @llvm.abs.i32(i32 %sub.1, i1 true)
%sub1.1 = sub nsw i32 %inc, %1
%5 = call i32 @llvm.abs.i32(i32 %sub1.1, i1 true)
%cmp2.1 = icmp eq i32 %4, %5
br i1 %cmp2.1, label %if.then, label %for.inc.1
for.inc.1: ; preds = %for.inc
%inc.1 = add nuw nsw i32 %k.014, 2
%exitcond.not.1 = icmp eq i32 %inc.1, 1000000000
br i1 %exitcond.not.1, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.inc.1
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
cleanup: ; preds = %for.end, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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"}
|
#include<stdio.h>
#include<stdlib.h>
int main(void){
long a,b;
scanf("%ld%ld",&a,&b);
if(labs(a-b)%2!=0)
printf("IMPOSSIBLE");
else printf("%ld",(a+b)/2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_190551/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_190551/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%ld%ld\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"IMPOSSIBLE\00", align 1
@.str.2 = 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:
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
%rem = and i64 %sub, 1
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %if.else, label %if.then
if.then: ; preds = %entry
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end
if.else: ; preds = %entry
%add = add nsw i64 %1, %0
%div = sdiv i64 %add, 2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %div)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
int main (void){
int A;
int B;
int K;
scanf("%d %d",&A,&B);
if(abs(A-B)%2 == 0 ){
K =(A+B)/2;
printf("%d",K);
}else{
printf("IMPOSSIBLE\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_190601/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_190601/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d\00", align 1
@str = private unnamed_addr constant [11 x i8] c"IMPOSSIBLE\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) #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 %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%rem = and i32 %sub, 1
%cmp = icmp eq i32 %rem, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%add = add nsw i32 %1, %0
%div = sdiv i32 %add, 2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
br label %if.end
if.else: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.end: ; preds = %if.else, %if.then
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 @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"}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b, cislo;
scanf("%d", &a);
scanf("%d", &b);
if(((a+b)%2)==0){
printf("%d", ((a+b)/2));
}
else{
printf("IMPOSSIBLE");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_190652/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_190652/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"IMPOSSIBLE\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)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = and i32 %add, 1
%cmp = icmp eq i32 %2, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%div = sdiv i32 %add, 2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %div)
br label %if.end
if.else: ; preds = %entry
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
int main ()
{
int a,b;
scanf("%d%d",&a,&b);
if((a+b)%2==0)
{
printf("%d\n",(a+b)/2);
}
else printf("IMPOSSIBLE\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_190702/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_190702/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [11 x i8] c"IMPOSSIBLE\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) #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 %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = and i32 %add, 1
%cmp = icmp eq i32 %2, 0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%div = sdiv i32 %add, 2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
br label %if.end
if.else: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.end: ; preds = %if.else, %if.then
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 @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"}
|
#include <stdio.h>
int main(void){
int a,b;
scanf("%d %d",&a,&b);
if((a + b) % 2){
printf("IMPOSSIBLE");
return 0;
}
printf("%d",(a + b)/2);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_190746/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_190746/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [11 x i8] c"IMPOSSIBLE\00", align 1
@.str.2 = 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:
%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
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = and i32 %add, 1
%tobool.not = icmp eq i32 %2, 0
br i1 %tobool.not, label %if.end, label %if.then
if.then: ; preds = %entry
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup
if.end: ; preds = %entry
%div = sdiv i32 %add, 2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %div)
br label %cleanup
cleanup: ; preds = %if.end, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int n, *a;
scanf("%d", &n);
a = (int *)malloc(sizeof(int)*n);
for (int i = 0; i < n; i++)
{
scanf("%d", a + i);
}
for(int i = 0; i < n - 1; i++)
{
printf("%d ", a[i] + a[i+1]);
}
printf("%d\n", a[n-1]);
free(a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_19079/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_19079/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #6
%cmp30 = icmp sgt i32 %0, 0
br i1 %cmp30, label %for.body, label %for.cond5.preheader.for.cond.cleanup8_crit_edge
for.cond5.preheader: ; preds = %for.body
%cmp633 = icmp sgt i32 %2, 1
br i1 %cmp633, label %for.body9, label %for.cond5.preheader.for.cond.cleanup8_crit_edge
for.cond5.preheader.for.cond.cleanup8_crit_edge: ; preds = %entry, %for.cond5.preheader
%1 = phi i32 [ %2, %for.cond5.preheader ], [ %0, %entry ]
%sub32 = add nsw i32 %1, -1
%.pre = sext i32 %sub32 to i64
br label %for.cond.cleanup8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %add.ptr)
%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.cond5.preheader, !llvm.loop !9
for.cond.cleanup8: ; preds = %for.body9, %for.cond5.preheader.for.cond.cleanup8_crit_edge
%idxprom18.pre-phi = phi i64 [ %.pre, %for.cond5.preheader.for.cond.cleanup8_crit_edge ], [ %8, %for.body9 ]
%arrayidx19 = getelementptr inbounds i32, ptr %call1, i64 %idxprom18.pre-phi
%4 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %4)
call void @free(ptr noundef %call1) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body9: ; preds = %for.cond5.preheader, %for.body9
%indvars.iv37 = phi i64 [ %indvars.iv.next38, %for.body9 ], [ 0, %for.cond5.preheader ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv37
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
%arrayidx11 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next38
%6 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%add12 = add nsw i32 %6, %5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add12)
%7 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %7, -1
%8 = sext i32 %sub to i64
%cmp6 = icmp slt i64 %indvars.iv.next38, %8
br i1 %cmp6, label %for.body9, label %for.cond.cleanup8, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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
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 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main()
{
int A,B,sum=0;
while(scanf("%d%d",&A,&B)!=EOF){
sum=(A+B)/2;
if(A+B==sum*2)
printf("%d\n",sum);
else
printf("IMPOSSIBLE\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_190832/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_190832/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [11 x i8] c"IMPOSSIBLE\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) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%cmp.not7 = icmp eq i32 %call6, -1
br i1 %cmp.not7, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%div = sdiv i32 %add, 2
%mul = shl nsw i32 %div, 1
%cmp2 = icmp eq i32 %add, %mul
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %while.body
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
br label %if.end
if.else: ; preds = %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.end: ; preds = %if.else, %if.then
%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 = %if.end, %entry
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 @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"}
|
#include<stdio.h>
int main(){
int a,b;
scanf("%d%d",&a,&b);
if((a+b)%2==1){printf("IMPOSSIBLE\n");return 0;}
printf("%d\n",(a+b)/2);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_190876/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_190876/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [11 x i8] c"IMPOSSIBLE\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) #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 %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = and i32 %add, -2147483647
%cmp = icmp eq i32 %2, 1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
if.end: ; preds = %entry
%div = sdiv i32 %add, 2
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %div)
br label %cleanup
cleanup: ; preds = %if.end, %if.then
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 @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"}
|
/*
* main.c
*
* Created on: 2019/07/21
* Author: family
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main()
{
int A = 0, B = 0;
int C = 0;
scanf("%d %d", &A, &B);
if(A > B) {
} else {
int temp = B;
B = A;
A = temp;
}
C = (A - B)%2;
if (C != 0) {
printf("IMPOSSIBLE\n");
} else {
printf("%d\n", ((A - B)/2) + B);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_190919/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_190919/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [11 x i8] c"IMPOSSIBLE\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) #4
store i32 0, ptr %A, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
store i32 0, ptr %B, align 4, !tbaa !5
%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
%1 = load i32, ptr %B, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
br i1 %cmp, label %if.end, label %if.else
if.else: ; preds = %entry
store i32 %0, ptr %B, align 4, !tbaa !5
store i32 %1, ptr %A, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %entry, %if.else
%2 = phi i32 [ %1, %entry ], [ %0, %if.else ]
%3 = phi i32 [ %0, %entry ], [ %1, %if.else ]
%sub = sub nsw i32 %3, %2
%4 = and i32 %sub, 1
%cmp1.not = icmp eq i32 %4, 0
br i1 %cmp1.not, label %if.else4, label %if.then2
if.then2: ; preds = %if.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end7
if.else4: ; preds = %if.end
%div = sdiv i32 %sub, 2
%add = add nsw i32 %div, %2
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add)
br label %if.end7
if.end7: ; preds = %if.else4, %if.then2
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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
long long int i,n;
scanf("%I64d",&n);
long long int a[n],b[n];
for(i=0;i<n;i++)
{
scanf("%I64d",&a[i]);
}
for(i=0;i<n;i++)
{
b[i]=a[i]+a[i+1];
if(i==n-1)
b[i]=a[i];
}
for(i=0;i<n;i++)
{
printf("%I64d ",b[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_19097/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_19097/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%I64d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%I64d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
%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
%vla1 = alloca i64, i64 %2, align 16
%cmp37 = icmp sgt i64 %2, 0
br i1 %cmp37, label %for.body, label %for.end23
for.cond3.preheader: ; preds = %for.body
%cmp439 = icmp sgt i64 %4, 0
br i1 %cmp439, label %for.body5.lr.ph, label %for.end23
for.body5.lr.ph: ; preds = %for.cond3.preheader
%sub = add i64 %4, -1
%.pre = load i64, ptr %vla, align 16, !tbaa !5
%xtraiter = and i64 %4, 1
%3 = icmp eq i64 %sub, 0
br i1 %3, label %for.cond16.preheader.unr-lcssa, label %for.body5.lr.ph.new
for.body5.lr.ph.new: ; preds = %for.body5.lr.ph
%unroll_iter = and i64 %4, -2
br label %for.body5
for.body: ; preds = %entry, %for.body
%i.038 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.038
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.038, 1
%4 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %4
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond16.preheader.unr-lcssa: ; preds = %for.body5, %for.body5.lr.ph
%.unr = phi i64 [ %.pre, %for.body5.lr.ph ], [ %9, %for.body5 ]
%i.140.unr = phi i64 [ 0, %for.body5.lr.ph ], [ %add.1, %for.body5 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond16.preheader, label %for.body5.epil
for.body5.epil: ; preds = %for.cond16.preheader.unr-lcssa
%5 = getelementptr i64, ptr %vla, i64 %i.140.unr
%arrayidx7.epil = getelementptr i64, ptr %5, i64 1
%6 = load i64, ptr %arrayidx7.epil, align 8, !tbaa !5
%arrayidx9.epil = getelementptr inbounds i64, ptr %vla1, i64 %i.140.unr
%cmp10.epil = icmp eq i64 %i.140.unr, %sub
%add8.epil = select i1 %cmp10.epil, i64 0, i64 %6
%spec.store.select.epil = add nsw i64 %add8.epil, %.unr
store i64 %spec.store.select.epil, ptr %arrayidx9.epil, align 8
br label %for.cond16.preheader
for.cond16.preheader: ; preds = %for.cond16.preheader.unr-lcssa, %for.body5.epil
br i1 %cmp439, label %for.body18, label %for.end23
for.body5: ; preds = %for.body5, %for.body5.lr.ph.new
%7 = phi i64 [ %.pre, %for.body5.lr.ph.new ], [ %9, %for.body5 ]
%i.140 = phi i64 [ 0, %for.body5.lr.ph.new ], [ %add.1, %for.body5 ]
%niter = phi i64 [ 0, %for.body5.lr.ph.new ], [ %niter.next.1, %for.body5 ]
%add = or i64 %i.140, 1
%arrayidx7 = getelementptr inbounds i64, ptr %vla, i64 %add
%8 = load i64, ptr %arrayidx7, align 8, !tbaa !5
%arrayidx9 = getelementptr inbounds i64, ptr %vla1, i64 %i.140
%cmp10 = icmp eq i64 %i.140, %sub
%add8 = select i1 %cmp10, i64 0, i64 %8
%spec.store.select = add nsw i64 %add8, %7
store i64 %spec.store.select, ptr %arrayidx9, align 16
%add.1 = add nuw nsw i64 %i.140, 2
%arrayidx7.1 = getelementptr inbounds i64, ptr %vla, i64 %add.1
%9 = load i64, ptr %arrayidx7.1, align 16, !tbaa !5
%arrayidx9.1 = getelementptr inbounds i64, ptr %vla1, i64 %add
%cmp10.1 = icmp eq i64 %add, %sub
%add8.1 = select i1 %cmp10.1, i64 0, i64 %9
%spec.store.select.1 = add nsw i64 %add8.1, %8
store i64 %spec.store.select.1, ptr %arrayidx9.1, align 8
%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.preheader.unr-lcssa, label %for.body5, !llvm.loop !11
for.body18: ; preds = %for.cond16.preheader, %for.body18
%i.242 = phi i64 [ %inc22, %for.body18 ], [ 0, %for.cond16.preheader ]
%arrayidx19 = getelementptr inbounds i64, ptr %vla1, i64 %i.242
%10 = load i64, ptr %arrayidx19, align 8, !tbaa !5
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %10)
%inc22 = add nuw nsw i64 %i.242, 1
%11 = load i64, ptr %n, align 8, !tbaa !5
%cmp17 = icmp slt i64 %inc22, %11
br i1 %cmp17, label %for.body18, label %for.end23, !llvm.loop !12
for.end23: ; preds = %for.body18, %entry, %for.cond3.preheader, %for.cond16.preheader
call void @llvm.stackrestore.p0(ptr %1)
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
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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>
#include<stdlib.h>
void run(void){
int n,m;
scanf("%d%d",&n,&m);
int *dp=(int *)calloc(m+1,sizeof(int));
while(n--){
int v,w;
scanf("%d%d",&v,&w);
for(int i=w;i<=m;i++) if(dp[i]<dp[i-w]+v) dp[i]=dp[i-w]+v;
}
printf("%d\n",dp[m]);
}
int main(void){
run();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191011/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191011/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @run() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%v = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %m, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%conv = sext i32 %add to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #5
%1 = load i32, ptr %n, align 4, !tbaa !5
%dec29 = add nsw i32 %1, -1
store i32 %dec29, ptr %n, align 4, !tbaa !5
%tobool.not30 = icmp eq i32 %1, 0
br i1 %tobool.not30, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%scevgep33 = getelementptr i8, ptr %call1, i64 4
%scevgep35 = getelementptr i8, ptr %call1, i64 4
%invariant.gep = getelementptr i32, ptr %call1, i64 1
%invariant.gep54 = getelementptr i32, ptr %call1, i64 2
%invariant.gep56 = getelementptr i32, ptr %call1, i64 3
%invariant.gep58 = getelementptr i32, ptr %call1, i64 4
%invariant.gep60 = getelementptr i32, ptr %call1, i64 5
%invariant.gep62 = getelementptr i32, ptr %call1, i64 6
%invariant.gep64 = getelementptr i32, ptr %call1, i64 7
br label %while.body
while.body: ; preds = %while.body.preheader, %for.cond.cleanup
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v, ptr noundef nonnull %w)
%2 = load i32, ptr %w, align 4, !tbaa !5
%3 = load i32, ptr %m, align 4, !tbaa !5
%cmp.not27 = icmp sgt i32 %2, %3
br i1 %cmp.not27, label %for.cond.cleanup, label %for.body.lr.ph
for.body.lr.ph: ; preds = %while.body
%4 = load i32, ptr %v, align 4, !tbaa !5
%5 = sext i32 %2 to i64
%6 = add i32 %3, 1
%7 = sub i32 %3, %2
%8 = zext i32 %7 to i64
%9 = add nuw nsw i64 %8, 1
%min.iters.check = icmp ult i32 %7, 11
br i1 %min.iters.check, label %for.body.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.lr.ph
%10 = shl nsw i64 %5, 2
%scevgep = getelementptr i8, ptr %call1, i64 %10
%11 = sub i32 %3, %2
%12 = zext i32 %11 to i64
%13 = shl nuw nsw i64 %12, 2
%14 = getelementptr i8, ptr %scevgep33, i64 %10
%scevgep34 = getelementptr i8, ptr %14, i64 %13
%scevgep36 = getelementptr i8, ptr %scevgep35, i64 %13
%bound0 = icmp ult ptr %scevgep, %scevgep36
%bound1 = icmp ult ptr %call1, %scevgep34
%found.conflict = and i1 %bound0, %bound1
br i1 %found.conflict, label %for.body.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %9, 8589934584
%ind.end = add nsw i64 %n.vec, %5
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %4, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %pred.store.continue53, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue53 ]
%offset.idx = add i64 %index, %5
%15 = getelementptr inbounds i32, ptr %call1, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %15, align 4, !tbaa !5, !alias.scope !9, !noalias !12
%16 = getelementptr inbounds i32, ptr %15, i64 4
%wide.load37 = load <4 x i32>, ptr %16, align 4, !tbaa !5, !alias.scope !9, !noalias !12
%17 = getelementptr inbounds i32, ptr %call1, i64 %index
%wide.load38 = load <4 x i32>, ptr %17, align 4, !tbaa !5, !alias.scope !12
%18 = getelementptr inbounds i32, ptr %17, i64 4
%wide.load39 = load <4 x i32>, ptr %18, align 4, !tbaa !5, !alias.scope !12
%19 = add nsw <4 x i32> %broadcast.splat, %wide.load38
%20 = add nsw <4 x i32> %broadcast.splat, %wide.load39
%21 = icmp slt <4 x i32> %wide.load, %19
%22 = icmp slt <4 x i32> %wide.load37, %20
%23 = extractelement <4 x i1> %21, i64 0
br i1 %23, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body
%24 = getelementptr inbounds i32, ptr %call1, i64 %offset.idx
%25 = extractelement <4 x i32> %19, i64 0
store i32 %25, ptr %24, align 4, !tbaa !5, !alias.scope !9, !noalias !12
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body
%26 = extractelement <4 x i1> %21, i64 1
br i1 %26, label %pred.store.if40, label %pred.store.continue41
pred.store.if40: ; preds = %pred.store.continue
%gep = getelementptr i32, ptr %invariant.gep, i64 %offset.idx
%27 = extractelement <4 x i32> %19, i64 1
store i32 %27, ptr %gep, align 4, !tbaa !5, !alias.scope !9, !noalias !12
br label %pred.store.continue41
pred.store.continue41: ; preds = %pred.store.if40, %pred.store.continue
%28 = extractelement <4 x i1> %21, i64 2
br i1 %28, label %pred.store.if42, label %pred.store.continue43
pred.store.if42: ; preds = %pred.store.continue41
%gep55 = getelementptr i32, ptr %invariant.gep54, i64 %offset.idx
%29 = extractelement <4 x i32> %19, i64 2
store i32 %29, ptr %gep55, align 4, !tbaa !5, !alias.scope !9, !noalias !12
br label %pred.store.continue43
pred.store.continue43: ; preds = %pred.store.if42, %pred.store.continue41
%30 = extractelement <4 x i1> %21, i64 3
br i1 %30, label %pred.store.if44, label %pred.store.continue45
pred.store.if44: ; preds = %pred.store.continue43
%gep57 = getelementptr i32, ptr %invariant.gep56, i64 %offset.idx
%31 = extractelement <4 x i32> %19, i64 3
store i32 %31, ptr %gep57, align 4, !tbaa !5, !alias.scope !9, !noalias !12
br label %pred.store.continue45
pred.store.continue45: ; preds = %pred.store.if44, %pred.store.continue43
%32 = extractelement <4 x i1> %22, i64 0
br i1 %32, label %pred.store.if46, label %pred.store.continue47
pred.store.if46: ; preds = %pred.store.continue45
%gep59 = getelementptr i32, ptr %invariant.gep58, i64 %offset.idx
%33 = extractelement <4 x i32> %20, i64 0
store i32 %33, ptr %gep59, align 4, !tbaa !5, !alias.scope !9, !noalias !12
br label %pred.store.continue47
pred.store.continue47: ; preds = %pred.store.if46, %pred.store.continue45
%34 = extractelement <4 x i1> %22, i64 1
br i1 %34, label %pred.store.if48, label %pred.store.continue49
pred.store.if48: ; preds = %pred.store.continue47
%gep61 = getelementptr i32, ptr %invariant.gep60, i64 %offset.idx
%35 = extractelement <4 x i32> %20, i64 1
store i32 %35, ptr %gep61, align 4, !tbaa !5, !alias.scope !9, !noalias !12
br label %pred.store.continue49
pred.store.continue49: ; preds = %pred.store.if48, %pred.store.continue47
%36 = extractelement <4 x i1> %22, i64 2
br i1 %36, label %pred.store.if50, label %pred.store.continue51
pred.store.if50: ; preds = %pred.store.continue49
%gep63 = getelementptr i32, ptr %invariant.gep62, i64 %offset.idx
%37 = extractelement <4 x i32> %20, i64 2
store i32 %37, ptr %gep63, align 4, !tbaa !5, !alias.scope !9, !noalias !12
br label %pred.store.continue51
pred.store.continue51: ; preds = %pred.store.if50, %pred.store.continue49
%38 = extractelement <4 x i1> %22, i64 3
br i1 %38, label %pred.store.if52, label %pred.store.continue53
pred.store.if52: ; preds = %pred.store.continue51
%gep65 = getelementptr i32, ptr %invariant.gep64, i64 %offset.idx
%39 = extractelement <4 x i32> %20, i64 3
store i32 %39, ptr %gep65, align 4, !tbaa !5, !alias.scope !9, !noalias !12
br label %pred.store.continue53
pred.store.continue53: ; preds = %pred.store.if52, %pred.store.continue51
%index.next = add nuw i64 %index, 8
%40 = icmp eq i64 %index.next, %n.vec
br i1 %40, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %pred.store.continue53
%cmp.n = icmp eq i64 %9, %n.vec
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %vector.memcheck, %for.body.lr.ph, %middle.block
%indvars.iv.ph = phi i64 [ %5, %vector.memcheck ], [ %5, %for.body.lr.ph ], [ %ind.end, %middle.block ]
%41 = add i32 %3, 1
%42 = trunc i64 %indvars.iv.ph to i32
%43 = sub i32 %41, %42
%xtraiter = and i32 %43, 1
%lcmp.mod.not = icmp eq i32 %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 %call1, i64 %indvars.iv.ph
%44 = load i32, ptr %arrayidx.prol, align 4, !tbaa !5
%45 = sub nsw i64 %indvars.iv.ph, %5
%arrayidx5.prol = getelementptr inbounds i32, ptr %call1, i64 %45
%46 = load i32, ptr %arrayidx5.prol, align 4, !tbaa !5
%add6.prol = add nsw i32 %4, %46
%cmp7.prol = icmp slt i32 %44, %add6.prol
br i1 %cmp7.prol, label %if.then.prol, label %for.inc.prol
if.then.prol: ; preds = %for.body.prol
store i32 %add6.prol, ptr %arrayidx.prol, align 4, !tbaa !5
br label %for.inc.prol
for.inc.prol: ; preds = %if.then.prol, %for.body.prol
%indvars.iv.next.prol = add nsw i64 %indvars.iv.ph, 1
br label %for.body.prol.loopexit
for.body.prol.loopexit: ; preds = %for.inc.prol, %for.body.preheader
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader ], [ %indvars.iv.next.prol, %for.inc.prol ]
%47 = icmp eq i32 %3, %42
br i1 %47, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.body.prol.loopexit, %for.inc.1, %middle.block, %while.body
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
%48 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %48, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %48, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !18
for.body: ; preds = %for.body.prol.loopexit, %for.inc.1
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.inc.1 ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%49 = load i32, ptr %arrayidx, align 4, !tbaa !5
%50 = sub nsw i64 %indvars.iv, %5
%arrayidx5 = getelementptr inbounds i32, ptr %call1, i64 %50
%51 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%add6 = add nsw i32 %4, %51
%cmp7 = icmp slt i32 %49, %add6
br i1 %cmp7, label %if.then, label %for.inc
if.then: ; preds = %for.body
store i32 %add6, ptr %arrayidx, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next
%52 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%53 = sub nsw i64 %indvars.iv.next, %5
%arrayidx5.1 = getelementptr inbounds i32, ptr %call1, i64 %53
%54 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%add6.1 = add nsw i32 %4, %54
%cmp7.1 = icmp slt i32 %52, %add6.1
br i1 %cmp7.1, label %if.then.1, label %for.inc.1
if.then.1: ; preds = %for.inc
store i32 %add6.1, ptr %arrayidx.1, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%indvars.iv.next.1 = add nsw i64 %indvars.iv, 2
%lftr.wideiv.1 = trunc i64 %indvars.iv.next.1 to i32
%exitcond.not.1 = icmp eq i32 %6, %lftr.wideiv.1
br i1 %exitcond.not.1, label %for.cond.cleanup, label %for.body, !llvm.loop !19
while.end: ; preds = %for.cond.cleanup, %entry
%55 = phi i32 [ %0, %entry ], [ %3, %for.cond.cleanup ]
%idxprom15 = sext i32 %55 to i64
%arrayidx16 = getelementptr inbounds i32, ptr %call1, i64 %idxprom15
%56 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %56)
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 void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
tail call void @run()
ret i32 0
}
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind allocsize(0,1) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10}
!10 = distinct !{!10, !11}
!11 = distinct !{!11, !"LVerDomain"}
!12 = !{!13}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !15, !16, !17}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !15}
!19 = distinct !{!19, !15, !16}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void con(char a[101],int *b){
int i;
for(i=0;i<strlen(a);i++){
if(a[i]=='I'){
*b=1;
}
else if(a[i]=='V'){
*b=5;
}
else if(a[i]=='X'){
*b=10;
}
else if(a[i]=='L'){
*b=50;
}
else if(a[i]=='C'){
*b=100;
}
else if(a[i]=='D'){
*b=500;
}
else if(a[i]=='M'){
*b=1000;
}
b++;
}
}
int main(int argc, const char * argv[]) {
char roman[101]={};
int i,sum=0,num[101]={};
while(scanf("%s",roman)!=EOF){
con(roman,num);
for(i=0;i<strlen(roman);i++){
//printf("roman[%d]:%c num[%d]:%d\n",i,roman[i],i,num[i]);
if(num[i]>=num[i+1]){
sum+=num[i];
}
else{
sum-=num[i];
}
}
printf("%d\n",abs(sum));
sum=0;
for(i=0;i<101;i++){
roman[i]=0;
num[i]=0;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191084/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191084/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d\0A\00", align 1
; Function Attrs: nofree nounwind memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @con(ptr nocapture noundef readonly %a, ptr nocapture noundef writeonly %b) local_unnamed_addr #0 {
entry:
%char0 = load i8, ptr %a, align 1
%cmp75.not = icmp eq i8 %char0, 0
br i1 %cmp75.not, label %for.end, label %for.body
for.body: ; preds = %entry, %if.end51
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end51 ], [ 0, %entry ]
%b.addr.076 = phi ptr [ %incdec.ptr, %if.end51 ], [ %b, %entry ]
%arrayidx = getelementptr inbounds i8, ptr %a, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %0, label %if.end51 [
i8 73, label %if.end51.sink.split
i8 86, label %if.then10
i8 88, label %if.then17
i8 76, label %if.then24
i8 67, label %if.then31
i8 68, label %if.then38
i8 77, label %if.then45
]
if.then10: ; preds = %for.body
br label %if.end51.sink.split
if.then17: ; preds = %for.body
br label %if.end51.sink.split
if.then24: ; preds = %for.body
br label %if.end51.sink.split
if.then31: ; preds = %for.body
br label %if.end51.sink.split
if.then38: ; preds = %for.body
br label %if.end51.sink.split
if.then45: ; preds = %for.body
br label %if.end51.sink.split
if.end51.sink.split: ; preds = %for.body, %if.then17, %if.then31, %if.then45, %if.then38, %if.then24, %if.then10
%.sink = phi i32 [ 5, %if.then10 ], [ 50, %if.then24 ], [ 500, %if.then38 ], [ 1000, %if.then45 ], [ 100, %if.then31 ], [ 10, %if.then17 ], [ 1, %for.body ]
store i32 %.sink, ptr %b.addr.076, align 4, !tbaa !8
br label %if.end51
if.end51: ; preds = %if.end51.sink.split, %for.body
%incdec.ptr = getelementptr inbounds i32, ptr %b.addr.076, i64 1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %a) #8
%cmp = icmp ugt i64 %call, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %if.end51, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #3 {
entry:
%roman = alloca [101 x i8], align 16
%num = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %roman) #9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(101) %roman, i8 0, i64 101, i1 false)
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %num) #9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) %num, i8 0, i64 404, i1 false)
%call44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %roman)
%cmp.not45 = icmp eq i32 %call44, -1
br i1 %cmp.not45, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
%char0.i = load i8, ptr %roman, align 16
%cmp75.not.i = icmp eq i8 %char0.i, 0
br i1 %cmp75.not.i, label %con.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %while.body
%call.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %roman) #8
%umax = call i64 @llvm.umax.i64(i64 %call.i, i64 1)
%xtraiter = and i64 %umax, 1
%0 = icmp ult i64 %call.i, 2
br i1 %0, label %con.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %umax, -2
br label %for.body.i
for.body.i: ; preds = %if.end51.i.1, %for.body.i.preheader.new
%indvars.iv.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %indvars.iv.next.i.1, %if.end51.i.1 ]
%b.addr.076.i = phi ptr [ %num, %for.body.i.preheader.new ], [ %incdec.ptr.i.1, %if.end51.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %if.end51.i.1 ]
%arrayidx.i = getelementptr inbounds i8, ptr %roman, i64 %indvars.iv.i
%1 = load i8, ptr %arrayidx.i, align 2, !tbaa !5
switch i8 %1, label %if.end51.i [
i8 73, label %if.end51.sink.split.i
i8 86, label %if.then10.i
i8 88, label %if.then17.i
i8 76, label %if.then24.i
i8 67, label %if.then31.i
i8 68, label %if.then38.i
i8 77, label %if.then45.i
]
if.then10.i: ; preds = %for.body.i
br label %if.end51.sink.split.i
if.then17.i: ; preds = %for.body.i
br label %if.end51.sink.split.i
if.then24.i: ; preds = %for.body.i
br label %if.end51.sink.split.i
if.then31.i: ; preds = %for.body.i
br label %if.end51.sink.split.i
if.then38.i: ; preds = %for.body.i
br label %if.end51.sink.split.i
if.then45.i: ; preds = %for.body.i
br label %if.end51.sink.split.i
if.end51.sink.split.i: ; preds = %if.then45.i, %if.then38.i, %if.then31.i, %if.then24.i, %if.then17.i, %if.then10.i, %for.body.i
%.sink.i = phi i32 [ 5, %if.then10.i ], [ 50, %if.then24.i ], [ 500, %if.then38.i ], [ 1000, %if.then45.i ], [ 100, %if.then31.i ], [ 10, %if.then17.i ], [ 1, %for.body.i ]
store i32 %.sink.i, ptr %b.addr.076.i, align 4, !tbaa !8
br label %if.end51.i
if.end51.i: ; preds = %if.end51.sink.split.i, %for.body.i
%incdec.ptr.i = getelementptr inbounds i32, ptr %b.addr.076.i, i64 1
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds i8, ptr %roman, i64 %indvars.iv.next.i
%2 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
switch i8 %2, label %if.end51.i.1 [
i8 73, label %if.end51.sink.split.i.1
i8 86, label %if.then10.i.1
i8 88, label %if.then17.i.1
i8 76, label %if.then24.i.1
i8 67, label %if.then31.i.1
i8 68, label %if.then38.i.1
i8 77, label %if.then45.i.1
]
if.then45.i.1: ; preds = %if.end51.i
br label %if.end51.sink.split.i.1
if.then38.i.1: ; preds = %if.end51.i
br label %if.end51.sink.split.i.1
if.then31.i.1: ; preds = %if.end51.i
br label %if.end51.sink.split.i.1
if.then24.i.1: ; preds = %if.end51.i
br label %if.end51.sink.split.i.1
if.then17.i.1: ; preds = %if.end51.i
br label %if.end51.sink.split.i.1
if.then10.i.1: ; preds = %if.end51.i
br label %if.end51.sink.split.i.1
if.end51.sink.split.i.1: ; preds = %if.then10.i.1, %if.then17.i.1, %if.then24.i.1, %if.then31.i.1, %if.then38.i.1, %if.then45.i.1, %if.end51.i
%.sink.i.1 = phi i32 [ 5, %if.then10.i.1 ], [ 50, %if.then24.i.1 ], [ 500, %if.then38.i.1 ], [ 1000, %if.then45.i.1 ], [ 100, %if.then31.i.1 ], [ 10, %if.then17.i.1 ], [ 1, %if.end51.i ]
store i32 %.sink.i.1, ptr %incdec.ptr.i, align 4, !tbaa !8
br label %if.end51.i.1
if.end51.i.1: ; preds = %if.end51.sink.split.i.1, %if.end51.i
%incdec.ptr.i.1 = getelementptr inbounds i32, ptr %b.addr.076.i, i64 2
%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 %con.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !10
con.exit.loopexit.unr-lcssa: ; preds = %if.end51.i.1, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %indvars.iv.next.i.1, %if.end51.i.1 ]
%b.addr.076.i.unr = phi ptr [ %num, %for.body.i.preheader ], [ %incdec.ptr.i.1, %if.end51.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %con.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %con.exit.loopexit.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds i8, ptr %roman, i64 %indvars.iv.i.unr
%3 = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
switch i8 %3, label %con.exit [
i8 73, label %if.end51.sink.split.i.epil
i8 86, label %if.then10.i.epil
i8 88, label %if.then17.i.epil
i8 76, label %if.then24.i.epil
i8 67, label %if.then31.i.epil
i8 68, label %if.then38.i.epil
i8 77, label %if.then45.i.epil
]
if.then45.i.epil: ; preds = %for.body.i.epil
br label %if.end51.sink.split.i.epil
if.then38.i.epil: ; preds = %for.body.i.epil
br label %if.end51.sink.split.i.epil
if.then31.i.epil: ; preds = %for.body.i.epil
br label %if.end51.sink.split.i.epil
if.then24.i.epil: ; preds = %for.body.i.epil
br label %if.end51.sink.split.i.epil
if.then17.i.epil: ; preds = %for.body.i.epil
br label %if.end51.sink.split.i.epil
if.then10.i.epil: ; preds = %for.body.i.epil
br label %if.end51.sink.split.i.epil
if.end51.sink.split.i.epil: ; preds = %if.then10.i.epil, %if.then17.i.epil, %if.then24.i.epil, %if.then31.i.epil, %if.then38.i.epil, %if.then45.i.epil, %for.body.i.epil
%.sink.i.epil = phi i32 [ 5, %if.then10.i.epil ], [ 50, %if.then24.i.epil ], [ 500, %if.then38.i.epil ], [ 1000, %if.then45.i.epil ], [ 100, %if.then31.i.epil ], [ 10, %if.then17.i.epil ], [ 1, %for.body.i.epil ]
store i32 %.sink.i.epil, ptr %b.addr.076.i.unr, align 4, !tbaa !8
br label %con.exit
con.exit: ; preds = %con.exit.loopexit.unr-lcssa, %if.end51.sink.split.i.epil, %for.body.i.epil, %while.body
%call4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %roman) #8
%cmp539.not = icmp eq i64 %call4, 0
br i1 %cmp539.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %con.exit
%.pre = load i32, ptr %num, align 16, !tbaa !8
%min.iters.check = icmp ult i64 %call4, 8
br i1 %min.iters.check, label %for.body.preheader53, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %call4, -8
%vector.recur.init = insertelement <4 x i32> poison, i32 %.pre, i64 3
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vector.recur = phi <4 x i32> [ %vector.recur.init, %vector.ph ], [ %wide.load52, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %15, %vector.body ]
%vec.phi51 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %16, %vector.body ]
%4 = or i64 %index, 1
%5 = getelementptr inbounds [101 x i32], ptr %num, i64 0, i64 %4
%wide.load = load <4 x i32>, ptr %5, align 4, !tbaa !8
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load52 = load <4 x i32>, ptr %6, align 4, !tbaa !8
%7 = shufflevector <4 x i32> %vector.recur, <4 x i32> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%8 = shufflevector <4 x i32> %wide.load, <4 x i32> %wide.load52, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%9 = icmp slt <4 x i32> %7, %wide.load
%10 = icmp slt <4 x i32> %8, %wide.load52
%11 = sub <4 x i32> zeroinitializer, %7
%12 = sub <4 x i32> zeroinitializer, %8
%13 = select <4 x i1> %9, <4 x i32> %11, <4 x i32> %7
%14 = select <4 x i1> %10, <4 x i32> %12, <4 x i32> %8
%15 = add <4 x i32> %13, %vec.phi
%16 = add <4 x i32> %14, %vec.phi51
%index.next = add nuw i64 %index, 8
%17 = icmp eq i64 %index.next, %n.vec
br i1 %17, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %16, %15
%18 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %call4, %n.vec
%vector.recur.extract = extractelement <4 x i32> %wide.load52, i64 3
br i1 %cmp.n, label %for.end, label %for.body.preheader53
for.body.preheader53: ; preds = %for.body.preheader, %middle.block
%scalar.recur.ph = phi i32 [ %vector.recur.extract, %middle.block ], [ %.pre, %for.body.preheader ]
%indvars.iv.ph = phi i64 [ %n.vec, %middle.block ], [ 0, %for.body.preheader ]
%sum.141.ph = phi i32 [ %18, %middle.block ], [ 0, %for.body.preheader ]
br label %for.body
for.body: ; preds = %for.body.preheader53, %for.body
%scalar.recur = phi i32 [ %19, %for.body ], [ %scalar.recur.ph, %for.body.preheader53 ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader53 ]
%sum.141 = phi i32 [ %sum.2, %for.body ], [ %sum.141.ph, %for.body.preheader53 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx8 = getelementptr inbounds [101 x i32], ptr %num, i64 0, i64 %indvars.iv.next
%19 = load i32, ptr %arrayidx8, align 4, !tbaa !8
%cmp9.not = icmp slt i32 %scalar.recur, %19
%20 = sub i32 0, %scalar.recur
%sum.2.p = select i1 %cmp9.not, i32 %20, i32 %scalar.recur
%sum.2 = add i32 %sum.2.p, %sum.141
%exitcond47.not = icmp eq i64 %indvars.iv.next, %call4
br i1 %exitcond47.not, label %for.end, label %for.body, !llvm.loop !15
for.end: ; preds = %for.body, %middle.block, %con.exit
%sum.1.lcssa = phi i32 [ 0, %con.exit ], [ %18, %middle.block ], [ %sum.2, %for.body ]
%21 = call i32 @llvm.abs.i32(i32 %sum.1.lcssa, i1 true)
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %21)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(101) %roman, i8 0, i64 101, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) %num, i8 0, i64 404, i1 false), !tbaa !8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %roman)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %num) #9
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %roman) #9
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #7
attributes #0 = { nofree nounwind memory(write, argmem: readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !11, !14, !13}
!16 = distinct !{!16, !11}
|
#include<stdio.h>
#include<string.h>
int main()
{
char arabi[7]={'I','V','X','L','C','D','M'};
int s[7]={1,5,10,50,100,500,1000};
char c;
int sum,h,a,t;
int i,j,flag;
sum=t=0;
h=-1;
j=0;
while(scanf("%c",&c)!=EOF){
if(c=='\n'){
j=0;
if(flag==0)
sum+=t;
printf("%d\n",sum);
t=0;
sum=0;
continue;
}
for(i=0;i<8;i++){
if(c==arabi[i]){
if(i>h && j==1){
a=s[i]-t;
sum+=a;
sum-=2*flag;
t=0;
h=i;
}
else if(h==i && j==1) {
t+=s[i];
flag=0;
h=i;
}
else{
sum+=s[i];
sum+=t;
t=0;
h=i;
j=1;
flag=s[i];
}
break;
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191141/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191141/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@__const.main.s = private unnamed_addr constant [7 x i32] [i32 1, i32 5, i32 10, i32 50, i32 100, i32 500, i32 1000], align 16
@.str = private unnamed_addr constant [3 x i8] c"%c\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:
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #3
%call7091 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%cmp.not7192 = icmp eq i32 %call7091, -1
br i1 %cmp.not7192, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry, %for.end
%flag.0.ph97 = phi i32 [ %flag.1, %for.end ], [ undef, %entry ]
%j.0.ph96 = phi i32 [ 1, %for.end ], [ 0, %entry ]
%t.0.ph95 = phi i32 [ %t.1, %for.end ], [ 0, %entry ]
%sum.0.ph94 = phi i32 [ %sum.2, %for.end ], [ 0, %entry ]
%h.0.ph93 = phi i32 [ %h.1, %for.end ], [ -1, %entry ]
%flag.0.ph97.fr = freeze i32 %flag.0.ph97
%cmp3 = icmp eq i32 %flag.0.ph97.fr, 0
%0 = load i8, ptr %c, align 1, !tbaa !5
%cmp1.us83 = icmp eq i8 %0, 10
br i1 %cmp3, label %while.body.lr.ph.split.us, label %while.body.lr.ph.split
while.body.lr.ph.split.us: ; preds = %while.body.lr.ph
br i1 %cmp1.us83, label %if.then.us.preheader, label %for.cond.preheader
if.then.us.preheader: ; preds = %while.body.lr.ph.split.us
%spec.select.us.peel = add nsw i32 %t.0.ph95, %sum.0.ph94
%call6.us.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select.us.peel)
%call.us.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%cmp.not.us.peel = icmp eq i32 %call.us.peel, -1
br i1 %cmp.not.us.peel, label %while.end, label %while.body.us.peel, !llvm.loop !8
while.body.us.peel: ; preds = %if.then.us.preheader
%1 = load i8, ptr %c, align 1, !tbaa !5
%cmp1.us.peel = icmp eq i8 %1, 10
br i1 %cmp1.us.peel, label %if.then.us, label %for.cond.preheader
while.body.us: ; preds = %if.then.us
%2 = load i8, ptr %c, align 1, !tbaa !5
%cmp1.us = icmp eq i8 %2, 10
br i1 %cmp1.us, label %if.then.us, label %for.cond.preheader, !llvm.loop !10
if.then.us: ; preds = %while.body.us.peel, %while.body.us
%call6.us = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 0)
%call.us = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%cmp.not.us = icmp eq i32 %call.us, -1
br i1 %cmp.not.us, label %while.end, label %while.body.us, !llvm.loop !8
while.body.lr.ph.split: ; preds = %while.body.lr.ph
br i1 %cmp1.us83, label %if.then.preheader, label %for.cond.preheader
if.then.preheader: ; preds = %while.body.lr.ph.split
%call6.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.ph94)
%call.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%cmp.not.peel = icmp eq i32 %call.peel, -1
br i1 %cmp.not.peel, label %while.end, label %while.body.peel, !llvm.loop !8
while.body.peel: ; preds = %if.then.preheader
%3 = load i8, ptr %c, align 1, !tbaa !5
%cmp1.peel = icmp eq i8 %3, 10
br i1 %cmp1.peel, label %if.then, label %for.cond.preheader
while.body: ; preds = %if.then
%4 = load i8, ptr %c, align 1, !tbaa !5
%cmp1 = icmp eq i8 %4, 10
br i1 %cmp1, label %if.then, label %for.cond.preheader, !llvm.loop !12
for.cond.preheader: ; preds = %while.body, %while.body.us, %while.body.peel, %while.body.us.peel, %while.body.lr.ph.split, %while.body.lr.ph.split.us
%.us-phi = phi i8 [ %0, %while.body.lr.ph.split.us ], [ %0, %while.body.lr.ph.split ], [ %1, %while.body.us.peel ], [ %3, %while.body.peel ], [ %2, %while.body.us ], [ %4, %while.body ]
%.us-phi75 = phi i32 [ %sum.0.ph94, %while.body.lr.ph.split.us ], [ %sum.0.ph94, %while.body.lr.ph.split ], [ 0, %while.body.us.peel ], [ 0, %while.body.peel ], [ 0, %while.body.us ], [ 0, %while.body ]
%.us-phi76 = phi i32 [ %t.0.ph95, %while.body.lr.ph.split.us ], [ %t.0.ph95, %while.body.lr.ph.split ], [ 0, %while.body.us.peel ], [ 0, %while.body.peel ], [ 0, %while.body.us ], [ 0, %while.body ]
%.us-phi77 = phi i32 [ %j.0.ph96, %while.body.lr.ph.split.us ], [ %j.0.ph96, %while.body.lr.ph.split ], [ 0, %while.body.us.peel ], [ 0, %while.body.peel ], [ 0, %while.body.us ], [ 0, %while.body ]
switch i8 %.us-phi, label %for.inc.6 [
i8 73, label %if.then14
i8 86, label %if.then14.fold.split
i8 88, label %if.then14.fold.split113
i8 76, label %if.then14.fold.split114
i8 67, label %if.then14.fold.split115
i8 68, label %if.then14.fold.split116
i8 77, label %if.then14.fold.split117
]
if.then: ; preds = %while.body.peel, %while.body
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 0)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !8
if.then14.fold.split: ; preds = %for.cond.preheader
br label %if.then14
if.then14.fold.split113: ; preds = %for.cond.preheader
br label %if.then14
if.then14.fold.split114: ; preds = %for.cond.preheader
br label %if.then14
if.then14.fold.split115: ; preds = %for.cond.preheader
br label %if.then14
if.then14.fold.split116: ; preds = %for.cond.preheader
br label %if.then14
if.then14.fold.split117: ; preds = %for.cond.preheader
br label %if.then14
if.then14: ; preds = %for.cond.preheader, %if.then14.fold.split117, %if.then14.fold.split116, %if.then14.fold.split115, %if.then14.fold.split114, %if.then14.fold.split113, %if.then14.fold.split
%i.090.lcssa.wide = phi i64 [ 0, %for.cond.preheader ], [ 1, %if.then14.fold.split ], [ 2, %if.then14.fold.split113 ], [ 3, %if.then14.fold.split114 ], [ 4, %if.then14.fold.split115 ], [ 5, %if.then14.fold.split116 ], [ 6, %if.then14.fold.split117 ]
%5 = trunc i64 %i.090.lcssa.wide to i32
%cmp15 = icmp slt i32 %h.0.ph93, %5
%cmp17 = icmp eq i32 %.us-phi77, 1
%or.cond = and i1 %cmp15, %cmp17
br i1 %or.cond, label %if.then19, label %if.else
if.then19: ; preds = %if.then14
%arrayidx21 = getelementptr inbounds [7 x i32], ptr @__const.main.s, i64 0, i64 %i.090.lcssa.wide
%6 = load i32, ptr %arrayidx21, align 4, !tbaa !13
%7 = shl i32 %flag.0.ph97.fr, 1
%8 = add i32 %.us-phi76, %7
%9 = sub i32 %.us-phi75, %8
%sub23 = add i32 %9, %6
br label %for.end
if.else: ; preds = %if.then14
%cmp24 = icmp eq i32 %h.0.ph93, %5
%or.cond43 = and i1 %cmp24, %cmp17
%arrayidx31 = getelementptr inbounds [7 x i32], ptr @__const.main.s, i64 0, i64 %i.090.lcssa.wide
%10 = load i32, ptr %arrayidx31, align 4, !tbaa !13
br i1 %or.cond43, label %if.then29, label %if.else33
if.then29: ; preds = %if.else
%add32 = add nsw i32 %10, %.us-phi76
br label %for.end
if.else33: ; preds = %if.else
%add36 = add i32 %.us-phi76, %.us-phi75
%add37 = add i32 %add36, %10
br label %for.end
for.inc.6: ; preds = %for.cond.preheader
unreachable
for.end: ; preds = %if.then19, %if.else33, %if.then29
%h.1 = phi i32 [ %5, %if.then19 ], [ %h.0.ph93, %if.then29 ], [ %5, %if.else33 ]
%sum.2 = phi i32 [ %sub23, %if.then19 ], [ %.us-phi75, %if.then29 ], [ %add37, %if.else33 ]
%t.1 = phi i32 [ 0, %if.then19 ], [ %add32, %if.then29 ], [ 0, %if.else33 ]
%flag.1 = phi i32 [ %flag.0.ph97.fr, %if.then19 ], [ 0, %if.then29 ], [ %10, %if.else33 ]
%call70 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%cmp.not71 = icmp eq i32 %call70, -1
br i1 %cmp.not71, label %while.end, label %while.body.lr.ph, !llvm.loop !8
while.end: ; preds = %for.end, %if.then.preheader, %if.then.us.preheader, %if.then, %if.then.us, %entry
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #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"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9, !11}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !9, !11}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !6, i64 0}
|
#include<stdio.h>
int main(){
int n,i;
scanf("%d",&n);
double a[n+1],count=0;
for(i=0;i<n;i++){
scanf("%lf",&a[i]);
a[i]=1/a[i];
count+=a[i];
}
printf("%lf\n",1/count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191185/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191185/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%1 = zext i32 %add to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca double, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %3, 0
br i1 %cmp17, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%count.019 = phi double [ %add8, %for.body ], [ 0.000000e+00, %entry ]
%arrayidx = getelementptr inbounds double, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%4 = load double, ptr %arrayidx, align 8, !tbaa !9
%div = fdiv double 1.000000e+00, %4
store double %div, ptr %arrayidx, align 8, !tbaa !9
%add8 = fadd double %count.019, %div
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%count.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add8, %for.body ]
%div9 = fdiv double 1.000000e+00, %count.0.lcssa
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %div9)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main (void) {
int N,A[100];
double B[100];
scanf("%d", &N);
for (int i = 0; i < N; i++) {
scanf("%d", &A[i]);
}
double a = 0.0;
for (int i = 0; i < N; i++) {
B[i] = 1 / (double)A[i];
a += B[i];
}
double b = 1 / a;
printf("%f", b);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191228/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191228/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%f\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 [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %0, 0
br i1 %cmp25, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp427 = icmp sgt i32 %2, 0
br i1 %cmp427, label %for.body6.preheader, label %for.cond.cleanup5
for.body6.preheader: ; preds = %for.cond3.preheader
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %2, 4
br i1 %1, label %for.cond.cleanup5.loopexit.unr-lcssa, label %for.body6.preheader.new
for.body6.preheader.new: ; preds = %for.body6.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 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
%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.cond3.preheader, !llvm.loop !9
for.cond.cleanup5.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader
%add.lcssa.ph = phi double [ undef, %for.body6.preheader ], [ %add.3, %for.body6 ]
%indvars.iv33.unr = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next34.3, %for.body6 ]
%a.028.unr = phi double [ 0.000000e+00, %for.body6.preheader ], [ %add.3, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup5, label %for.body6.epil
for.body6.epil: ; preds = %for.cond.cleanup5.loopexit.unr-lcssa, %for.body6.epil
%indvars.iv33.epil = phi i64 [ %indvars.iv.next34.epil, %for.body6.epil ], [ %indvars.iv33.unr, %for.cond.cleanup5.loopexit.unr-lcssa ]
%a.028.epil = phi double [ %add.epil, %for.body6.epil ], [ %a.028.unr, %for.cond.cleanup5.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body6.epil ], [ 0, %for.cond.cleanup5.loopexit.unr-lcssa ]
%arrayidx8.epil = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv33.epil
%4 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5
%conv.epil = sitofp i32 %4 to double
%div.epil = fdiv double 1.000000e+00, %conv.epil
%add.epil = fadd double %a.028.epil, %div.epil
%indvars.iv.next34.epil = add nuw nsw i64 %indvars.iv33.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup5, label %for.body6.epil, !llvm.loop !11
for.cond.cleanup5: ; preds = %for.cond.cleanup5.loopexit.unr-lcssa, %for.body6.epil, %entry, %for.cond3.preheader
%a.0.lcssa = phi double [ 0.000000e+00, %for.cond3.preheader ], [ 0.000000e+00, %entry ], [ %add.lcssa.ph, %for.cond.cleanup5.loopexit.unr-lcssa ], [ %add.epil, %for.body6.epil ]
%div16 = fdiv double 1.000000e+00, %a.0.lcssa
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div16)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
for.body6: ; preds = %for.body6, %for.body6.preheader.new
%indvars.iv33 = phi i64 [ 0, %for.body6.preheader.new ], [ %indvars.iv.next34.3, %for.body6 ]
%a.028 = phi double [ 0.000000e+00, %for.body6.preheader.new ], [ %add.3, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.3, %for.body6 ]
%arrayidx8 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv33
%5 = load i32, ptr %arrayidx8, align 16, !tbaa !5
%conv = sitofp i32 %5 to double
%div = fdiv double 1.000000e+00, %conv
%add = fadd double %a.028, %div
%indvars.iv.next34 = or i64 %indvars.iv33, 1
%arrayidx8.1 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next34
%6 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5
%conv.1 = sitofp i32 %6 to double
%div.1 = fdiv double 1.000000e+00, %conv.1
%add.1 = fadd double %add, %div.1
%indvars.iv.next34.1 = or i64 %indvars.iv33, 2
%arrayidx8.2 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next34.1
%7 = load i32, ptr %arrayidx8.2, align 8, !tbaa !5
%conv.2 = sitofp i32 %7 to double
%div.2 = fdiv double 1.000000e+00, %conv.2
%add.2 = fadd double %add.1, %div.2
%indvars.iv.next34.2 = or i64 %indvars.iv33, 3
%arrayidx8.3 = getelementptr inbounds [100 x i32], ptr %A, i64 0, i64 %indvars.iv.next34.2
%8 = load i32, ptr %arrayidx8.3, align 4, !tbaa !5
%conv.3 = sitofp i32 %8 to double
%div.3 = fdiv double 1.000000e+00, %conv.3
%add.3 = fadd double %add.2, %div.3
%indvars.iv.next34.3 = add nuw nsw i64 %indvars.iv33, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond.cleanup5.loopexit.unr-lcssa, label %for.body6, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(void) {
int n,i;
scanf("%d",&n);
double A,B,ans;
for(i=0;i<n;i++){
scanf("%lf",&A);
B=(double)B+(1.0/(double)A);
}
ans=(double)(1.0/B);
printf("%lf",ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191271/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191271/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%A = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %A) #3
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %0, 0
br i1 %cmp6, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%B.07 = phi double [ %add, %for.body ], [ undef, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %A)
%1 = load double, ptr %A, align 8, !tbaa !9
%div = fdiv double 1.000000e+00, %1
%add = fadd double %B.07, %div
%inc = add nuw nsw i32 %i.08, 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 !11
for.end: ; preds = %for.body, %entry
%B.0.lcssa = phi double [ undef, %entry ], [ %add, %for.body ]
%div2 = fdiv double 1.000000e+00, %B.0.lcssa
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div2)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int n;
scanf("%d", &n);
int a;
int i;
double s = 0;
for(i=0;i<n;i++){
scanf("%d", &a);
s = s + (1.0 / a);
}
printf("%lf\n", 1.0 / s);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191314/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191314/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %0, 0
br i1 %cmp6, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%s.08 = phi double [ %add, %for.body ], [ 0.000000e+00, %entry ]
%i.07 = 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 = sitofp i32 %1 to double
%div = fdiv double 1.000000e+00, %conv
%add = fadd double %s.08, %div
%inc = add nuw nsw i32 %i.07, 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
%s.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add, %for.body ]
%div2 = fdiv double 1.000000e+00, %s.0.lcssa
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
int N;
int cnt;
double ans_pre=0;
scanf("%d", &N);
double A[N];
for (cnt=0;cnt<N;cnt++) {
scanf("%lf", &A[cnt]);
}
for (cnt=0;cnt<N;cnt++) {
ans_pre = ans_pre + 1/(A[cnt]);
}
printf("%lf", 1/ans_pre);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191358/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191358/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca double, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %3, 0
br i1 %cmp18, label %for.body, label %for.end9
for.cond2.preheader: ; preds = %for.body
%cmp320 = icmp sgt i32 %5, 0
br i1 %cmp320, label %for.body4.preheader, label %for.end9
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %5 to i64
%xtraiter = and i64 %wide.trip.count, 3
%4 = icmp ult i32 %5, 4
br i1 %4, label %for.end9.loopexit.unr-lcssa, label %for.body4.preheader.new
for.body4.preheader.new: ; preds = %for.body4.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds double, ptr %vla, 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
%5 = load i32, ptr %N, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4, %for.body4.preheader.new
%indvars.iv26 = phi i64 [ 0, %for.body4.preheader.new ], [ %indvars.iv.next27.3, %for.body4 ]
%ans_pre.021 = phi double [ 0.000000e+00, %for.body4.preheader.new ], [ %add.3, %for.body4 ]
%niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.3, %for.body4 ]
%arrayidx6 = getelementptr inbounds double, ptr %vla, i64 %indvars.iv26
%7 = load double, ptr %arrayidx6, align 16, !tbaa !11
%div = fdiv double 1.000000e+00, %7
%add = fadd double %ans_pre.021, %div
%indvars.iv.next27 = or i64 %indvars.iv26, 1
%arrayidx6.1 = getelementptr inbounds double, ptr %vla, i64 %indvars.iv.next27
%8 = load double, ptr %arrayidx6.1, align 8, !tbaa !11
%div.1 = fdiv double 1.000000e+00, %8
%add.1 = fadd double %add, %div.1
%indvars.iv.next27.1 = or i64 %indvars.iv26, 2
%arrayidx6.2 = getelementptr inbounds double, ptr %vla, i64 %indvars.iv.next27.1
%9 = load double, ptr %arrayidx6.2, align 16, !tbaa !11
%div.2 = fdiv double 1.000000e+00, %9
%add.2 = fadd double %add.1, %div.2
%indvars.iv.next27.2 = or i64 %indvars.iv26, 3
%arrayidx6.3 = getelementptr inbounds double, ptr %vla, i64 %indvars.iv.next27.2
%10 = load double, ptr %arrayidx6.3, align 8, !tbaa !11
%div.3 = fdiv double 1.000000e+00, %10
%add.3 = fadd double %add.2, %div.3
%indvars.iv.next27.3 = add nuw nsw i64 %indvars.iv26, 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.end9.loopexit.unr-lcssa, label %for.body4, !llvm.loop !13
for.end9.loopexit.unr-lcssa: ; preds = %for.body4, %for.body4.preheader
%add.lcssa.ph = phi double [ undef, %for.body4.preheader ], [ %add.3, %for.body4 ]
%indvars.iv26.unr = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next27.3, %for.body4 ]
%ans_pre.021.unr = phi double [ 0.000000e+00, %for.body4.preheader ], [ %add.3, %for.body4 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end9, label %for.body4.epil
for.body4.epil: ; preds = %for.end9.loopexit.unr-lcssa, %for.body4.epil
%indvars.iv26.epil = phi i64 [ %indvars.iv.next27.epil, %for.body4.epil ], [ %indvars.iv26.unr, %for.end9.loopexit.unr-lcssa ]
%ans_pre.021.epil = phi double [ %add.epil, %for.body4.epil ], [ %ans_pre.021.unr, %for.end9.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body4.epil ], [ 0, %for.end9.loopexit.unr-lcssa ]
%arrayidx6.epil = getelementptr inbounds double, ptr %vla, i64 %indvars.iv26.epil
%11 = load double, ptr %arrayidx6.epil, align 8, !tbaa !11
%div.epil = fdiv double 1.000000e+00, %11
%add.epil = fadd double %ans_pre.021.epil, %div.epil
%indvars.iv.next27.epil = add nuw nsw i64 %indvars.iv26.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.end9, label %for.body4.epil, !llvm.loop !14
for.end9: ; preds = %for.end9.loopexit.unr-lcssa, %for.body4.epil, %entry, %for.cond2.preheader
%ans_pre.0.lcssa = phi double [ 0.000000e+00, %for.cond2.preheader ], [ 0.000000e+00, %entry ], [ %add.lcssa.ph, %for.end9.loopexit.unr-lcssa ], [ %add.epil, %for.body4.epil ]
%div10 = fdiv double 1.000000e+00, %ans_pre.0.lcssa
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div10)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
int main (void)
{
int N = 0;
int A[1100];
int i;
float z = 0;
float x = 0;
scanf("%d\n",&N);
for(i=0; i < N; i++){
scanf("%d",&A[i]);
z += (float)1/A[i];
}
x = 1/z;
printf("%f",x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191400/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191400/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [3 x i8] c"%f\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 [1100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
store i32 0, ptr %N, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4400, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%z.013 = phi float [ %add, %for.body ], [ 0.000000e+00, %entry ]
%arrayidx = getelementptr inbounds [1100 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 = sitofp i32 %1 to float
%div = fdiv float 1.000000e+00, %conv
%add = fadd float %z.013, %div
%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
%z.0.lcssa = phi float [ 0.000000e+00, %entry ], [ %add, %for.body ]
%div4 = fdiv float 1.000000e+00, %z.0.lcssa
%conv5 = fpext float %div4 to double
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %conv5)
call void @llvm.lifetime.end.p0(i64 4400, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main() {
int N, i;
scanf("%d", &N);
double A[N];
double ans1, ans2;
ans1 = ans2 = 0;
for(i = 0; i < N; ++i) {
scanf("%lf", &A[i]);
}
for(i = 0; i < N; ++i) {
ans1 += 1.0 / A[i];
}
ans2 = 1.0 / ans1;
printf("%f\n", ans2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191444/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191444/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca double, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %3, 0
br i1 %cmp18, label %for.body, label %for.end9
for.cond2.preheader: ; preds = %for.body
%cmp320 = icmp sgt i32 %5, 0
br i1 %cmp320, label %for.body4.preheader, label %for.end9
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %5 to i64
%xtraiter = and i64 %wide.trip.count, 3
%4 = icmp ult i32 %5, 4
br i1 %4, label %for.end9.loopexit.unr-lcssa, label %for.body4.preheader.new
for.body4.preheader.new: ; preds = %for.body4.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds double, ptr %vla, 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
%5 = load i32, ptr %N, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4, %for.body4.preheader.new
%indvars.iv26 = phi i64 [ 0, %for.body4.preheader.new ], [ %indvars.iv.next27.3, %for.body4 ]
%ans1.022 = phi double [ 0.000000e+00, %for.body4.preheader.new ], [ %add.3, %for.body4 ]
%niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.3, %for.body4 ]
%arrayidx6 = getelementptr inbounds double, ptr %vla, i64 %indvars.iv26
%7 = load double, ptr %arrayidx6, align 16, !tbaa !11
%div = fdiv double 1.000000e+00, %7
%add = fadd double %ans1.022, %div
%indvars.iv.next27 = or i64 %indvars.iv26, 1
%arrayidx6.1 = getelementptr inbounds double, ptr %vla, i64 %indvars.iv.next27
%8 = load double, ptr %arrayidx6.1, align 8, !tbaa !11
%div.1 = fdiv double 1.000000e+00, %8
%add.1 = fadd double %add, %div.1
%indvars.iv.next27.1 = or i64 %indvars.iv26, 2
%arrayidx6.2 = getelementptr inbounds double, ptr %vla, i64 %indvars.iv.next27.1
%9 = load double, ptr %arrayidx6.2, align 16, !tbaa !11
%div.2 = fdiv double 1.000000e+00, %9
%add.2 = fadd double %add.1, %div.2
%indvars.iv.next27.2 = or i64 %indvars.iv26, 3
%arrayidx6.3 = getelementptr inbounds double, ptr %vla, i64 %indvars.iv.next27.2
%10 = load double, ptr %arrayidx6.3, align 8, !tbaa !11
%div.3 = fdiv double 1.000000e+00, %10
%add.3 = fadd double %add.2, %div.3
%indvars.iv.next27.3 = add nuw nsw i64 %indvars.iv26, 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.end9.loopexit.unr-lcssa, label %for.body4, !llvm.loop !13
for.end9.loopexit.unr-lcssa: ; preds = %for.body4, %for.body4.preheader
%add.lcssa.ph = phi double [ undef, %for.body4.preheader ], [ %add.3, %for.body4 ]
%indvars.iv26.unr = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next27.3, %for.body4 ]
%ans1.022.unr = phi double [ 0.000000e+00, %for.body4.preheader ], [ %add.3, %for.body4 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end9, label %for.body4.epil
for.body4.epil: ; preds = %for.end9.loopexit.unr-lcssa, %for.body4.epil
%indvars.iv26.epil = phi i64 [ %indvars.iv.next27.epil, %for.body4.epil ], [ %indvars.iv26.unr, %for.end9.loopexit.unr-lcssa ]
%ans1.022.epil = phi double [ %add.epil, %for.body4.epil ], [ %ans1.022.unr, %for.end9.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body4.epil ], [ 0, %for.end9.loopexit.unr-lcssa ]
%arrayidx6.epil = getelementptr inbounds double, ptr %vla, i64 %indvars.iv26.epil
%11 = load double, ptr %arrayidx6.epil, align 8, !tbaa !11
%div.epil = fdiv double 1.000000e+00, %11
%add.epil = fadd double %ans1.022.epil, %div.epil
%indvars.iv.next27.epil = add nuw nsw i64 %indvars.iv26.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.end9, label %for.body4.epil, !llvm.loop !14
for.end9: ; preds = %for.end9.loopexit.unr-lcssa, %for.body4.epil, %entry, %for.cond2.preheader
%ans1.0.lcssa = phi double [ 0.000000e+00, %for.cond2.preheader ], [ 0.000000e+00, %entry ], [ %add.lcssa.ph, %for.end9.loopexit.unr-lcssa ], [ %add.epil, %for.body4.epil ]
%div10 = fdiv double 1.000000e+00, %ans1.0.lcssa
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %div10)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
int main()
{
int i,n;
int a[1000];
scanf("%d", &n);
double sum;
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
sum+=1./(double)a[i];
}
printf("%f\n",1./sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191488/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191488/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%a = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%sum.012 = phi double [ %add, %for.body ], [ undef, %entry ]
%arrayidx = getelementptr inbounds [1000 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 = sitofp i32 %1 to double
%div = fdiv double 1.000000e+00, %conv
%add = fadd double %sum.012, %div
%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
%sum.0.lcssa = phi double [ undef, %entry ], [ %add, %for.body ]
%div4 = fdiv double 1.000000e+00, %sum.0.lcssa
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div4)
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
void run(void){
int n,k;
scanf("%d%d",&n,&k);
int *dp=(int *)calloc(k+1,sizeof(int));
int a[100];
int i;
for(i=0;i<n;i++) scanf("%d",a+i);
for(i=1;i<=k;i++){
int win=0;
for(int j=0;j<n;j++){
if(i-a[j]>=0 && dp[i-a[j]]==0){
win=1;
}
}
dp[i]=win;
}
puts(dp[k]?"First":"Second");
}
int main(void){
run();
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191530/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191530/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"First\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"Second\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @run() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
%a = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%conv = sext i32 %add to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #4
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp45 = icmp sgt i32 %1, 0
br i1 %cmp45, label %for.body, label %for.cond4.preheader
for.cond4.preheader.loopexit: ; preds = %for.body
%.pre = load i32, ptr %k, align 4, !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond4.preheader.loopexit, %entry
%2 = phi i32 [ %0, %entry ], [ %.pre, %for.cond4.preheader.loopexit ]
%.lcssa44 = phi i32 [ %1, %entry ], [ %12, %for.cond4.preheader.loopexit ]
%cmp5.not51 = icmp sgt i32 %2, 0
%cmp947 = icmp sgt i32 %.lcssa44, 0
%or.cond = and i1 %cmp5.not51, %cmp947
br i1 %or.cond, label %for.cond8.preheader.us.preheader, label %for.end28
for.cond8.preheader.us.preheader: ; preds = %for.cond4.preheader
%3 = add nuw i32 %2, 1
%wide.trip.count65 = zext i32 %3 to i64
%wide.trip.count = zext i32 %.lcssa44 to i64
%xtraiter = and i64 %wide.trip.count, 1
%4 = icmp eq i32 %.lcssa44, 1
%unroll_iter = and i64 %wide.trip.count, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond8.preheader.us
for.cond8.preheader.us: ; preds = %for.cond8.preheader.us.preheader, %for.cond8.for.cond.cleanup_crit_edge.us
%indvars.iv62 = phi i64 [ 1, %for.cond8.preheader.us.preheader ], [ %indvars.iv.next63, %for.cond8.for.cond.cleanup_crit_edge.us ]
%5 = trunc i64 %indvars.iv62 to i32
br i1 %4, label %for.cond8.for.cond.cleanup_crit_edge.us.unr-lcssa, label %for.body11.us
for.body11.us: ; preds = %for.cond8.preheader.us, %for.inc21.us.1
%indvars.iv59 = phi i64 [ %indvars.iv.next60.1, %for.inc21.us.1 ], [ 0, %for.cond8.preheader.us ]
%win.048.us = phi i32 [ %win.1.us.1, %for.inc21.us.1 ], [ 0, %for.cond8.preheader.us ]
%niter = phi i64 [ %niter.next.1, %for.inc21.us.1 ], [ 0, %for.cond8.preheader.us ]
%arrayidx.us = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv59
%6 = load i32, ptr %arrayidx.us, align 8, !tbaa !5
%sub.us = sub nsw i32 %5, %6
%cmp12.us = icmp sgt i32 %sub.us, -1
br i1 %cmp12.us, label %land.lhs.true.us, label %for.inc21.us
land.lhs.true.us: ; preds = %for.body11.us
%idxprom17.us = zext i32 %sub.us to i64
%arrayidx18.us = getelementptr inbounds i32, ptr %call1, i64 %idxprom17.us
%7 = load i32, ptr %arrayidx18.us, align 4, !tbaa !5
%cmp19.us = icmp eq i32 %7, 0
%spec.select.us = select i1 %cmp19.us, i32 1, i32 %win.048.us
br label %for.inc21.us
for.inc21.us: ; preds = %land.lhs.true.us, %for.body11.us
%win.1.us = phi i32 [ %win.048.us, %for.body11.us ], [ %spec.select.us, %land.lhs.true.us ]
%indvars.iv.next60 = or i64 %indvars.iv59, 1
%arrayidx.us.1 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv.next60
%8 = load i32, ptr %arrayidx.us.1, align 4, !tbaa !5
%sub.us.1 = sub nsw i32 %5, %8
%cmp12.us.1 = icmp sgt i32 %sub.us.1, -1
br i1 %cmp12.us.1, label %land.lhs.true.us.1, label %for.inc21.us.1
land.lhs.true.us.1: ; preds = %for.inc21.us
%idxprom17.us.1 = zext i32 %sub.us.1 to i64
%arrayidx18.us.1 = getelementptr inbounds i32, ptr %call1, i64 %idxprom17.us.1
%9 = load i32, ptr %arrayidx18.us.1, align 4, !tbaa !5
%cmp19.us.1 = icmp eq i32 %9, 0
%spec.select.us.1 = select i1 %cmp19.us.1, i32 1, i32 %win.1.us
br label %for.inc21.us.1
for.inc21.us.1: ; preds = %land.lhs.true.us.1, %for.inc21.us
%win.1.us.1 = phi i32 [ %win.1.us, %for.inc21.us ], [ %spec.select.us.1, %land.lhs.true.us.1 ]
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59, 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.cond8.for.cond.cleanup_crit_edge.us.unr-lcssa, label %for.body11.us, !llvm.loop !9
for.cond8.for.cond.cleanup_crit_edge.us.unr-lcssa: ; preds = %for.inc21.us.1, %for.cond8.preheader.us
%win.1.us.lcssa.ph = phi i32 [ undef, %for.cond8.preheader.us ], [ %win.1.us.1, %for.inc21.us.1 ]
%indvars.iv59.unr = phi i64 [ 0, %for.cond8.preheader.us ], [ %indvars.iv.next60.1, %for.inc21.us.1 ]
%win.048.us.unr = phi i32 [ 0, %for.cond8.preheader.us ], [ %win.1.us.1, %for.inc21.us.1 ]
br i1 %lcmp.mod.not, label %for.cond8.for.cond.cleanup_crit_edge.us, label %for.body11.us.epil
for.body11.us.epil: ; preds = %for.cond8.for.cond.cleanup_crit_edge.us.unr-lcssa
%arrayidx.us.epil = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv59.unr
%10 = load i32, ptr %arrayidx.us.epil, align 4, !tbaa !5
%sub.us.epil = sub nsw i32 %5, %10
%cmp12.us.epil = icmp sgt i32 %sub.us.epil, -1
br i1 %cmp12.us.epil, label %land.lhs.true.us.epil, label %for.cond8.for.cond.cleanup_crit_edge.us
land.lhs.true.us.epil: ; preds = %for.body11.us.epil
%idxprom17.us.epil = zext i32 %sub.us.epil to i64
%arrayidx18.us.epil = getelementptr inbounds i32, ptr %call1, i64 %idxprom17.us.epil
%11 = load i32, ptr %arrayidx18.us.epil, align 4, !tbaa !5
%cmp19.us.epil = icmp eq i32 %11, 0
%spec.select.us.epil = select i1 %cmp19.us.epil, i32 1, i32 %win.048.us.unr
br label %for.cond8.for.cond.cleanup_crit_edge.us
for.cond8.for.cond.cleanup_crit_edge.us: ; preds = %for.body11.us.epil, %land.lhs.true.us.epil, %for.cond8.for.cond.cleanup_crit_edge.us.unr-lcssa
%win.1.us.lcssa = phi i32 [ %win.1.us.lcssa.ph, %for.cond8.for.cond.cleanup_crit_edge.us.unr-lcssa ], [ %win.048.us.unr, %for.body11.us.epil ], [ %spec.select.us.epil, %land.lhs.true.us.epil ]
%arrayidx25.us = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv62
store i32 %win.1.us.lcssa, ptr %arrayidx25.us, align 4, !tbaa !5
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%exitcond66.not = icmp eq i64 %indvars.iv.next63, %wide.trip.count65
br i1 %exitcond66.not, label %for.end28, label %for.cond8.preheader.us, !llvm.loop !11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr)
%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.cond4.preheader.loopexit, !llvm.loop !12
for.end28: ; preds = %for.cond8.for.cond.cleanup_crit_edge.us, %for.cond4.preheader
%idxprom29 = sext i32 %2 to i64
%arrayidx30 = getelementptr inbounds i32, ptr %call1, i64 %idxprom29
%14 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%tobool.not = icmp eq i32 %14, 0
%cond = select i1 %tobool.not, ptr @.str.3, ptr @.str.2
%call31 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %cond)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #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 void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
tail call void @run()
ret i32 0
}
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind allocsize(0,1) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main(void){
long n;
scanf("%ld", &n);
long a[n];
for (long i = 0; i < n; i++) {
scanf("%ld", &a[i]);
}
long sum[n];
sum[0] = a[0];
for (long i = 1; i < n; i++) {
sum[i] = sum[i-1]+a[i];
}
long all = sum[n-1];
long other = all-sum[0];
long min = labs(other-sum[0]);
for (long i = 1; i < n-1; i++) {
other = all-sum[i];
if (labs(other-sum[i]) < min) {
min = labs(other-sum[i]);
}
}
printf("%ld\n", min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191596/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191596/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca 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
%cmp55 = icmp sgt i64 %2, 0
br i1 %cmp55, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
%vla267 = alloca i64, i64 %2, align 16
br label %for.cond.cleanup8.thread
for.cond.cleanup: ; preds = %for.body
%.pre = load i64, ptr %vla, align 16, !tbaa !5
%vla2 = alloca i64, i64 %6, align 16
store i64 %.pre, ptr %vla2, align 16, !tbaa !5
%cmp757 = icmp sgt i64 %6, 1
br i1 %cmp757, label %for.body9.preheader, label %for.cond.cleanup8.thread
for.body9.preheader: ; preds = %for.cond.cleanup
%load_initial = load i64, ptr %vla2, align 16
%3 = add i64 %6, -1
%4 = add i64 %6, -2
%xtraiter = and i64 %3, 3
%5 = icmp ult i64 %4, 3
br i1 %5, label %for.cond.cleanup8.unr-lcssa, label %for.body9.preheader.new
for.body9.preheader.new: ; preds = %for.body9.preheader
%unroll_iter = and i64 %3, -4
br label %for.body9
for.body: ; preds = %entry, %for.body
%i.056 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.056
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.056, 1
%6 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %6
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond.cleanup8.thread: ; preds = %for.cond.cleanup, %for.cond.cleanup.thread
%vla270.ph = phi ptr [ %vla267, %for.cond.cleanup.thread ], [ %vla2, %for.cond.cleanup ]
%.lcssa69.ph = phi i64 [ %2, %for.cond.cleanup.thread ], [ %6, %for.cond.cleanup ]
%.ph = phi i64 [ undef, %for.cond.cleanup.thread ], [ %.pre, %for.cond.cleanup ]
%7 = getelementptr i64, ptr %vla270.ph, i64 %.lcssa69.ph
%arrayidx1773 = getelementptr i64, ptr %7, i64 -1
%8 = load i64, ptr %arrayidx1773, align 8, !tbaa !5
%9 = shl i64 %.ph, 1
%sub2174 = sub i64 %8, %9
%10 = call i64 @llvm.abs.i64(i64 %sub2174, i1 true)
br label %for.cond.cleanup26
for.cond.cleanup8.unr-lcssa: ; preds = %for.body9, %for.body9.preheader
%store_forwarded.unr = phi i64 [ %load_initial, %for.body9.preheader ], [ %add.3, %for.body9 ]
%i5.058.unr = phi i64 [ 1, %for.body9.preheader ], [ %inc14.3, %for.body9 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup8, label %for.body9.epil
for.body9.epil: ; preds = %for.cond.cleanup8.unr-lcssa, %for.body9.epil
%store_forwarded.epil = phi i64 [ %add.epil, %for.body9.epil ], [ %store_forwarded.unr, %for.cond.cleanup8.unr-lcssa ]
%i5.058.epil = phi i64 [ %inc14.epil, %for.body9.epil ], [ %i5.058.unr, %for.cond.cleanup8.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body9.epil ], [ 0, %for.cond.cleanup8.unr-lcssa ]
%11 = getelementptr i64, ptr %vla2, i64 %i5.058.epil
%arrayidx11.epil = getelementptr inbounds i64, ptr %vla, i64 %i5.058.epil
%12 = load i64, ptr %arrayidx11.epil, align 8, !tbaa !5
%add.epil = add nsw i64 %12, %store_forwarded.epil
store i64 %add.epil, ptr %11, align 8, !tbaa !5
%inc14.epil = add nuw nsw i64 %i5.058.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup8, label %for.body9.epil, !llvm.loop !11
for.cond.cleanup8: ; preds = %for.body9.epil, %for.cond.cleanup8.unr-lcssa
%.pre65 = load i64, ptr %vla2, align 16, !tbaa !5
%13 = getelementptr i64, ptr %vla2, i64 %6
%arrayidx17 = getelementptr i64, ptr %13, i64 -1
%14 = load i64, ptr %arrayidx17, align 8, !tbaa !5
%15 = shl i64 %.pre65, 1
%sub21 = sub i64 %14, %15
%16 = call i64 @llvm.abs.i64(i64 %sub21, i1 true)
%cmp2559 = icmp sgt i64 %6, 2
br i1 %cmp2559, label %for.body27.preheader, label %for.cond.cleanup26
for.body27.preheader: ; preds = %for.cond.cleanup8
%17 = add i64 %6, -2
%min.iters.check = icmp ult i64 %17, 4
br i1 %min.iters.check, label %for.body27.preheader78, label %vector.ph
vector.ph: ; preds = %for.body27.preheader
%n.vec = and i64 %17, -4
%ind.end = or i64 %n.vec, 1
%minmax.ident.splatinsert = insertelement <2 x i64> poison, i64 %16, i64 0
%minmax.ident.splat = shufflevector <2 x i64> %minmax.ident.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
%broadcast.splatinsert = insertelement <2 x i64> poison, i64 %14, i64 0
%broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> 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> [ %minmax.ident.splat, %vector.ph ], [ %26, %vector.body ]
%vec.phi76 = phi <2 x i64> [ %minmax.ident.splat, %vector.ph ], [ %27, %vector.body ]
%offset.idx = or i64 %index, 1
%18 = getelementptr inbounds i64, ptr %vla2, i64 %offset.idx
%wide.load = load <2 x i64>, ptr %18, align 8, !tbaa !5
%19 = getelementptr inbounds i64, ptr %18, i64 2
%wide.load77 = load <2 x i64>, ptr %19, align 8, !tbaa !5
%20 = shl <2 x i64> %wide.load, <i64 1, i64 1>
%21 = shl <2 x i64> %wide.load77, <i64 1, i64 1>
%22 = sub <2 x i64> %broadcast.splat, %20
%23 = sub <2 x i64> %broadcast.splat, %21
%24 = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %22, i1 true)
%25 = call <2 x i64> @llvm.abs.v2i64(<2 x i64> %23, i1 true)
%26 = call <2 x i64> @llvm.smin.v2i64(<2 x i64> %24, <2 x i64> %vec.phi)
%27 = call <2 x i64> @llvm.smin.v2i64(<2 x i64> %25, <2 x i64> %vec.phi76)
%index.next = add nuw i64 %index, 4
%28 = icmp eq i64 %index.next, %n.vec
br i1 %28, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%rdx.minmax = call <2 x i64> @llvm.smin.v2i64(<2 x i64> %26, <2 x i64> %27)
%29 = call i64 @llvm.vector.reduce.smin.v2i64(<2 x i64> %rdx.minmax)
%cmp.n = icmp eq i64 %17, %n.vec
br i1 %cmp.n, label %for.cond.cleanup26, label %for.body27.preheader78
for.body27.preheader78: ; preds = %for.body27.preheader, %middle.block
%i22.061.ph = phi i64 [ 1, %for.body27.preheader ], [ %ind.end, %middle.block ]
%min.060.ph = phi i64 [ %16, %for.body27.preheader ], [ %29, %middle.block ]
br label %for.body27
for.body9: ; preds = %for.body9, %for.body9.preheader.new
%store_forwarded = phi i64 [ %load_initial, %for.body9.preheader.new ], [ %add.3, %for.body9 ]
%i5.058 = phi i64 [ 1, %for.body9.preheader.new ], [ %inc14.3, %for.body9 ]
%niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.3, %for.body9 ]
%30 = getelementptr i64, ptr %vla2, i64 %i5.058
%arrayidx11 = getelementptr inbounds i64, ptr %vla, i64 %i5.058
%31 = load i64, ptr %arrayidx11, align 8, !tbaa !5
%add = add nsw i64 %31, %store_forwarded
store i64 %add, ptr %30, align 8, !tbaa !5
%inc14 = add nuw nsw i64 %i5.058, 1
%32 = getelementptr i64, ptr %vla2, i64 %inc14
%arrayidx11.1 = getelementptr inbounds i64, ptr %vla, i64 %inc14
%33 = load i64, ptr %arrayidx11.1, align 8, !tbaa !5
%add.1 = add nsw i64 %33, %add
store i64 %add.1, ptr %32, align 8, !tbaa !5
%inc14.1 = add nuw nsw i64 %i5.058, 2
%34 = getelementptr i64, ptr %vla2, i64 %inc14.1
%arrayidx11.2 = getelementptr inbounds i64, ptr %vla, i64 %inc14.1
%35 = load i64, ptr %arrayidx11.2, align 8, !tbaa !5
%add.2 = add nsw i64 %35, %add.1
store i64 %add.2, ptr %34, align 8, !tbaa !5
%inc14.2 = add nuw nsw i64 %i5.058, 3
%36 = getelementptr i64, ptr %vla2, i64 %inc14.2
%arrayidx11.3 = getelementptr inbounds i64, ptr %vla, i64 %inc14.2
%37 = load i64, ptr %arrayidx11.3, align 8, !tbaa !5
%add.3 = add nsw i64 %37, %add.2
store i64 %add.3, ptr %36, align 8, !tbaa !5
%inc14.3 = add nuw nsw i64 %i5.058, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond.cleanup8.unr-lcssa, label %for.body9, !llvm.loop !16
for.cond.cleanup26: ; preds = %for.body27, %middle.block, %for.cond.cleanup8.thread, %for.cond.cleanup8
%min.0.lcssa = phi i64 [ %16, %for.cond.cleanup8 ], [ %10, %for.cond.cleanup8.thread ], [ %29, %middle.block ], [ %spec.select, %for.body27 ]
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %min.0.lcssa)
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #6
ret i32 0
for.body27: ; preds = %for.body27.preheader78, %for.body27
%i22.061 = phi i64 [ %inc36, %for.body27 ], [ %i22.061.ph, %for.body27.preheader78 ]
%min.060 = phi i64 [ %spec.select, %for.body27 ], [ %min.060.ph, %for.body27.preheader78 ]
%arrayidx28 = getelementptr inbounds i64, ptr %vla2, i64 %i22.061
%38 = load i64, ptr %arrayidx28, align 8, !tbaa !5
%39 = shl i64 %38, 1
%sub31 = sub i64 %14, %39
%40 = call i64 @llvm.abs.i64(i64 %sub31, i1 true)
%spec.select = call i64 @llvm.smin.i64(i64 %40, i64 %min.060)
%inc36 = add nuw nsw i64 %i22.061, 1
%exitcond64.not = icmp eq i64 %i22.061, %17
br i1 %exitcond64.not, label %for.cond.cleanup26, label %for.body27, !llvm.loop !17
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 i64 @llvm.smin.i64(i64, i64) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.abs.v2i64(<2 x i64>, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smin.v2i64(<2 x i64>, <2 x i64>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.smin.v2i64(<2 x i64>) #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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !15, !14}
|
#include <stdio.h>
int main()
{
int a,b,ab,x,y,ans;
scanf("%d%d%d%d%d",&a,&b,&ab,&x,&y);
if(x < y)
{
int tmp = x; x=y; y=tmp;
tmp = a; a=b; b=tmp;
}
if( a > ab*2 )
ans = ab*x*2;
else if(a+b>ab*2)
ans = a*(x-y) + ab*y*2;
else
ans = a*x + b*y;
printf("%d", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191668/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191668/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [11 x i8] c"%d%d%d%d%d\00", align 1
@.str.1 = 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:
%a = alloca i32, align 4
%b = alloca i32, align 4
%ab = alloca i32, align 4
%x = alloca i32, align 4
%y = 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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ab) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %ab, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%.pre = load i32, ptr %a, align 4, !tbaa !5
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i32 %1, ptr %x, align 4, !tbaa !5
store i32 %0, ptr %y, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
store i32 %2, ptr %a, align 4, !tbaa !5
store i32 %.pre, ptr %b, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%3 = phi i32 [ %0, %if.then ], [ %1, %entry ]
%4 = phi i32 [ %1, %if.then ], [ %0, %entry ]
%5 = phi i32 [ %2, %if.then ], [ %.pre, %entry ]
%6 = load i32, ptr %ab, align 4, !tbaa !5
%mul = shl i32 %6, 1
%cmp1 = icmp sgt i32 %5, %mul
br i1 %cmp1, label %if.then2, label %if.else
if.then2: ; preds = %if.end
%mul4 = mul i32 %mul, %4
br label %if.end17
if.else: ; preds = %if.end
%7 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %7, %5
%cmp6 = icmp sgt i32 %add, %mul
br i1 %cmp6, label %if.then7, label %if.else12
if.then7: ; preds = %if.else
%sub = sub nsw i32 %4, %3
%mul8 = mul nsw i32 %sub, %5
%mul10 = mul i32 %mul, %3
%add11 = add nsw i32 %mul8, %mul10
br label %if.end17
if.else12: ; preds = %if.else
%mul13 = mul nsw i32 %4, %5
%mul14 = mul nsw i32 %3, %7
%add15 = add nsw i32 %mul14, %mul13
br label %if.end17
if.end17: ; preds = %if.then7, %if.else12, %if.then2
%ans.0 = phi i32 [ %mul4, %if.then2 ], [ %add11, %if.then7 ], [ %add15, %if.else12 ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ab) #3
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: 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"}
|
#include <stdio.h>
#include <inttypes.h>
int main(void) {
int64_t A, B, C, X, Y;
int64_t ABnum;
int64_t answer = INT64_C(11111111111111111);
if (scanf("%" SCNd64 "%" SCNd64 "%" SCNd64 "%" SCNd64 "%" SCNd64, &A, &B, &C, &X, &Y) != 5) return 1;
for (ABnum = 0; ABnum / 2 < X + 10 || ABnum / 2 < Y + 10; ABnum += 2) {
int64_t Aleft = X - ABnum / 2, Bleft = Y - ABnum / 2;
int64_t candidate;
if (Aleft < 0) Aleft = 0;
if (Bleft < 0) Bleft = 0;
candidate = A * Aleft + B * Bleft + C * ABnum;
if (candidate < answer) answer = candidate;
}
printf("%" PRId64 "\n", answer);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191710/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191710/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%ld%ld%ld%ld%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i64, align 8
%B = alloca i64, align 8
%C = alloca i64, align 8
%X = alloca i64, align 8
%Y = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %B) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %C) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %X) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %Y) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C, ptr noundef nonnull %X, ptr noundef nonnull %Y)
%cmp.not = icmp eq i32 %call, 5
br i1 %cmp.not, label %for.cond.preheader, label %cleanup
for.cond.preheader: ; preds = %entry
%0 = load i64, ptr %X, align 8, !tbaa !5
%add = add nsw i64 %0, 10
%1 = load i64, ptr %Y, align 8
%.fr = freeze i64 %1
%add3 = add i64 %.fr, 10
%2 = load i64, ptr %A, align 8
%3 = load i64, ptr %B, align 8
%4 = load i64, ptr %C, align 8
%invariant.smax = call i64 @llvm.smax.i64(i64 %add, i64 %add3)
%or.cond39 = icmp sgt i64 %invariant.smax, 0
br i1 %or.cond39, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.body
%div42 = phi i64 [ %div, %for.body ], [ 0, %for.cond.preheader ]
%ABnum.041 = phi i64 [ %add21, %for.body ], [ 0, %for.cond.preheader ]
%answer.040 = phi i64 [ %spec.select, %for.body ], [ 11111111111111111, %for.cond.preheader ]
%sub = sub nsw i64 %0, %div42
%sub7 = sub nsw i64 %.fr, %div42
%spec.store.select = call i64 @llvm.smax.i64(i64 %sub, i64 0)
%spec.store.select29 = call i64 @llvm.smax.i64(i64 %sub7, i64 0)
%mul = mul nsw i64 %2, %spec.store.select
%mul14 = mul nsw i64 %3, %spec.store.select29
%add15 = add nsw i64 %mul14, %mul
%mul16 = mul nsw i64 %4, %ABnum.041
%add17 = add nsw i64 %add15, %mul16
%spec.select = call i64 @llvm.smin.i64(i64 %add17, i64 %answer.040)
%add21 = add nuw nsw i64 %ABnum.041, 2
%div = lshr exact i64 %add21, 1
%or.cond = icmp slt i64 %div, %invariant.smax
br i1 %or.cond, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %for.cond.preheader
%answer.0.lcssa = phi i64 [ 11111111111111111, %for.cond.preheader ], [ %spec.select, %for.body ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %answer.0.lcssa)
br label %cleanup
cleanup: ; preds = %entry, %for.end
%retval.0 = phi i32 [ 0, %for.end ], [ 1, %entry ]
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %Y) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %X) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %C) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #4
ret i32 %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: 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.smax.i64(i64, i64) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void) {
int a,b,c,x,y;
long int val=0;
scanf("%d%d%d%d%d",&a,&b,&c,&x,&y);
if(a+b<c*2){
while(x*y){
x--,y--;
val+=a+b;
}
if(x+y==0){;}
else if((a*x+b*y)<(c*2)*(x>y?x:y)){
val+=a*x+b*y;
}
else{
val+=(c*2)*(x>y?x:y);
}
}
else{
while(x*y){
x--,y--;
val+=c*2;
}
if(x+y==0){;}
else if((a*x+b*y)<(c*2)*(x>y?x:y)){
val+=a*x+b*y;
}
else{
val+=(c*2)*(x>y?x:y);
}
}
printf("%ld",val);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191754/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191754/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [11 x i8] c"%d%d%d%d%d\00", align 1
@.str.1 = 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:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %c, align 4, !tbaa !5
%mul = shl nsw i32 %2, 1
%cmp = icmp slt i32 %add, %mul
%x.promoted104 = load i32, ptr %x, align 4
%y.promoted106 = load i32, ptr %y, align 4
%mul1108 = mul nsw i32 %y.promoted106, %x.promoted104
%tobool.not109 = icmp eq i32 %mul1108, 0
br i1 %cmp, label %while.cond.preheader, label %while.cond37.preheader
while.cond37.preheader: ; preds = %entry
br i1 %tobool.not109, label %while.end46, label %while.body40.lr.ph
while.body40.lr.ph: ; preds = %while.cond37.preheader
%conv44 = sext i32 %mul to i64
br label %while.body40
while.cond.preheader: ; preds = %entry
br i1 %tobool.not109, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %while.cond.preheader
%conv = sext i32 %add to i64
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%val.0112 = phi i64 [ 0, %while.body.lr.ph ], [ %add4, %while.body ]
%dec105111 = phi i32 [ %x.promoted104, %while.body.lr.ph ], [ %dec, %while.body ]
%dec2107110 = phi i32 [ %y.promoted106, %while.body.lr.ph ], [ %dec2, %while.body ]
%dec = add nsw i32 %dec105111, -1
%dec2 = add nsw i32 %dec2107110, -1
%add4 = add nsw i64 %val.0112, %conv
%mul1 = mul nsw i32 %dec2, %dec
%tobool.not = icmp eq i32 %mul1, 0
br i1 %tobool.not, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i32 %dec, ptr %x, align 4, !tbaa !5
store i32 %dec2, ptr %y, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %while.cond.preheader
%val.0.lcssa = phi i64 [ %add4, %while.cond.while.end_crit_edge ], [ 0, %while.cond.preheader ]
%.lcssa92 = phi i32 [ %dec, %while.cond.while.end_crit_edge ], [ %x.promoted104, %while.cond.preheader ]
%.lcssa = phi i32 [ %dec2, %while.cond.while.end_crit_edge ], [ %y.promoted106, %while.cond.preheader ]
%add5 = sub i32 0, %.lcssa
%cmp6 = icmp eq i32 %.lcssa92, %add5
br i1 %cmp6, label %if.end84, label %if.else
if.else: ; preds = %while.end
%mul9 = mul nsw i32 %.lcssa92, %0
%mul10 = mul nsw i32 %.lcssa, %1
%add11 = add nsw i32 %mul10, %mul9
%cond = call i32 @llvm.smax.i32(i32 %.lcssa92, i32 %.lcssa)
%mul15 = mul nsw i32 %cond, %mul
%cmp16 = icmp slt i32 %add11, %mul15
br i1 %cmp16, label %if.then18, label %if.else24
if.then18: ; preds = %if.else
%conv22 = sext i32 %add11 to i64
%add23 = add nsw i64 %val.0.lcssa, %conv22
br label %if.end84
if.else24: ; preds = %if.else
%conv33 = sext i32 %mul15 to i64
%add34 = add nsw i64 %val.0.lcssa, %conv33
br label %if.end84
while.body40: ; preds = %while.body40.lr.ph, %while.body40
%val.1101 = phi i64 [ 0, %while.body40.lr.ph ], [ %add45, %while.body40 ]
%dec4195100 = phi i32 [ %x.promoted104, %while.body40.lr.ph ], [ %dec41, %while.body40 ]
%dec429699 = phi i32 [ %y.promoted106, %while.body40.lr.ph ], [ %dec42, %while.body40 ]
%dec41 = add nsw i32 %dec4195100, -1
%dec42 = add nsw i32 %dec429699, -1
%add45 = add nsw i64 %val.1101, %conv44
%mul38 = mul nsw i32 %dec42, %dec41
%tobool39.not = icmp eq i32 %mul38, 0
br i1 %tobool39.not, label %while.cond37.while.end46_crit_edge, label %while.body40, !llvm.loop !11
while.cond37.while.end46_crit_edge: ; preds = %while.body40
store i32 %dec41, ptr %x, align 4, !tbaa !5
store i32 %dec42, ptr %y, align 4, !tbaa !5
br label %while.end46
while.end46: ; preds = %while.cond37.while.end46_crit_edge, %while.cond37.preheader
%val.1.lcssa = phi i64 [ %add45, %while.cond37.while.end46_crit_edge ], [ 0, %while.cond37.preheader ]
%.lcssa94 = phi i32 [ %dec41, %while.cond37.while.end46_crit_edge ], [ %x.promoted104, %while.cond37.preheader ]
%.lcssa93 = phi i32 [ %dec42, %while.cond37.while.end46_crit_edge ], [ %y.promoted106, %while.cond37.preheader ]
%add47 = sub i32 0, %.lcssa93
%cmp48 = icmp eq i32 %.lcssa94, %add47
br i1 %cmp48, label %if.end84, label %if.else51
if.else51: ; preds = %while.end46
%mul52 = mul nsw i32 %.lcssa94, %0
%mul53 = mul nsw i32 %.lcssa93, %1
%add54 = add nsw i32 %mul53, %mul52
%cond61 = call i32 @llvm.smax.i32(i32 %.lcssa94, i32 %.lcssa93)
%mul62 = mul nsw i32 %cond61, %mul
%cmp63 = icmp slt i32 %add54, %mul62
br i1 %cmp63, label %if.then65, label %if.else71
if.then65: ; preds = %if.else51
%conv69 = sext i32 %add54 to i64
%add70 = add nsw i64 %val.1.lcssa, %conv69
br label %if.end84
if.else71: ; preds = %if.else51
%conv80 = sext i32 %mul62 to i64
%add81 = add nsw i64 %val.1.lcssa, %conv80
br label %if.end84
if.end84: ; preds = %while.end46, %if.else71, %if.then65, %while.end, %if.else24, %if.then18
%val.2 = phi i64 [ %val.0.lcssa, %while.end ], [ %add23, %if.then18 ], [ %add34, %if.else24 ], [ %val.1.lcssa, %while.end46 ], [ %add70, %if.then65 ], [ %add81, %if.else71 ]
%call85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %val.2)
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 %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(int argc, char **argv)
{
int a,b,c,x,y,i;
int xxx[3];
scanf("%d %d %d %d %d",&a,&b,&c,&x,&y);
if(x > y){
xxx[0] = a * (x - y) + 2 * c * y;
xxx[1] = a * x + b * y;
xxx[2] = 2 * c * x;
}
else if(x == y){
xxx[0] = 2 * c * x;
xxx[1] = (a + b) * x;
xxx[2] = 2147483647;
}
else{
xxx[0] = b * (y - x) + 2 * c * x;
xxx[1] = a * x + b * y;
xxx[2] = 2 * c * y;
}
for(i = 0 ; i < 2 ; i++){
if(xxx[i] < xxx[i + 1])
xxx[i + 1] = xxx[i];
}
printf("%d\n",xxx[2]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191804/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191804/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"%d %d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%2 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%mul = mul nsw i32 %2, %sub
%3 = load i32, ptr %c, align 4, !tbaa !5
%mul1 = shl nsw i32 %3, 1
%mul2 = mul nsw i32 %mul1, %1
%add = add nsw i32 %mul2, %mul
%mul3 = mul nsw i32 %2, %0
%4 = load i32, ptr %b, align 4, !tbaa !5
%mul4 = mul nsw i32 %4, %1
%add5 = add nsw i32 %mul4, %mul3
%mul8 = mul nsw i32 %mul1, %0
br label %if.end33
if.else: ; preds = %entry
%cmp10 = icmp eq i32 %0, %1
br i1 %cmp10, label %if.then11, label %if.else19
if.then11: ; preds = %if.else
%5 = load i32, ptr %c, align 4, !tbaa !5
%mul12 = shl i32 %0, 1
%mul13 = mul i32 %mul12, %5
%6 = load i32, ptr %a, align 4, !tbaa !5
%7 = load i32, ptr %b, align 4, !tbaa !5
%add15 = add nsw i32 %7, %6
%mul16 = mul nsw i32 %add15, %0
br label %if.end33
if.else19: ; preds = %if.else
%8 = load i32, ptr %b, align 4, !tbaa !5
%sub20 = sub nsw i32 %1, %0
%mul21 = mul nsw i32 %8, %sub20
%9 = load i32, ptr %c, align 4, !tbaa !5
%mul22 = shl nsw i32 %9, 1
%mul23 = mul nsw i32 %mul22, %0
%add24 = add nsw i32 %mul23, %mul21
%10 = load i32, ptr %a, align 4, !tbaa !5
%mul26 = mul nsw i32 %10, %0
%mul27 = mul nsw i32 %8, %1
%add28 = add nsw i32 %mul26, %mul27
%mul31 = mul nsw i32 %mul22, %1
br label %if.end33
if.end33: ; preds = %if.then11, %if.else19, %if.then
%xxx.sroa.12.0 = phi i32 [ %mul8, %if.then ], [ 2147483647, %if.then11 ], [ %mul31, %if.else19 ]
%xxx.sroa.6.0 = phi i32 [ %add5, %if.then ], [ %mul16, %if.then11 ], [ %add28, %if.else19 ]
%xxx.sroa.0.0 = phi i32 [ %add, %if.then ], [ %mul13, %if.then11 ], [ %add24, %if.else19 ]
%spec.store.select = call i32 @llvm.smin.i32(i32 %xxx.sroa.0.0, i32 %xxx.sroa.6.0)
%spec.store.select.1 = call i32 @llvm.smin.i32(i32 %spec.store.select, i32 %xxx.sroa.12.0)
%call48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.store.select.1)
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 %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#pragma warning(disable:4996)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>
#pragma region 定義
typedef long long ll;
typedef unsigned long long ull;
#define _itoa(A,N) sprintf(A, "%d", N);
int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);
int _gcd(int a, int b);
int _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);
int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);
//昇順
int s_asort(const void* a, const void* b) {
return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
return(strcmp((char*)b, (char*)a));
}
int i_dsort(const void* a, const void* b) {
return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
return(*(int*)a - *(int*)b);
}
int i_gcd(int a, int b);
int i_gcd(int a, int b) {
if (!b)return a;
return i_gcd(b, a % b);
}
int i_lcm(int a, int b);
int i_lcm(int a, int b) {
return (a * b) / i_gcd(a, b);
}
int ll_gcd(ll a, ll b);
int ll_gcd(ll a, ll b) {
if (!b)return a;
return ll_gcd(b, a % b);
}
int ll_lcm(ll a, ll b);
int ll_lcm(ll a, ll b) {
return (a * b) / ll_gcd(a, b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数2つで得る
//#define pai 3.1415926535
//#define _USE_MATH_DEFINES でM_PIが使える
#define deg_rad(X) (X*(M_PI/180))
int _swp(int* a, int* b)
{
int tmp;
tmp = *b; *b = *a; *a = tmp;
return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))
int _cknum(char* a, int n) {
int i;
char t = '0';
for (i = 0; i < n; i++) {
if (a[i] < '0' || a[i]>'9') return 1;
}
return 0;
}
int _atoi(char* s, int len) {
char tmp[20];
memcpy(tmp, s, len);
tmp[len] = 0x00;
return (atoi(tmp));
}
//素因数分解 pf素数が入る pc 素数の数
//ll _pfact(ll a);
//static ll pf[100000000];
//static ll pc;
//
//ll _pfact(ll a) {
// long i, r;
// if (a % 2 == 0) {
// pf[pc] = 2; pc++;
// return(_pfact(a / 2));
// }
// r = sqrt(a);
// for (i = 3; i <= r; i += 2) {
// if (a % i == 0) {
// pf[pc] = i; pc++;
// return(_pfact(a / i));
// }
// }
// if (a != 1) {
// pf[pc] = a; pc++;
// }
// return 0;
//
//}
//同じものの最初の文字をNULLにして降順
int _sort(const void* a, const void* b);
int _sort(const void* a, const void* b) {
char rc;
rc = strcmp((char*)b, (char*)a);
if (rc == 0) {
*(char*)a = 0x00;
return(1);
}
return(rc);
}
// 立っている ビットの数
int bitcount(unsigned int uc);
int bitcount(unsigned int uc)
{
int bit;
for (bit = 0; 0 != uc; uc = (unsigned int)(uc >> 1))
if (0 != (uc & 1))++bit;
return bit;
}//bitco
#define _rnd(a,b) ((a+b-1)/b) // A/Bの余りを繰り上げる
#pragma endregion
// ABC081 B - Break Number
int main(void) {
int n,i,res=0;
scanf("%d", &n);
int max = 0,cnt,k;
for (i = n; i > 0; i--) {
if (i % 2)continue;
cnt = 0; k = i;
while (1) {
if (k % 2) break;
k /= 2;
cnt++;
}
if (cnt > max) {
res = i;
max = cnt;
}
}
if (!res) res = n;
printf("%d\n", res);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191848/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191848/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_asort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #14
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_dsort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #14
ret i32 %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @i_dsort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @i_asort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
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(none) uwtable
define dso_local i32 @i_gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4 = icmp eq i32 %b, 0
br i1 %tobool.not4, 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
%tobool.not = icmp eq i32 %rem, 0
br i1 %tobool.not, 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: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @i_lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4.i = icmp eq i32 %b, 0
br i1 %tobool.not4.i, label %i_gcd.exit, label %if.end.i
if.end.i: ; preds = %entry, %if.end.i
%b.tr6.i = phi i32 [ %rem.i, %if.end.i ], [ %b, %entry ]
%a.tr5.i = phi i32 [ %b.tr6.i, %if.end.i ], [ %a, %entry ]
%rem.i = srem i32 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i32 %rem.i, 0
br i1 %tobool.not.i, label %i_gcd.exit, label %if.end.i
i_gcd.exit: ; preds = %if.end.i, %entry
%a.tr.lcssa.i = phi i32 [ %a, %entry ], [ %b.tr6.i, %if.end.i ]
%mul = mul nsw i32 %b, %a
%div = sdiv i32 %mul, %a.tr.lcssa.i
ret i32 %div
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @ll_gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4 = icmp eq i64 %b, 0
br i1 %tobool.not4, label %if.then, label %if.end
if.then: ; preds = %if.end, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %if.end ]
%conv = trunc i64 %a.tr.lcssa to i32
ret i32 %conv
if.end: ; preds = %entry, %if.end
%b.tr6 = phi i64 [ %rem, %if.end ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %if.end ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %if.then, label %if.end
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @ll_lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4.i = icmp eq i64 %b, 0
br i1 %tobool.not4.i, label %ll_gcd.exit, label %if.end.i
if.end.i: ; preds = %entry, %if.end.i
%b.tr6.i = phi i64 [ %rem.i, %if.end.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %if.end.i ], [ %a, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %ll_gcd.exit, label %if.end.i
ll_gcd.exit: ; preds = %if.end.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %if.end.i ]
%mul = mul nsw i64 %b, %a
%sext = shl i64 %a.tr.lcssa.i, 32
%conv = ashr exact i64 %sext, 32
%div = sdiv i64 %mul, %conv
%conv1 = trunc i64 %div to i32
ret i32 %conv1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @_swp(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
store i32 %1, ptr %b, align 4, !tbaa !5
store i32 %0, ptr %a, align 4, !tbaa !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) #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #5
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @_cknum(ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #6 {
entry:
%cmp13 = icmp sgt i32 %n, 0
br i1 %cmp13, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !9
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds i8, ptr %a, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !11
%1 = add i8 %0, -58
%or.cond = icmp ult i8 %1, -10
br i1 %or.cond, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn uwtable
define dso_local i32 @_atoi(ptr nocapture noundef readonly %s, i32 noundef %len) local_unnamed_addr #7 {
entry:
%tmp = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %tmp) #15
%conv = sext i32 %len to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %tmp, ptr align 1 %s, i64 %conv, i1 false)
%arrayidx = getelementptr inbounds [20 x i8], ptr %tmp, i64 0, i64 %conv
store i8 0, ptr %arrayidx, align 1, !tbaa !11
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %tmp, ptr noundef null, i32 noundef 10) #15
%conv.i = trunc i64 %call.i to i32
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %tmp) #15
ret i32 %conv.i
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #8
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @_sort(ptr nocapture noundef %a, ptr nocapture noundef readonly %b) local_unnamed_addr #9 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #14
%sext = shl i32 %call, 24
%cmp = icmp eq i32 %sext, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i8 0, ptr %a, align 1, !tbaa !11
br label %cleanup
if.end: ; preds = %entry
%conv1 = ashr exact i32 %sext, 24
br label %cleanup
cleanup: ; preds = %if.end, %if.then
%retval.0 = phi i32 [ 1, %if.then ], [ %conv1, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @bitcount(i32 noundef %uc) local_unnamed_addr #3 {
entry:
%cmp.not5 = icmp eq i32 %uc, 0
br i1 %cmp.not5, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%bit.07 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%uc.addr.06 = phi i32 [ %shr, %for.body ], [ %uc, %entry ]
%and = and i32 %uc.addr.06, 1
%spec.select = add i32 %bit.07, %and
%shr = lshr i32 %uc.addr.06, 1
%cmp.not = icmp ult i32 %uc.addr.06, 2
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body, %entry
%bit.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
ret i32 %bit.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #10 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #15
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4
%cmp27 = icmp sgt i32 %0, 0
br i1 %cmp27, label %for.body, label %for.end.thread
for.body: ; preds = %entry, %for.inc
%max.030 = phi i32 [ %max.1, %for.inc ], [ 0, %entry ]
%res.029 = phi i32 [ %res.1.fr, %for.inc ], [ 0, %entry ]
%i.028 = phi i32 [ %dec, %for.inc ], [ %0, %entry ]
%rem = and i32 %i.028, 1
%tobool.not = icmp eq i32 %rem, 0
br i1 %tobool.not, label %if.end4, label %for.inc
if.end4: ; preds = %for.body, %if.end4
%k.026 = phi i32 [ %div20, %if.end4 ], [ %i.028, %for.body ]
%cnt.025 = phi i32 [ %inc, %if.end4 ], [ 0, %for.body ]
%div20 = lshr i32 %k.026, 1
%inc = add nuw nsw i32 %cnt.025, 1
%1 = and i32 %k.026, 2
%tobool2.not = icmp eq i32 %1, 0
br i1 %tobool2.not, label %if.end4, label %while.end
while.end: ; preds = %if.end4
%cmp5.not = icmp slt i32 %cnt.025, %max.030
%spec.select = select i1 %cmp5.not, i32 %res.029, i32 %i.028
%spec.select21 = call i32 @llvm.smax.i32(i32 %inc, i32 %max.030)
br label %for.inc
for.inc: ; preds = %while.end, %for.body
%res.1 = phi i32 [ %res.029, %for.body ], [ %spec.select, %while.end ]
%max.1 = phi i32 [ %max.030, %for.body ], [ %spec.select21, %while.end ]
%res.1.fr = freeze i32 %res.1
%dec = add nsw i32 %i.028, -1
%cmp = icmp sgt i32 %i.028, 1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.inc
%tobool8.not = icmp eq i32 %res.1.fr, 0
br i1 %tobool8.not, label %for.end.thread, label %2
for.end.thread: ; preds = %entry, %for.end
br label %2
2: ; preds = %for.end, %for.end.thread
%3 = phi i32 [ %0, %for.end.thread ], [ %res.1.fr, %for.end ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #15
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #11
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #11
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #13
attributes #0 = { mustprogress nofree 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 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 #2 = { 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 #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 = { 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 #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { mustprogress nofree nounwind willreturn uwtable "min-legal-vector-width"="0" "no-trapping-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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { mustprogress nofree 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 #10 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #12 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #13 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #14 = { nounwind willreturn memory(read) }
attributes #15 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
|
#include<stdio.h>
int main(void){
int a,d=1;
scanf("%d",&a);
while(a>=d){
d*=2;
}
printf("%d",d/2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191891/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191891/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%d.0 = phi i32 [ 1, %entry ], [ %mul, %while.cond ]
%cmp.not = icmp slt i32 %0, %d.0
%mul = shl nsw i32 %d.0, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !9
while.end: ; preds = %while.cond
%div4 = lshr i32 %d.0, 1
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %div4)
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 n;
scanf("%d",&n);
int maxx=-1;
int flag=1;
for(int i=1;i<=n;i++){
int temp=i;
int kount=0;
while(temp%2==0){
temp/=2;
kount++;
}
if(kount>maxx){
maxx=kount;
flag=i;
}
}
printf("%d",flag);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191934/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191934/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not15 = icmp slt i32 %0, 1
br i1 %cmp.not15, label %for.cond.cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %entry, %while.end
%i.018 = phi i32 [ %inc3, %while.end ], [ 1, %entry ]
%flag.017 = phi i32 [ %spec.select11, %while.end ], [ 1, %entry ]
%maxx.016 = phi i32 [ %spec.select, %while.end ], [ -1, %entry ]
%1 = and i32 %i.018, 1
%cmp112 = icmp eq i32 %1, 0
br i1 %cmp112, label %while.body, label %while.end
for.cond.cleanup: ; preds = %while.end, %entry
%flag.0.lcssa = phi i32 [ 1, %entry ], [ %spec.select11, %while.end ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %flag.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
while.body: ; preds = %while.cond.preheader, %while.body
%kount.014 = phi i32 [ %inc, %while.body ], [ 0, %while.cond.preheader ]
%temp.013 = phi i32 [ %div, %while.body ], [ %i.018, %while.cond.preheader ]
%div = sdiv i32 %temp.013, 2
%inc = add nuw nsw i32 %kount.014, 1
%2 = and i32 %div, 1
%cmp1 = icmp eq i32 %2, 0
br i1 %cmp1, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %while.cond.preheader
%kount.0.lcssa = phi i32 [ 0, %while.cond.preheader ], [ %inc, %while.body ]
%cmp2 = icmp sgt i32 %kount.0.lcssa, %maxx.016
%spec.select = call i32 @llvm.smax.i32(i32 %kount.0.lcssa, i32 %maxx.016)
%spec.select11 = select i1 %cmp2, i32 %i.018, i32 %flag.017
%inc3 = add nuw i32 %i.018, 1
%exitcond.not = icmp eq i32 %i.018, %0
br i1 %exitcond.not, label %for.cond.cleanup, label %while.cond.preheader, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; 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"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(){
int n,i;
scanf("%d",&n);
for(i=1;i<=n;i*=2);
printf("%d",i/2);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191978/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191978/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%i.0 = phi i32 [ 1, %entry ], [ %mul, %for.cond ]
%cmp.not = icmp sgt i32 %i.0, %0
%mul = shl nsw i32 %i.0, 1
br i1 %cmp.not, label %for.end, label %for.cond, !llvm.loop !9
for.end: ; preds = %for.cond
%div4 = lshr i32 %i.0, 1
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %div4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int N,d=1,i;
scanf("%d",&N);
for(i=0;d<N;i++){
d *=2;
}
if(d>N)
d/=2;
printf("%d",d);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192027/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192027/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%d.0 = phi i32 [ 1, %entry ], [ %mul, %for.cond ]
%cmp = icmp slt i32 %d.0, %0
%mul = shl nsw i32 %d.0, 1
br i1 %cmp, label %for.cond, label %for.end, !llvm.loop !9
for.end: ; preds = %for.cond
%cmp1 = icmp sgt i32 %d.0, %0
%div7 = zext i1 %cmp1 to i32
%spec.select = lshr i32 %d.0, %div7
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %spec.select)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<math.h>
int main()
{
int n,i,t=1,j;
scanf("%d",&n);
if(n==1)
printf("%d\n",n);
for(j=sqrt(n);j>=1;j--)
{i=j;
while(i)
{t*=2;
i--;}
if(t<=n)
{printf("%d\n",t);
break;}
else
t=1;}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192078/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192078/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 1)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%1 = phi i32 [ %.pre, %if.then ], [ %0, %entry ]
%conv = sitofp i32 %1 to double
%call2 = call double @sqrt(double noundef %conv) #4
%conv3 = fptosi double %call2 to i32
%cmp419 = icmp sgt i32 %conv3, 0
br i1 %cmp419, label %while.cond.preheader.lr.ph, label %for.end
while.cond.preheader.lr.ph: ; preds = %if.end
%2 = load i32, ptr %n, align 4, !tbaa !5
br label %while.cond.preheader
for.cond: ; preds = %while.end
%dec11 = add i32 %j.020, -1
%cmp4 = icmp sgt i32 %j.020, 1
%indvar.next = add i32 %indvar, 1
br i1 %cmp4, label %while.cond.preheader, label %for.end, !llvm.loop !9
while.cond.preheader: ; preds = %while.cond.preheader.lr.ph, %for.cond
%indvar = phi i32 [ 0, %while.cond.preheader.lr.ph ], [ %indvar.next, %for.cond ]
%j.020 = phi i32 [ %conv3, %while.cond.preheader.lr.ph ], [ %dec11, %for.cond ]
%3 = xor i32 %indvar, -1
%4 = add i32 %3, %conv3
%xtraiter = and i32 %j.020, 7
%5 = icmp ult i32 %4, 7
br i1 %5, label %while.end.unr-lcssa, label %while.cond.preheader.new
while.cond.preheader.new: ; preds = %while.cond.preheader
%unroll_iter = and i32 %j.020, -8
br label %while.body
while.body: ; preds = %while.body, %while.cond.preheader.new
%t.118 = phi i32 [ 1, %while.cond.preheader.new ], [ %mul, %while.body ]
%niter = phi i32 [ 0, %while.cond.preheader.new ], [ %niter.next.7, %while.body ]
%mul = shl i32 %t.118, 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 %while.end.unr-lcssa, label %while.body, !llvm.loop !11
while.end.unr-lcssa: ; preds = %while.body, %while.cond.preheader
%mul.lcssa.ph = phi i32 [ undef, %while.cond.preheader ], [ %mul, %while.body ]
%t.118.unr = phi i32 [ 1, %while.cond.preheader ], [ %mul, %while.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.end, label %while.body.epil
while.body.epil: ; preds = %while.end.unr-lcssa, %while.body.epil
%t.118.epil = phi i32 [ %mul.epil, %while.body.epil ], [ %t.118.unr, %while.end.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %while.body.epil ], [ 0, %while.end.unr-lcssa ]
%mul.epil = shl nsw i32 %t.118.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 %while.end, label %while.body.epil, !llvm.loop !12
while.end: ; preds = %while.body.epil, %while.end.unr-lcssa
%mul.lcssa = phi i32 [ %mul.lcssa.ph, %while.end.unr-lcssa ], [ %mul.epil, %while.body.epil ]
%cmp6.not = icmp sgt i32 %mul.lcssa, %2
br i1 %cmp6.not, label %for.cond, label %if.then8
if.then8: ; preds = %while.end
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul.lcssa)
br label %for.end
for.end: ; preds = %for.cond, %if.end, %if.then8
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"}
|
#include <stdio.h>
int main(void) {
int n;
int ans = 1, x = 1;
scanf("%d", &n);
for (int i = 1; i < n; i++) {
for (int j = 0; j < i; j++) x *= 2;
if (n >= x) {
ans = x;
x = 1;
}
else break;
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192128/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192128/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 1
br i1 %cmp20, label %for.cond1.preheader, label %cleanup
for.cond: ; preds = %for.cond.cleanup3
%inc7 = add nuw nsw i32 %i.022, 1
%exitcond24.not = icmp eq i32 %inc7, %0
%indvar.next = add i32 %indvar, 1
br i1 %exitcond24.not, label %cleanup, label %for.cond1.preheader, !llvm.loop !9
for.cond1.preheader: ; preds = %entry, %for.cond
%indvar = phi i32 [ %indvar.next, %for.cond ], [ 0, %entry ]
%i.022 = phi i32 [ %inc7, %for.cond ], [ 1, %entry ]
%ans.021 = phi i32 [ %mul.lcssa, %for.cond ], [ 1, %entry ]
%xtraiter = and i32 %i.022, 7
%1 = icmp ult i32 %indvar, 7
br i1 %1, label %for.cond.cleanup3.unr-lcssa, label %for.cond1.preheader.new
for.cond1.preheader.new: ; preds = %for.cond1.preheader
%unroll_iter = and i32 %i.022, 2147483640
br label %for.body4
for.cond.cleanup3.unr-lcssa: ; preds = %for.body4, %for.cond1.preheader
%mul.lcssa.ph = phi i32 [ undef, %for.cond1.preheader ], [ %mul, %for.body4 ]
%x.118.unr = phi i32 [ 1, %for.cond1.preheader ], [ %mul, %for.body4 ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup3, label %for.body4.epil
for.body4.epil: ; preds = %for.cond.cleanup3.unr-lcssa, %for.body4.epil
%x.118.epil = phi i32 [ %mul.epil, %for.body4.epil ], [ %x.118.unr, %for.cond.cleanup3.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body4.epil ], [ 0, %for.cond.cleanup3.unr-lcssa ]
%mul.epil = shl nsw i32 %x.118.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.cond.cleanup3, label %for.body4.epil, !llvm.loop !11
for.cond.cleanup3: ; preds = %for.body4.epil, %for.cond.cleanup3.unr-lcssa
%mul.lcssa = phi i32 [ %mul.lcssa.ph, %for.cond.cleanup3.unr-lcssa ], [ %mul.epil, %for.body4.epil ]
%cmp5.not = icmp slt i32 %0, %mul.lcssa
br i1 %cmp5.not, label %cleanup, label %for.cond
for.body4: ; preds = %for.body4, %for.cond1.preheader.new
%x.118 = phi i32 [ 1, %for.cond1.preheader.new ], [ %mul, %for.body4 ]
%niter = phi i32 [ 0, %for.cond1.preheader.new ], [ %niter.next.7, %for.body4 ]
%mul = shl i32 %x.118, 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.cond.cleanup3.unr-lcssa, label %for.body4, !llvm.loop !13
cleanup: ; preds = %for.cond, %for.cond.cleanup3, %entry
%ans.0.lcssa = phi i32 [ 1, %entry ], [ %ans.021, %for.cond.cleanup3 ], [ %mul.lcssa, %for.cond ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(void)
{
int n;
int i,j ,count, ans;
scanf("%d", &n);
count = 0;
for(i=2; i<=n; i+=2){
int a = i;
for(j=0; a%2==0; j++)
a /= 2;
if(j > count){
count = j;
ans = i;
}
}
if(n == 1)
ans = 1;
printf("%d",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192171/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192171/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not22 = icmp slt i32 %0, 2
br i1 %cmp.not22, label %for.end6, label %for.body3.preheader
for.body3.preheader: ; preds = %entry, %for.end
%ans.025 = phi i32 [ %spec.select17, %for.end ], [ undef, %entry ]
%count.024 = phi i32 [ %spec.select, %for.end ], [ 0, %entry ]
%i.023 = phi i32 [ %add, %for.end ], [ 2, %entry ]
br label %for.body3
for.body3: ; preds = %for.body3.preheader, %for.body3
%a.021 = phi i32 [ %div, %for.body3 ], [ %i.023, %for.body3.preheader ]
%j.020 = phi i32 [ %inc, %for.body3 ], [ 0, %for.body3.preheader ]
%div = sdiv i32 %a.021, 2
%inc = add nuw nsw i32 %j.020, 1
%1 = and i32 %div, 1
%cmp2 = icmp eq i32 %1, 0
br i1 %cmp2, label %for.body3, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body3
%cmp4.not = icmp slt i32 %j.020, %count.024
%spec.select = call i32 @llvm.smax.i32(i32 %inc, i32 %count.024)
%spec.select17 = select i1 %cmp4.not, i32 %ans.025, i32 %i.023
%add = add nuw nsw i32 %i.023, 2
%cmp.not = icmp sgt i32 %add, %0
br i1 %cmp.not, label %for.end6, label %for.body3.preheader, !llvm.loop !11
for.end6: ; preds = %for.end, %entry
%ans.0.lcssa = phi i32 [ undef, %entry ], [ %spec.select17, %for.end ]
%cmp7 = icmp eq i32 %0, 1
%spec.select18 = select i1 %cmp7, i32 1, i32 %ans.0.lcssa
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %spec.select18)
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.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"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<stdbool.h>
int main(void) {
int n;
int ans=2;
scanf("%d",&n);
if (n < 2) {
printf("%d\n",n);
return 0;
}
while(true) {
ans *= 2;
if (ans > n) {
break;
}
}
printf("%d\n",ans/2);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192214/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192214/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %0, 2
br i1 %cmp, label %cleanup, label %while.cond
while.cond: ; preds = %entry, %while.cond
%ans.0 = phi i32 [ %mul, %while.cond ], [ 2, %entry ]
%mul = shl nsw i32 %ans.0, 1
%cmp2 = icmp sgt i32 %mul, %0
br i1 %cmp2, label %cleanup, label %while.cond
cleanup: ; preds = %while.cond, %entry
%ans.0.lcssa.sink = phi i32 [ %0, %entry ], [ %ans.0, %while.cond ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int
main(int argc, char *argv[])
{
int n; unsigned long long t[100], t_max = 0;
scanf("%d", &n);
for(int i = 0; i < n; i++){
scanf("%llu", &t[i]);
if(t_max < t[i]) t_max = t[i];
}
unsigned long long ans = t_max;
unsigned long long k;
for(int i = 0; i < n; i++){
k = 1;
while((k * ans) % t[i] != 0) k++;
ans *= k;
}
printf("%llu\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192258/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192258/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%llu\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%llu\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%t = alloca [100 x i64], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp32 = icmp sgt i32 %0, 0
br i1 %cmp32, label %for.body, label %for.cond.cleanup10
for.cond8.preheader: ; preds = %for.body
%cmp936 = icmp sgt i32 %3, 0
br i1 %cmp936, label %while.cond.preheader.preheader, label %for.cond.cleanup10
while.cond.preheader.preheader: ; preds = %for.cond8.preheader
%wide.trip.count = zext i32 %3 to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %3, 1
br i1 %1, label %for.cond.cleanup10.loopexit.unr-lcssa, label %while.cond.preheader.preheader.new
while.cond.preheader.preheader.new: ; preds = %while.cond.preheader.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %while.cond.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%t_max.033 = phi i64 [ %spec.select, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i64], ptr %t, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%2 = load i64, ptr %arrayidx, align 8, !tbaa !9
%spec.select = call i64 @llvm.umax.i64(i64 %t_max.033, i64 %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
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond8.preheader, !llvm.loop !11
while.cond.preheader: ; preds = %while.end.1, %while.cond.preheader.preheader.new
%indvars.iv42 = phi i64 [ 0, %while.cond.preheader.preheader.new ], [ %indvars.iv.next43.1, %while.end.1 ]
%ans.037 = phi i64 [ %spec.select, %while.cond.preheader.preheader.new ], [ %mul.1, %while.end.1 ]
%niter = phi i64 [ 0, %while.cond.preheader.preheader.new ], [ %niter.next.1, %while.end.1 ]
%arrayidx13 = getelementptr inbounds [100 x i64], ptr %t, i64 0, i64 %indvars.iv42
%5 = load i64, ptr %arrayidx13, align 16, !tbaa !9
br label %while.cond
for.cond.cleanup10.loopexit.unr-lcssa: ; preds = %while.end.1, %while.cond.preheader.preheader
%mul.lcssa.lcssa.ph = phi i64 [ undef, %while.cond.preheader.preheader ], [ %mul.1, %while.end.1 ]
%indvars.iv42.unr = phi i64 [ 0, %while.cond.preheader.preheader ], [ %indvars.iv.next43.1, %while.end.1 ]
%ans.037.unr = phi i64 [ %spec.select, %while.cond.preheader.preheader ], [ %mul.1, %while.end.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup10, label %while.cond.preheader.epil
while.cond.preheader.epil: ; preds = %for.cond.cleanup10.loopexit.unr-lcssa
%arrayidx13.epil = getelementptr inbounds [100 x i64], ptr %t, i64 0, i64 %indvars.iv42.unr
%6 = load i64, ptr %arrayidx13.epil, align 8, !tbaa !9
br label %while.cond.epil
while.cond.epil: ; preds = %while.cond.epil, %while.cond.preheader.epil
%k.0.epil = phi i64 [ %inc15.epil, %while.cond.epil ], [ 1, %while.cond.preheader.epil ]
%mul.epil = mul i64 %k.0.epil, %ans.037.unr
%rem.epil = urem i64 %mul.epil, %6
%cmp14.not.epil = icmp eq i64 %rem.epil, 0
%inc15.epil = add i64 %k.0.epil, 1
br i1 %cmp14.not.epil, label %for.cond.cleanup10, label %while.cond.epil, !llvm.loop !13
for.cond.cleanup10: ; preds = %for.cond.cleanup10.loopexit.unr-lcssa, %while.cond.epil, %entry, %for.cond8.preheader
%ans.0.lcssa = phi i64 [ %spec.select, %for.cond8.preheader ], [ 0, %entry ], [ %mul.lcssa.lcssa.ph, %for.cond.cleanup10.loopexit.unr-lcssa ], [ %mul.epil, %while.cond.epil ]
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
while.cond: ; preds = %while.cond, %while.cond.preheader
%k.0 = phi i64 [ %inc15, %while.cond ], [ 1, %while.cond.preheader ]
%mul = mul i64 %k.0, %ans.037
%rem = urem i64 %mul, %5
%cmp14.not = icmp eq i64 %rem, 0
%inc15 = add i64 %k.0, 1
br i1 %cmp14.not, label %while.end, label %while.cond, !llvm.loop !13
while.end: ; preds = %while.cond
%indvars.iv.next43 = or i64 %indvars.iv42, 1
%arrayidx13.1 = getelementptr inbounds [100 x i64], ptr %t, i64 0, i64 %indvars.iv.next43
%7 = load i64, ptr %arrayidx13.1, align 8, !tbaa !9
br label %while.cond.1
while.cond.1: ; preds = %while.cond.1, %while.end
%k.0.1 = phi i64 [ %inc15.1, %while.cond.1 ], [ 1, %while.end ]
%mul.1 = mul i64 %k.0.1, %mul
%rem.1 = urem i64 %mul.1, %7
%cmp14.not.1 = icmp eq i64 %rem.1, 0
%inc15.1 = add i64 %k.0.1, 1
br i1 %cmp14.not.1, label %while.end.1, label %while.cond.1, !llvm.loop !13
while.end.1: ; preds = %while.cond.1
%indvars.iv.next43.1 = add nuw nsw i64 %indvars.iv42, 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.cond.cleanup10.loopexit.unr-lcssa, label %while.cond.preheader, !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: 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.umax.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 long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
|
#include <stdio.h>
long long gcd(long long a,long long b)
{
long long n=a%b;
while(n!=0)
{
a=b;
b=n;
n=a%b;
}
return b;
}
int main()
{
long long i,n,m;
long long ans=1;
scanf("%lld",&n);
for(i=0;i<n;i++)
{
scanf("%lld",&m);
ans=ans/gcd(ans,m)*m;
}
printf("%lld\n",ans);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192308/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192308/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%rem = srem i64 %a, %b
%cmp.not7 = icmp eq i64 %rem, 0
br i1 %cmp.not7, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%n.09 = phi i64 [ %rem1, %while.body ], [ %rem, %entry ]
%b.addr.08 = phi i64 [ %n.09, %while.body ], [ %b, %entry ]
%rem1 = srem i64 %b.addr.08, %n.09
%cmp.not = icmp eq i64 %rem1, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%b.addr.0.lcssa = phi i64 [ %b, %entry ], [ %n.09, %while.body ]
ret i64 %b.addr.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:
%n = alloca i64, align 8
%m = 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 %m) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !7
%cmp7 = icmp sgt i64 %0, 0
br i1 %cmp7, label %for.body, label %for.end
for.body: ; preds = %entry, %gcd.exit
%ans.09 = phi i64 [ %mul, %gcd.exit ], [ 1, %entry ]
%i.08 = phi i64 [ %inc, %gcd.exit ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%1 = load i64, ptr %m, align 8, !tbaa !7
%rem.i = srem i64 %ans.09, %1
%cmp.not7.i = icmp eq i64 %rem.i, 0
br i1 %cmp.not7.i, label %gcd.exit, label %while.body.i
while.body.i: ; preds = %for.body, %while.body.i
%n.09.i = phi i64 [ %rem1.i, %while.body.i ], [ %rem.i, %for.body ]
%b.addr.08.i = phi i64 [ %n.09.i, %while.body.i ], [ %1, %for.body ]
%rem1.i = srem i64 %b.addr.08.i, %n.09.i
%cmp.not.i = icmp eq i64 %rem1.i, 0
br i1 %cmp.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !5
gcd.exit: ; preds = %while.body.i, %for.body
%b.addr.0.lcssa.i = phi i64 [ %1, %for.body ], [ %n.09.i, %while.body.i ]
%div = sdiv i64 %ans.09, %b.addr.0.lcssa.i
%mul = mul nsw i64 %div, %1
%inc = add nuw nsw i64 %i.08, 1
%2 = load i64, ptr %n, align 8, !tbaa !7
%cmp = icmp slt i64 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %gcd.exit, %entry
%ans.0.lcssa = phi i64 [ 1, %entry ], [ %mul, %gcd.exit ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"long long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include <stdio.h>
#define ll long long
ll gcd(ll t, ll a)
{
if (a == 0) return t;
return gcd(a, t%a);
}
ll lcm(ll t, ll a){ return t / gcd(t, a) * a; }
int main()
{
ll a = 1LL, t;
int n, i;
scanf("%d", &n);
for (i=0; i<n; i++){
scanf("%lld", &t);
a = lcm(t, a);
}
printf("%lld\n", a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192351/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192351/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %t, i64 noundef %a) local_unnamed_addr #0 {
entry:
%cmp4 = icmp eq i64 %a, 0
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%a.tr6 = phi i64 [ %rem, %if.end ], [ %a, %entry ]
%t.tr5 = phi i64 [ %a.tr6, %if.end ], [ %t, %entry ]
%rem = srem i64 %t.tr5, %a.tr6
%cmp = icmp eq i64 %rem, 0
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
%t.tr.lcssa = phi i64 [ %t, %entry ], [ %a.tr6, %if.end ]
ret i64 %t.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lcm(i64 noundef %t, i64 noundef %a) local_unnamed_addr #0 {
entry:
%cmp4.i = icmp eq i64 %a, 0
br i1 %cmp4.i, label %gcd.exit, label %if.end.i
if.end.i: ; preds = %entry, %if.end.i
%a.tr6.i = phi i64 [ %rem.i, %if.end.i ], [ %a, %entry ]
%t.tr5.i = phi i64 [ %a.tr6.i, %if.end.i ], [ %t, %entry ]
%rem.i = srem i64 %t.tr5.i, %a.tr6.i
%cmp.i = icmp eq i64 %rem.i, 0
br i1 %cmp.i, label %gcd.exit, label %if.end.i
gcd.exit: ; preds = %if.end.i, %entry
%t.tr.lcssa.i = phi i64 [ %t, %entry ], [ %a.tr6.i, %if.end.i ]
%div = sdiv i64 %t, %t.tr.lcssa.i
%mul = mul nsw i64 %div, %a
ret i64 %mul
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%t = alloca i64, align 8
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %0, 0
br i1 %cmp6, label %for.body, label %for.end
for.body: ; preds = %entry, %lcm.exit
%i.08 = phi i32 [ %inc, %lcm.exit ], [ 0, %entry ]
%a.07 = phi i64 [ %mul.i, %lcm.exit ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t)
%1 = load i64, ptr %t, align 8, !tbaa !9
%cmp4.i.i = icmp eq i64 %a.07, 0
br i1 %cmp4.i.i, label %lcm.exit, label %if.end.i.i
if.end.i.i: ; preds = %for.body, %if.end.i.i
%a.tr6.i.i = phi i64 [ %rem.i.i, %if.end.i.i ], [ %a.07, %for.body ]
%t.tr5.i.i = phi i64 [ %a.tr6.i.i, %if.end.i.i ], [ %1, %for.body ]
%rem.i.i = srem i64 %t.tr5.i.i, %a.tr6.i.i
%cmp.i.i = icmp eq i64 %rem.i.i, 0
br i1 %cmp.i.i, label %lcm.exit, label %if.end.i.i
lcm.exit: ; preds = %if.end.i.i, %for.body
%t.tr.lcssa.i.i = phi i64 [ %1, %for.body ], [ %a.tr6.i.i, %if.end.i.i ]
%div.i = sdiv i64 %1, %t.tr.lcssa.i.i
%mul.i = mul nsw i64 %div.i, %a.07
%inc = add nuw nsw i32 %i.08, 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 !11
for.end: ; preds = %lcm.exit, %entry
%a.0.lcssa = phi i64 [ 1, %entry ], [ %mul.i, %lcm.exit ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %a.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 8, 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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
int main(void){
char s[51];
scanf("%s", s);
for (int i = 0; i < strlen(s)-8; i++) {
printf("%c", s[i]);
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192395/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192395/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [51 x i8], align 16
call void @llvm.lifetime.start.p0(i64 51, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call210 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%cmp12.not = icmp eq i64 %call210, 8
br i1 %cmp12.not, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 51, ptr nonnull %s) #5
ret i32 0
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [51 x i8], ptr %s, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%conv4 = sext i8 %0 to i32
%putchar9 = call i32 @putchar(i32 %conv4)
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%sub = add i64 %call2, -8
%cmp = icmp ugt i64 %sub, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !8
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#define MAX 50
int main()
{
char str[MAX];
int i;
int cnt;
scanf("%s", str);
for(cnt=0; str[cnt]!='\0'; cnt++);
for(i=0; i<cnt-8; i++)printf("%c", str[i]);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192438/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192438/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [50 x i8], align 16
call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %str) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%indvars.iv25 = phi i32 [ %indvars.iv.next26, %for.cond ], [ -8, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x i8], ptr %str, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %0, 0
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next26 = add i32 %indvars.iv25, 1
br i1 %cmp.not, label %for.cond2.preheader, label %for.cond, !llvm.loop !8
for.cond2.preheader: ; preds = %for.cond
%1 = trunc i64 %indvars.iv to i32
%cmp319 = icmp ugt i32 %1, 8
br i1 %cmp319, label %for.body5.preheader, label %for.end12
for.body5.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %indvars.iv25 to i64
br label %for.body5
for.body5: ; preds = %for.body5.preheader, %for.body5
%indvars.iv22 = phi i64 [ 0, %for.body5.preheader ], [ %indvars.iv.next23, %for.body5 ]
%arrayidx7 = getelementptr inbounds [50 x i8], ptr %str, i64 0, i64 %indvars.iv22
%2 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%conv8 = sext i8 %2 to i32
%putchar18 = call i32 @putchar(i32 %conv8)
%indvars.iv.next23 = add nuw nsw i64 %indvars.iv22, 1
%exitcond.not = icmp eq i64 %indvars.iv.next23, %wide.trip.count
br i1 %exitcond.not, label %for.end12, label %for.body5, !llvm.loop !10
for.end12: ; preds = %for.body5, %for.cond2.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %str) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress 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"}
!10 = distinct !{!10, !9}
|
#include <stdio.h>
int main(void)
{
int n,x,y;
scanf("%d",&n);
x = 800 * n;
y = 200 * (n / 15);
printf("%d\n",x-y);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192481/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192481/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%mul = mul nsw i32 %0, 800
%div = sdiv i32 %0, 15
%mul1.neg = mul i32 %div, -200
%sub = add i32 %mul1.neg, %mul
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,x,y,k;
scanf("%d",&n);
y=n/15;
k=800*n-y*200;
printf("%d",k);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192531/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192531/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%div = sdiv i32 %0, 15
%mul = mul nsw i32 %0, 800
%mul1.neg = mul i32 %div, -200
%sub = add i32 %mul1.neg, %mul
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
int n,m=0,y;
scanf("%d",&n);
if(n>15) m=n/15;
y=n*800-m*200;
printf("%d",y);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192575/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192575/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 15
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%div = udiv i32 %0, 15
%.neg = mul i32 %div, -200
br label %if.end
if.end: ; preds = %if.then, %entry
%m.0.neg = phi i32 [ %.neg, %if.then ], [ 0, %entry ]
%mul = mul nsw i32 %0, 800
%sub = add i32 %m.0.neg, %mul
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
scanf("%d", &n);
printf("%d\n", 800 * n - 200 * (n / 15));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192618/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192618/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%mul = mul nsw i32 %0, 800
%div = sdiv i32 %0, 15
%mul1.neg = mul i32 %div, -200
%sub = add i32 %mul1.neg, %mul
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int N,A;
scanf("%d",&N);
A=floor(N/15);
printf("%d",800*N-A*200);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192661/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192661/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%div = sdiv i32 %0, 15
%mul = mul nsw i32 %0, 800
%mul2.neg = mul i32 %div, -200
%sub = add i32 %mul2.neg, %mul
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int N,x,y;
scanf("%d",&N);
x=800*N;
y=200*(N/15);
printf("%d\n",x-y);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192704/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192704/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%mul = mul nsw i32 %0, 800
%div = sdiv i32 %0, 15
%mul1.neg = mul i32 %div, -200
%sub = add i32 %mul1.neg, %mul
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int N,a,b;
scanf("%d",&N);
a=N*800;
b=(int)(N/15)*200;
printf("%d",a-b);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192748/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192748/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%mul = mul nsw i32 %0, 800
%div = sdiv i32 %0, 15
%mul1.neg = mul i32 %div, -200
%sub = add i32 %mul1.neg, %mul
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define rep(i, n) for (i = 0; i < n; i++)
#define rrep(i, n) for (i = n; i >= 0; i--)
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)
int main() {
int n;
scanf("%d", &n);
int x = n * 800;
int y = (n / 15) * 200;
printf("%d\n", x - y);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192791/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192791/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%mul = mul nsw i32 %0, 800
%div = sdiv i32 %0, 15
%mul1.neg = mul i32 %div, -200
%sub = add i32 %mul1.neg, %mul
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
char str[3000];
int i,j,k;
int n;
scanf("%d%*c",&n);
for(i = 0;i < n;i++){
fgets(str,3000,stdin);
/*k = 0;
while(str[k] != '\0'){
if(str[k] == '\n'){
str[k] = '\0';
}
k++;
}*/
j = 0;
while(str[j] != '\0'){
if(str[j] == 'H'){
if(str[j+1] == 'o'){
if(str[j+2] == 's'){
if(str[j+3] == 'h'){
if(str[j+4] == 'i'){
if(str[j+5] == 'n'){
if(str[j+6] == 'o'){
str[j+6] = 'a';
}
}
}
}
}
}
}
j++;
}
printf("%s",str);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192834/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192834/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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%*c\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [3000 x i8], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 3000, ptr nonnull %str) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp72 = icmp sgt i32 %0, 0
br i1 %cmp72, label %for.body, label %for.end
for.body: ; preds = %entry, %while.end
%i.073 = phi i32 [ %inc61, %while.end ], [ 0, %entry ]
%1 = load ptr, ptr @stdin, align 8, !tbaa !9
%call1 = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 3000, ptr noundef %1)
br label %while.cond
while.cond: ; preds = %while.cond.backedge, %for.body
%indvars.iv = phi i64 [ 0, %for.body ], [ %indvars.iv.be, %while.cond.backedge ]
%arrayidx = getelementptr inbounds [3000 x i8], ptr %str, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 1, !tbaa !11
switch i8 %2, label %while.cond.if.end58_crit_edge [
i8 0, label %while.end
i8 72, label %if.then
]
while.cond.if.end58_crit_edge: ; preds = %while.cond
%.pre = add nuw i64 %indvars.iv, 1
br label %while.cond.backedge
while.cond.backedge: ; preds = %while.cond.if.end58_crit_edge, %if.then, %if.then21, %if.then35, %if.then49, %if.then42, %if.then28, %if.then14
%indvars.iv.be = phi i64 [ %.pre, %while.cond.if.end58_crit_edge ], [ %3, %if.then ], [ %3, %if.then21 ], [ %3, %if.then35 ], [ %3, %if.then49 ], [ %3, %if.then42 ], [ %3, %if.then28 ], [ %3, %if.then14 ]
br label %while.cond, !llvm.loop !12
if.then: ; preds = %while.cond
%3 = add nuw i64 %indvars.iv, 1
%arrayidx10 = getelementptr inbounds [3000 x i8], ptr %str, i64 0, i64 %3
%4 = load i8, ptr %arrayidx10, align 1, !tbaa !11
%cmp12 = icmp eq i8 %4, 111
br i1 %cmp12, label %if.then14, label %while.cond.backedge
if.then14: ; preds = %if.then
%5 = add nuw nsw i64 %indvars.iv, 2
%arrayidx17 = getelementptr inbounds [3000 x i8], ptr %str, i64 0, i64 %5
%6 = load i8, ptr %arrayidx17, align 1, !tbaa !11
%cmp19 = icmp eq i8 %6, 115
br i1 %cmp19, label %if.then21, label %while.cond.backedge
if.then21: ; preds = %if.then14
%7 = add nuw nsw i64 %indvars.iv, 3
%arrayidx24 = getelementptr inbounds [3000 x i8], ptr %str, i64 0, i64 %7
%8 = load i8, ptr %arrayidx24, align 1, !tbaa !11
%cmp26 = icmp eq i8 %8, 104
br i1 %cmp26, label %if.then28, label %while.cond.backedge
if.then28: ; preds = %if.then21
%9 = add nuw nsw i64 %indvars.iv, 4
%arrayidx31 = getelementptr inbounds [3000 x i8], ptr %str, i64 0, i64 %9
%10 = load i8, ptr %arrayidx31, align 1, !tbaa !11
%cmp33 = icmp eq i8 %10, 105
br i1 %cmp33, label %if.then35, label %while.cond.backedge
if.then35: ; preds = %if.then28
%11 = add nuw nsw i64 %indvars.iv, 5
%arrayidx38 = getelementptr inbounds [3000 x i8], ptr %str, i64 0, i64 %11
%12 = load i8, ptr %arrayidx38, align 1, !tbaa !11
%cmp40 = icmp eq i8 %12, 110
br i1 %cmp40, label %if.then42, label %while.cond.backedge
if.then42: ; preds = %if.then35
%13 = add nuw nsw i64 %indvars.iv, 6
%arrayidx45 = getelementptr inbounds [3000 x i8], ptr %str, i64 0, i64 %13
%14 = load i8, ptr %arrayidx45, align 1, !tbaa !11
%cmp47 = icmp eq i8 %14, 111
br i1 %cmp47, label %if.then49, label %while.cond.backedge
if.then49: ; preds = %if.then42
store i8 97, ptr %arrayidx45, align 1, !tbaa !11
br label %while.cond.backedge
while.end: ; preds = %while.cond
%call60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %str)
%inc61 = add nuw nsw i32 %i.073, 1
%15 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc61, %15
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !14
for.end: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 3000, ptr nonnull %str) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
|
#include <stdio.h>
#include <string.h>
int main(void)
{
char str[1028];
int n, i;
char *target_pos;
scanf("%d ", &n);
for (i = 0; i < n; i++){
fgets(str, sizeof(str), stdin);
while ((target_pos = strstr(str, "Hoshino")) != NULL){
target_pos[6] = 'a';
}
printf("%s", str);
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192892/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192892/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@stdin = external local_unnamed_addr global ptr, align 8
@.str.1 = private unnamed_addr constant [8 x i8] c"Hoshino\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:
%str = alloca [1028 x i8], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 1028, ptr nonnull %str) #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
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %while.end
%i.012 = phi i32 [ %inc, %while.end ], [ 0, %entry ]
%1 = load ptr, ptr @stdin, align 8, !tbaa !9
%call1 = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 1028, ptr noundef %1)
%call38 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str.1) #5
%cmp4.not9 = icmp eq ptr %call38, null
br i1 %cmp4.not9, label %while.end, label %while.body
while.body: ; preds = %for.body, %while.body
%call310 = phi ptr [ %call3, %while.body ], [ %call38, %for.body ]
%arrayidx = getelementptr inbounds i8, ptr %call310, i64 6
store i8 97, ptr %arrayidx, align 1, !tbaa !11
%call3 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str.1) #5
%cmp4.not = icmp eq ptr %call3, null
br i1 %cmp4.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %while.body, %for.body
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %str)
%inc = add nuw nsw i32 %i.012, 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 !14
for.end: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 1028, 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
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 ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
|
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
typedef struct{
long long int code;
int steps;
} puzz;
int q[1000000][14],size[100000];
long long int FR,TO,SW;
puzz* hash[100000][20];
void swap (int* x,int* y){
int z;
z=*x;
*x=*y;
*y=z;
}
long long int convert(int a[]){
long long int ret=0;
int i;
for(i=0;i<13;i++)ret=ret*13+a[i];
return ret;
}
void hashadd(long long int code,int step){
int ccc=code%100000;
puzz* ppp=(puzz*)malloc(sizeof(puzz));
ppp->code=code;
ppp->steps=step;
if(size[ccc]>19){fprintf(stderr,"SIZE OVER!! (%d)\n",ccc);return;}
hash[ccc][size[ccc]]=ppp;
size[ccc]++;
}
int hashsearch(long long int code){
int ccc=code%100000;
int i=size[ccc]-1;
for(;i>=0;i--){
if(hash[ccc][i]->code==code)return hash[ccc][i]->steps;
}
return -1;
}
void mark(int x,int y){
int k;
long long int cd;
swap(&q[FR][x],&q[FR][y]);
cd=convert(q[FR]);
if(SW==1 || hashsearch(cd)<0){
for(k=0;k<14;k++){q[TO][k]=q[FR][k];}
q[TO][13]++;
if(SW==0)hashadd(cd,q[TO][13]);
TO++;
}
swap(&q[FR][x],&q[FR][y]);
}
void check(){
if(q[FR][0]==0){mark(0,2);}
if(q[FR][1]==0){mark(1,2);mark(1,5);}
if(q[FR][2]==0){mark(2,0);mark(2,1);mark(2,3);mark(2,6);}
if(q[FR][3]==0){mark(3,2);mark(3,7);}
if(q[FR][4]==0){mark(4,5);}
if(q[FR][5]==0){mark(5,1);mark(5,4);mark(5,6);mark(5,9);}
if(q[FR][6]==0){mark(6,2);mark(6,5);mark(6,7);mark(6,10);}
if(q[FR][7]==0){mark(7,3);mark(7,6);mark(7,8);mark(7,11);}
if(q[FR][8]==0){mark(8,7);}
if(q[FR][9]==0){mark(9,5);mark(9,10);}
if(q[FR][10]==0){mark(10,6);mark(10,9);mark(10,11);mark(10,12);}
if(q[FR][11]==0){mark(11,7);mark(11,10);}
if(q[FR][12]==0){mark(12,10);}
}
int main(){
int i,ans;
long long int cd;
for(i=1;i<12;i++)q[0][i]=i;
q[0][0]=0;q[0][12]=0;q[0][13]=0;
hashadd(convert(q[0]),0);
FR=0;TO=1;SW=0;
while(FR<TO && q[FR][13]<=13){
check();
FR++;
}
while(scanf("%d",&q[0][0])*q[0][0]>=0){
for(i=1;i<13;i++)scanf("%d",&q[0][i]);
q[0][13]=0;FR=0;TO=1;SW=1;ans=9999;
while(FR<TO){
cd=hashsearch(convert(q[FR]));
if(cd>=0){
ans=(int)cd+q[FR][13];
break;
}
if(q[FR][13]<6)check();
FR++;
}
if(ans>20)printf("NA\n"); else printf("%d\n",ans);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192957/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192957/source.c"
target datalayout = "e-m:e-p270: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.puzz = type { i64, i32 }
@size = dso_local local_unnamed_addr global [100000 x i32] zeroinitializer, align 16
@stderr = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [18 x i8] c"SIZE OVER!! (%d)\0A\00", align 1
@hash = dso_local local_unnamed_addr global [100000 x [20 x ptr]] zeroinitializer, align 16
@q = dso_local global [1000000 x [14 x i32]] zeroinitializer, align 16
@FR = dso_local local_unnamed_addr global i64 0, align 8
@SW = dso_local local_unnamed_addr global i64 0, align 8
@TO = dso_local local_unnamed_addr global i64 0, align 8
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\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"NA\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %x, ptr nocapture noundef %y) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
store i32 %1, ptr %x, align 4, !tbaa !5
store i32 %0, ptr %y, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i64 @convert(ptr nocapture noundef readonly %a) local_unnamed_addr #1 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul.1 = mul nsw i64 %conv, 13
%arrayidx.1 = getelementptr inbounds i32, ptr %a, i64 1
%1 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%conv.1 = sext i32 %1 to i64
%add.1 = add nsw i64 %mul.1, %conv.1
%mul.2 = mul nsw i64 %add.1, 13
%arrayidx.2 = getelementptr inbounds i32, ptr %a, i64 2
%2 = load i32, ptr %arrayidx.2, align 4, !tbaa !5
%conv.2 = sext i32 %2 to i64
%add.2 = add nsw i64 %mul.2, %conv.2
%mul.3 = mul nsw i64 %add.2, 13
%arrayidx.3 = getelementptr inbounds i32, ptr %a, i64 3
%3 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%conv.3 = sext i32 %3 to i64
%add.3 = add nsw i64 %mul.3, %conv.3
%mul.4 = mul nsw i64 %add.3, 13
%arrayidx.4 = getelementptr inbounds i32, ptr %a, i64 4
%4 = load i32, ptr %arrayidx.4, align 4, !tbaa !5
%conv.4 = sext i32 %4 to i64
%add.4 = add nsw i64 %mul.4, %conv.4
%mul.5 = mul nsw i64 %add.4, 13
%arrayidx.5 = getelementptr inbounds i32, ptr %a, i64 5
%5 = load i32, ptr %arrayidx.5, align 4, !tbaa !5
%conv.5 = sext i32 %5 to i64
%add.5 = add nsw i64 %mul.5, %conv.5
%mul.6 = mul nsw i64 %add.5, 13
%arrayidx.6 = getelementptr inbounds i32, ptr %a, i64 6
%6 = load i32, ptr %arrayidx.6, align 4, !tbaa !5
%conv.6 = sext i32 %6 to i64
%add.6 = add nsw i64 %mul.6, %conv.6
%mul.7 = mul nsw i64 %add.6, 13
%arrayidx.7 = getelementptr inbounds i32, ptr %a, i64 7
%7 = load i32, ptr %arrayidx.7, align 4, !tbaa !5
%conv.7 = sext i32 %7 to i64
%add.7 = add nsw i64 %mul.7, %conv.7
%mul.8 = mul nsw i64 %add.7, 13
%arrayidx.8 = getelementptr inbounds i32, ptr %a, i64 8
%8 = load i32, ptr %arrayidx.8, align 4, !tbaa !5
%conv.8 = sext i32 %8 to i64
%add.8 = add nsw i64 %mul.8, %conv.8
%mul.9 = mul nsw i64 %add.8, 13
%arrayidx.9 = getelementptr inbounds i32, ptr %a, i64 9
%9 = load i32, ptr %arrayidx.9, align 4, !tbaa !5
%conv.9 = sext i32 %9 to i64
%add.9 = add nsw i64 %mul.9, %conv.9
%mul.10 = mul nsw i64 %add.9, 13
%arrayidx.10 = getelementptr inbounds i32, ptr %a, i64 10
%10 = load i32, ptr %arrayidx.10, align 4, !tbaa !5
%conv.10 = sext i32 %10 to i64
%add.10 = add nsw i64 %mul.10, %conv.10
%mul.11 = mul nsw i64 %add.10, 13
%arrayidx.11 = getelementptr inbounds i32, ptr %a, i64 11
%11 = load i32, ptr %arrayidx.11, align 4, !tbaa !5
%conv.11 = sext i32 %11 to i64
%add.11 = add nsw i64 %mul.11, %conv.11
%mul.12 = mul nsw i64 %add.11, 13
%arrayidx.12 = getelementptr inbounds i32, ptr %a, i64 12
%12 = load i32, ptr %arrayidx.12, align 4, !tbaa !5
%conv.12 = sext i32 %12 to i64
%add.12 = add nsw i64 %mul.12, %conv.12
ret i64 %add.12
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @hashadd(i64 noundef %code, i32 noundef %step) local_unnamed_addr #2 {
entry:
%rem = srem i64 %code, 100000
%call = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #7
store i64 %code, ptr %call, align 8, !tbaa !9
%steps = getelementptr inbounds %struct.puzz, ptr %call, i64 0, i32 1
store i32 %step, ptr %steps, align 8, !tbaa !12
%arrayidx = getelementptr inbounds [100000 x i32], ptr @size, i64 0, i64 %rem
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 19
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%conv = trunc i64 %rem to i32
%1 = load ptr, ptr @stderr, align 8, !tbaa !13
%call3 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %1, ptr noundef nonnull @.str, i32 noundef %conv) #8
br label %cleanup
if.end: ; preds = %entry
%idxprom8 = sext i32 %0 to i64
%arrayidx9 = getelementptr inbounds [100000 x [20 x ptr]], ptr @hash, i64 0, i64 %rem, i64 %idxprom8
store ptr %call, ptr %arrayidx9, align 8, !tbaa !13
%inc = add nsw i32 %0, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
br label %cleanup
cleanup: ; preds = %if.end, %if.then
ret void
}
; 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 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @hashsearch(i64 noundef %code) local_unnamed_addr #5 {
entry:
%rem = srem i64 %code, 100000
%arrayidx = getelementptr inbounds [100000 x i32], ptr @size, i64 0, i64 %rem
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%1 = zext i32 %0 to i64
br label %for.cond
for.cond: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ %3, %for.body ], [ %1, %entry ]
%2 = trunc i64 %indvars.iv to i32
%cmp = icmp sgt i32 %2, 0
br i1 %cmp, label %for.body, label %cleanup
for.body: ; preds = %for.cond
%3 = add nsw i64 %indvars.iv, -1
%arrayidx5 = getelementptr inbounds [100000 x [20 x ptr]], ptr @hash, i64 0, i64 %rem, i64 %3
%4 = load ptr, ptr %arrayidx5, align 8, !tbaa !13
%5 = load i64, ptr %4, align 8, !tbaa !9
%cmp7 = icmp eq i64 %5, %code
br i1 %cmp7, label %if.then, label %for.cond, !llvm.loop !15
if.then: ; preds = %for.body
%steps = getelementptr inbounds %struct.puzz, ptr %4, i64 0, i32 1
%6 = load i32, ptr %steps, align 8, !tbaa !12
br label %cleanup
cleanup: ; preds = %for.cond, %if.then
%retval.0 = phi i32 [ %6, %if.then ], [ -1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @mark(i32 noundef %x, i32 noundef %y) local_unnamed_addr #2 {
entry:
%0 = load i64, ptr @FR, align 8, !tbaa !17
%idxprom = sext i32 %x to i64
%arrayidx1 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %0, i64 %idxprom
%idxprom3 = sext i32 %y to i64
%arrayidx4 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %0, i64 %idxprom3
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%2 = load i32, ptr %arrayidx4, align 4, !tbaa !5
store i32 %2, ptr %arrayidx1, align 4, !tbaa !5
store i32 %1, ptr %arrayidx4, align 4, !tbaa !5
%arrayidx5 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %0
%3 = load i32, ptr %arrayidx5, align 8, !tbaa !5
%conv.i = sext i32 %3 to i64
%mul.1.i = mul nsw i64 %conv.i, 13
%arrayidx.1.i = getelementptr inbounds i32, ptr %arrayidx5, i64 1
%4 = load i32, ptr %arrayidx.1.i, align 4, !tbaa !5
%conv.1.i = sext i32 %4 to i64
%add.1.i = add nsw i64 %mul.1.i, %conv.1.i
%mul.2.i = mul nsw i64 %add.1.i, 13
%arrayidx.2.i = getelementptr inbounds i32, ptr %arrayidx5, i64 2
%5 = load i32, ptr %arrayidx.2.i, align 8, !tbaa !5
%conv.2.i = sext i32 %5 to i64
%add.2.i = add nsw i64 %mul.2.i, %conv.2.i
%mul.3.i = mul nsw i64 %add.2.i, 13
%arrayidx.3.i = getelementptr inbounds i32, ptr %arrayidx5, i64 3
%6 = load i32, ptr %arrayidx.3.i, align 4, !tbaa !5
%conv.3.i = sext i32 %6 to i64
%add.3.i = add nsw i64 %mul.3.i, %conv.3.i
%mul.4.i = mul nsw i64 %add.3.i, 13
%arrayidx.4.i = getelementptr inbounds i32, ptr %arrayidx5, i64 4
%7 = load i32, ptr %arrayidx.4.i, align 8, !tbaa !5
%conv.4.i = sext i32 %7 to i64
%add.4.i = add nsw i64 %mul.4.i, %conv.4.i
%mul.5.i = mul nsw i64 %add.4.i, 13
%arrayidx.5.i = getelementptr inbounds i32, ptr %arrayidx5, i64 5
%8 = load i32, ptr %arrayidx.5.i, align 4, !tbaa !5
%conv.5.i = sext i32 %8 to i64
%add.5.i = add nsw i64 %mul.5.i, %conv.5.i
%mul.6.i = mul nsw i64 %add.5.i, 13
%arrayidx.6.i = getelementptr inbounds i32, ptr %arrayidx5, i64 6
%9 = load i32, ptr %arrayidx.6.i, align 8, !tbaa !5
%conv.6.i = sext i32 %9 to i64
%add.6.i = add nsw i64 %mul.6.i, %conv.6.i
%mul.7.i = mul nsw i64 %add.6.i, 13
%arrayidx.7.i = getelementptr inbounds i32, ptr %arrayidx5, i64 7
%10 = load i32, ptr %arrayidx.7.i, align 4, !tbaa !5
%conv.7.i = sext i32 %10 to i64
%add.7.i = add nsw i64 %mul.7.i, %conv.7.i
%mul.8.i = mul nsw i64 %add.7.i, 13
%arrayidx.8.i = getelementptr inbounds i32, ptr %arrayidx5, i64 8
%11 = load i32, ptr %arrayidx.8.i, align 8, !tbaa !5
%conv.8.i = sext i32 %11 to i64
%add.8.i = add nsw i64 %mul.8.i, %conv.8.i
%mul.9.i = mul nsw i64 %add.8.i, 13
%arrayidx.9.i = getelementptr inbounds i32, ptr %arrayidx5, i64 9
%12 = load i32, ptr %arrayidx.9.i, align 4, !tbaa !5
%conv.9.i = sext i32 %12 to i64
%add.9.i = add nsw i64 %mul.9.i, %conv.9.i
%mul.10.i = mul nsw i64 %add.9.i, 13
%arrayidx.10.i = getelementptr inbounds i32, ptr %arrayidx5, i64 10
%13 = load i32, ptr %arrayidx.10.i, align 8, !tbaa !5
%conv.10.i = sext i32 %13 to i64
%add.10.i = add nsw i64 %mul.10.i, %conv.10.i
%mul.11.i = mul nsw i64 %add.10.i, 13
%arrayidx.11.i = getelementptr inbounds i32, ptr %arrayidx5, i64 11
%14 = load i32, ptr %arrayidx.11.i, align 4, !tbaa !5
%conv.11.i = sext i32 %14 to i64
%add.11.i = add nsw i64 %mul.11.i, %conv.11.i
%mul.12.i = mul nsw i64 %add.11.i, 13
%arrayidx.12.i = getelementptr inbounds i32, ptr %arrayidx5, i64 12
%15 = load i32, ptr %arrayidx.12.i, align 8, !tbaa !5
%conv.12.i = sext i32 %15 to i64
%add.12.i = add nsw i64 %mul.12.i, %conv.12.i
%16 = load i64, ptr @SW, align 8, !tbaa !17
%cmp = icmp eq i64 %16, 1
br i1 %cmp, label %if.then, label %lor.lhs.false
lor.lhs.false: ; preds = %entry
%rem.i = srem i64 %add.12.i, 100000
%arrayidx.i = getelementptr inbounds [100000 x i32], ptr @size, i64 0, i64 %rem.i
%17 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%18 = zext i32 %17 to i64
br label %for.cond.i
for.cond.i: ; preds = %for.body.i, %lor.lhs.false
%indvars.iv.i = phi i64 [ %20, %for.body.i ], [ %18, %lor.lhs.false ]
%19 = trunc i64 %indvars.iv.i to i32
%cmp.i = icmp sgt i32 %19, 0
br i1 %cmp.i, label %for.body.i, label %if.then
for.body.i: ; preds = %for.cond.i
%20 = add nsw i64 %indvars.iv.i, -1
%arrayidx5.i = getelementptr inbounds [100000 x [20 x ptr]], ptr @hash, i64 0, i64 %rem.i, i64 %20
%21 = load ptr, ptr %arrayidx5.i, align 8, !tbaa !13
%22 = load i64, ptr %21, align 8, !tbaa !9
%cmp7.i = icmp eq i64 %22, %add.12.i
br i1 %cmp7.i, label %hashsearch.exit, label %for.cond.i, !llvm.loop !15
hashsearch.exit: ; preds = %for.body.i
%steps.i = getelementptr inbounds %struct.puzz, ptr %21, i64 0, i32 1
%23 = load i32, ptr %steps.i, align 8, !tbaa !12
%cmp7 = icmp slt i32 %23, 0
br i1 %cmp7, label %if.then, label %if.end23
if.then: ; preds = %for.cond.i, %hashsearch.exit, %entry
%24 = load i64, ptr @TO, align 8, !tbaa !17
%arrayidx14 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %24, i64 0
store i32 %3, ptr %arrayidx14, align 8, !tbaa !5
%arrayidx14.1 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %24, i64 1
store i32 %4, ptr %arrayidx14.1, align 4, !tbaa !5
%arrayidx14.2 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %24, i64 2
store i32 %5, ptr %arrayidx14.2, align 8, !tbaa !5
%arrayidx14.3 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %24, i64 3
store i32 %6, ptr %arrayidx14.3, align 4, !tbaa !5
%arrayidx14.4 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %24, i64 4
store i32 %7, ptr %arrayidx14.4, align 8, !tbaa !5
%arrayidx14.5 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %24, i64 5
store i32 %8, ptr %arrayidx14.5, align 4, !tbaa !5
%arrayidx14.6 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %24, i64 6
store i32 %9, ptr %arrayidx14.6, align 8, !tbaa !5
%arrayidx14.7 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %24, i64 7
store i32 %10, ptr %arrayidx14.7, align 4, !tbaa !5
%arrayidx14.8 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %24, i64 8
store i32 %11, ptr %arrayidx14.8, align 8, !tbaa !5
%arrayidx14.9 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %24, i64 9
store i32 %12, ptr %arrayidx14.9, align 4, !tbaa !5
%arrayidx14.10 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %24, i64 10
store i32 %13, ptr %arrayidx14.10, align 8, !tbaa !5
%arrayidx14.11 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %24, i64 11
store i32 %14, ptr %arrayidx14.11, align 4, !tbaa !5
%arrayidx14.12 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %24, i64 12
store i32 %15, ptr %arrayidx14.12, align 8, !tbaa !5
%arrayidx11.13 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %0, i64 13
%25 = load i32, ptr %arrayidx11.13, align 4, !tbaa !5
%arrayidx14.13 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %24, i64 13
%inc17 = add nsw i32 %25, 1
store i32 %inc17, ptr %arrayidx14.13, align 4, !tbaa !5
%cmp18 = icmp eq i64 %16, 0
br i1 %cmp18, label %if.then19, label %if.end
if.then19: ; preds = %if.then
%rem.i36 = srem i64 %add.12.i, 100000
%call.i = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #7
store i64 %add.12.i, ptr %call.i, align 8, !tbaa !9
%steps.i37 = getelementptr inbounds %struct.puzz, ptr %call.i, i64 0, i32 1
store i32 %inc17, ptr %steps.i37, align 8, !tbaa !12
%arrayidx.i38 = getelementptr inbounds [100000 x i32], ptr @size, i64 0, i64 %rem.i36
%26 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%cmp.i39 = icmp sgt i32 %26, 19
br i1 %cmp.i39, label %if.then.i40, label %if.end.i
if.then.i40: ; preds = %if.then19
%conv.i41 = trunc i64 %rem.i36 to i32
%27 = load ptr, ptr @stderr, align 8, !tbaa !13
%call3.i = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef nonnull @.str, i32 noundef %conv.i41) #8
%.pre = load i64, ptr @TO, align 8, !tbaa !17
%.pre46.pre = load i64, ptr @FR, align 8, !tbaa !17
br label %if.end
if.end.i: ; preds = %if.then19
%idxprom8.i = sext i32 %26 to i64
%arrayidx9.i = getelementptr inbounds [100000 x [20 x ptr]], ptr @hash, i64 0, i64 %rem.i36, i64 %idxprom8.i
store ptr %call.i, ptr %arrayidx9.i, align 8, !tbaa !13
%inc.i = add nsw i32 %26, 1
store i32 %inc.i, ptr %arrayidx.i38, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.end.i, %if.then.i40, %if.then
%.pre46 = phi i64 [ %0, %if.end.i ], [ %.pre46.pre, %if.then.i40 ], [ %0, %if.then ]
%28 = phi i64 [ %24, %if.end.i ], [ %.pre, %if.then.i40 ], [ %24, %if.then ]
%inc22 = add nsw i64 %28, 1
store i64 %inc22, ptr @TO, align 8, !tbaa !17
%arrayidx29.phi.trans.insert = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %.pre46, i64 %idxprom3
%.pre47 = load i32, ptr %arrayidx29.phi.trans.insert, align 4, !tbaa !5
br label %if.end23
if.end23: ; preds = %if.end, %hashsearch.exit
%29 = phi i32 [ %.pre47, %if.end ], [ %1, %hashsearch.exit ]
%30 = phi i64 [ %.pre46, %if.end ], [ %0, %hashsearch.exit ]
%arrayidx26 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %30, i64 %idxprom
%arrayidx29 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %30, i64 %idxprom3
%31 = load i32, ptr %arrayidx26, align 4, !tbaa !5
store i32 %29, ptr %arrayidx26, align 4, !tbaa !5
store i32 %31, ptr %arrayidx29, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @check() local_unnamed_addr #2 {
entry:
%0 = load i64, ptr @FR, align 8, !tbaa !17
%arrayidx = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %0
%1 = load i32, ptr %arrayidx, align 8, !tbaa !5
%cmp = icmp eq i32 %1, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
tail call void @mark(i32 noundef 0, i32 noundef 2)
%.pre = load i64, ptr @FR, align 8, !tbaa !17
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i64 [ %.pre, %if.then ], [ %0, %entry ]
%arrayidx3 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %2, i64 1
%3 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp4 = icmp eq i32 %3, 0
br i1 %cmp4, label %if.then5, label %if.end6
if.then5: ; preds = %if.end
tail call void @mark(i32 noundef 1, i32 noundef 2)
tail call void @mark(i32 noundef 1, i32 noundef 5)
%.pre62 = load i64, ptr @FR, align 8, !tbaa !17
br label %if.end6
if.end6: ; preds = %if.then5, %if.end
%4 = phi i64 [ %.pre62, %if.then5 ], [ %2, %if.end ]
%arrayidx8 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %4, i64 2
%5 = load i32, ptr %arrayidx8, align 8, !tbaa !5
%cmp9 = icmp eq i32 %5, 0
br i1 %cmp9, label %if.then10, label %if.end11
if.then10: ; preds = %if.end6
tail call void @mark(i32 noundef 2, i32 noundef 0)
tail call void @mark(i32 noundef 2, i32 noundef 1)
tail call void @mark(i32 noundef 2, i32 noundef 3)
tail call void @mark(i32 noundef 2, i32 noundef 6)
%.pre63 = load i64, ptr @FR, align 8, !tbaa !17
br label %if.end11
if.end11: ; preds = %if.then10, %if.end6
%6 = phi i64 [ %.pre63, %if.then10 ], [ %4, %if.end6 ]
%arrayidx13 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %6, i64 3
%7 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%cmp14 = icmp eq i32 %7, 0
br i1 %cmp14, label %if.then15, label %if.end16
if.then15: ; preds = %if.end11
tail call void @mark(i32 noundef 3, i32 noundef 2)
tail call void @mark(i32 noundef 3, i32 noundef 7)
%.pre64 = load i64, ptr @FR, align 8, !tbaa !17
br label %if.end16
if.end16: ; preds = %if.then15, %if.end11
%8 = phi i64 [ %.pre64, %if.then15 ], [ %6, %if.end11 ]
%arrayidx18 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %8, i64 4
%9 = load i32, ptr %arrayidx18, align 8, !tbaa !5
%cmp19 = icmp eq i32 %9, 0
br i1 %cmp19, label %if.then20, label %if.end21
if.then20: ; preds = %if.end16
tail call void @mark(i32 noundef 4, i32 noundef 5)
%.pre65 = load i64, ptr @FR, align 8, !tbaa !17
br label %if.end21
if.end21: ; preds = %if.then20, %if.end16
%10 = phi i64 [ %.pre65, %if.then20 ], [ %8, %if.end16 ]
%arrayidx23 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %10, i64 5
%11 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp24 = icmp eq i32 %11, 0
br i1 %cmp24, label %if.then25, label %if.end26
if.then25: ; preds = %if.end21
tail call void @mark(i32 noundef 5, i32 noundef 1)
tail call void @mark(i32 noundef 5, i32 noundef 4)
tail call void @mark(i32 noundef 5, i32 noundef 6)
tail call void @mark(i32 noundef 5, i32 noundef 9)
%.pre66 = load i64, ptr @FR, align 8, !tbaa !17
br label %if.end26
if.end26: ; preds = %if.then25, %if.end21
%12 = phi i64 [ %.pre66, %if.then25 ], [ %10, %if.end21 ]
%arrayidx28 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %12, i64 6
%13 = load i32, ptr %arrayidx28, align 8, !tbaa !5
%cmp29 = icmp eq i32 %13, 0
br i1 %cmp29, label %if.then30, label %if.end31
if.then30: ; preds = %if.end26
tail call void @mark(i32 noundef 6, i32 noundef 2)
tail call void @mark(i32 noundef 6, i32 noundef 5)
tail call void @mark(i32 noundef 6, i32 noundef 7)
tail call void @mark(i32 noundef 6, i32 noundef 10)
%.pre67 = load i64, ptr @FR, align 8, !tbaa !17
br label %if.end31
if.end31: ; preds = %if.then30, %if.end26
%14 = phi i64 [ %.pre67, %if.then30 ], [ %12, %if.end26 ]
%arrayidx33 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %14, i64 7
%15 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%cmp34 = icmp eq i32 %15, 0
br i1 %cmp34, label %if.then35, label %if.end36
if.then35: ; preds = %if.end31
tail call void @mark(i32 noundef 7, i32 noundef 3)
tail call void @mark(i32 noundef 7, i32 noundef 6)
tail call void @mark(i32 noundef 7, i32 noundef 8)
tail call void @mark(i32 noundef 7, i32 noundef 11)
%.pre68 = load i64, ptr @FR, align 8, !tbaa !17
br label %if.end36
if.end36: ; preds = %if.then35, %if.end31
%16 = phi i64 [ %.pre68, %if.then35 ], [ %14, %if.end31 ]
%arrayidx38 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %16, i64 8
%17 = load i32, ptr %arrayidx38, align 8, !tbaa !5
%cmp39 = icmp eq i32 %17, 0
br i1 %cmp39, label %if.then40, label %if.end41
if.then40: ; preds = %if.end36
tail call void @mark(i32 noundef 8, i32 noundef 7)
%.pre69 = load i64, ptr @FR, align 8, !tbaa !17
br label %if.end41
if.end41: ; preds = %if.then40, %if.end36
%18 = phi i64 [ %.pre69, %if.then40 ], [ %16, %if.end36 ]
%arrayidx43 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %18, i64 9
%19 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%cmp44 = icmp eq i32 %19, 0
br i1 %cmp44, label %if.then45, label %if.end46
if.then45: ; preds = %if.end41
tail call void @mark(i32 noundef 9, i32 noundef 5)
tail call void @mark(i32 noundef 9, i32 noundef 10)
%.pre70 = load i64, ptr @FR, align 8, !tbaa !17
br label %if.end46
if.end46: ; preds = %if.then45, %if.end41
%20 = phi i64 [ %.pre70, %if.then45 ], [ %18, %if.end41 ]
%arrayidx48 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %20, i64 10
%21 = load i32, ptr %arrayidx48, align 8, !tbaa !5
%cmp49 = icmp eq i32 %21, 0
br i1 %cmp49, label %if.then50, label %if.end51
if.then50: ; preds = %if.end46
tail call void @mark(i32 noundef 10, i32 noundef 6)
tail call void @mark(i32 noundef 10, i32 noundef 9)
tail call void @mark(i32 noundef 10, i32 noundef 11)
tail call void @mark(i32 noundef 10, i32 noundef 12)
%.pre71 = load i64, ptr @FR, align 8, !tbaa !17
br label %if.end51
if.end51: ; preds = %if.then50, %if.end46
%22 = phi i64 [ %.pre71, %if.then50 ], [ %20, %if.end46 ]
%arrayidx53 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %22, i64 11
%23 = load i32, ptr %arrayidx53, align 4, !tbaa !5
%cmp54 = icmp eq i32 %23, 0
br i1 %cmp54, label %if.then55, label %if.end56
if.then55: ; preds = %if.end51
tail call void @mark(i32 noundef 11, i32 noundef 7)
tail call void @mark(i32 noundef 11, i32 noundef 10)
%.pre72 = load i64, ptr @FR, align 8, !tbaa !17
br label %if.end56
if.end56: ; preds = %if.then55, %if.end51
%24 = phi i64 [ %.pre72, %if.then55 ], [ %22, %if.end51 ]
%arrayidx58 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %24, i64 12
%25 = load i32, ptr %arrayidx58, align 8, !tbaa !5
%cmp59 = icmp eq i32 %25, 0
br i1 %cmp59, label %if.then60, label %if.end61
if.then60: ; preds = %if.end56
tail call void @mark(i32 noundef 12, i32 noundef 10)
br label %if.end61
if.end61: ; preds = %if.then60, %if.end56
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, ptr getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 4), align 16, !tbaa !5
store <4 x i32> <i32 8, i32 9, i32 10, i32 11>, ptr getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 8), align 16, !tbaa !5
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, ptr @q, align 16, !tbaa !5
store i32 0, ptr getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 12), align 16, !tbaa !5
store i32 0, ptr getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 13), align 4, !tbaa !5
%call.i = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #7
store i64 2103299351322, ptr %call.i, align 8, !tbaa !9
%steps.i = getelementptr inbounds %struct.puzz, ptr %call.i, i64 0, i32 1
store i32 0, ptr %steps.i, align 8, !tbaa !12
%0 = load i32, ptr getelementptr inbounds ([100000 x i32], ptr @size, i64 0, i64 51322), align 8, !tbaa !5
%cmp.i = icmp sgt i32 %0, 19
br i1 %cmp.i, label %if.then.i, label %if.end.i
if.then.i: ; preds = %entry
%1 = load ptr, ptr @stderr, align 8, !tbaa !13
%call3.i = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %1, ptr noundef nonnull @.str, i32 noundef 51322) #8
br label %land.rhs.preheader
if.end.i: ; preds = %entry
%idxprom8.i = sext i32 %0 to i64
%arrayidx9.i = getelementptr inbounds [100000 x [20 x ptr]], ptr @hash, i64 0, i64 51322, i64 %idxprom8.i
store ptr %call.i, ptr %arrayidx9.i, align 8, !tbaa !13
%inc.i = add nsw i32 %0, 1
store i32 %inc.i, ptr getelementptr inbounds ([100000 x i32], ptr @size, i64 0, i64 51322), align 8, !tbaa !5
br label %land.rhs.preheader
land.rhs.preheader: ; preds = %if.end.i, %if.then.i
store i64 0, ptr @FR, align 8, !tbaa !17
store i64 1, ptr @TO, align 8, !tbaa !17
store i64 0, ptr @SW, align 8, !tbaa !17
br label %land.rhs
land.rhs: ; preds = %land.rhs.preheader, %while.body
%2 = phi i64 [ %inc5, %while.body ], [ 0, %land.rhs.preheader ]
%arrayidx3 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %2, i64 13
%3 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp4 = icmp slt i32 %3, 14
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %land.rhs
tail call void @check()
%4 = load i64, ptr @FR, align 8, !tbaa !17
%inc5 = add nsw i64 %4, 1
store i64 %inc5, ptr @FR, align 8, !tbaa !17
%5 = load i64, ptr @TO, align 8, !tbaa !17
%cmp1 = icmp slt i64 %inc5, %5
br i1 %cmp1, label %land.rhs, label %while.end, !llvm.loop !18
while.end: ; preds = %land.rhs, %while.body
%call7108 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @q)
%6 = load i32, ptr @q, align 16, !tbaa !5
%mul109 = mul nsw i32 %6, %call7108
%cmp8110 = icmp sgt i32 %mul109, -1
br i1 %cmp8110, label %while.body21.preheader, label %while.end44
while.body21.preheader: ; preds = %while.end, %if.end43
%call15 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 1))
%call15.1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 2))
%call15.2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 3))
%call15.3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 4))
%call15.4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 5))
%call15.5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 6))
%call15.6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 7))
%call15.7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 8))
%call15.8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 9))
%call15.9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 10))
%call15.10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 11))
%call15.11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 12))
store i32 0, ptr getelementptr inbounds ([1000000 x [14 x i32]], ptr @q, i64 0, i64 0, i64 13), align 4, !tbaa !5
store i64 0, ptr @FR, align 8, !tbaa !17
store i64 1, ptr @TO, align 8, !tbaa !17
store i64 1, ptr @SW, align 8, !tbaa !17
br label %while.body21
while.body21: ; preds = %while.body21.preheader, %if.end35
%7 = phi i64 [ %30, %if.end35 ], [ 1, %while.body21.preheader ]
%8 = phi i64 [ %inc36, %if.end35 ], [ 0, %while.body21.preheader ]
%arrayidx22 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %8
%9 = load i32, ptr %arrayidx22, align 8, !tbaa !5
%conv.i55 = sext i32 %9 to i64
%mul.1.i56 = mul nsw i64 %conv.i55, 13
%arrayidx.1.i = getelementptr inbounds i32, ptr %arrayidx22, i64 1
%10 = load i32, ptr %arrayidx.1.i, align 4, !tbaa !5
%conv.1.i57 = sext i32 %10 to i64
%add.1.i58 = add nsw i64 %mul.1.i56, %conv.1.i57
%mul.2.i59 = mul nsw i64 %add.1.i58, 13
%arrayidx.2.i = getelementptr inbounds i32, ptr %arrayidx22, i64 2
%11 = load i32, ptr %arrayidx.2.i, align 8, !tbaa !5
%conv.2.i60 = sext i32 %11 to i64
%add.2.i61 = add nsw i64 %mul.2.i59, %conv.2.i60
%mul.3.i62 = mul nsw i64 %add.2.i61, 13
%arrayidx.3.i = getelementptr inbounds i32, ptr %arrayidx22, i64 3
%12 = load i32, ptr %arrayidx.3.i, align 4, !tbaa !5
%conv.3.i63 = sext i32 %12 to i64
%add.3.i64 = add nsw i64 %mul.3.i62, %conv.3.i63
%mul.4.i65 = mul nsw i64 %add.3.i64, 13
%arrayidx.4.i = getelementptr inbounds i32, ptr %arrayidx22, i64 4
%13 = load i32, ptr %arrayidx.4.i, align 8, !tbaa !5
%conv.4.i66 = sext i32 %13 to i64
%add.4.i67 = add nsw i64 %mul.4.i65, %conv.4.i66
%mul.5.i68 = mul nsw i64 %add.4.i67, 13
%arrayidx.5.i = getelementptr inbounds i32, ptr %arrayidx22, i64 5
%14 = load i32, ptr %arrayidx.5.i, align 4, !tbaa !5
%conv.5.i69 = sext i32 %14 to i64
%add.5.i70 = add nsw i64 %mul.5.i68, %conv.5.i69
%mul.6.i71 = mul nsw i64 %add.5.i70, 13
%arrayidx.6.i = getelementptr inbounds i32, ptr %arrayidx22, i64 6
%15 = load i32, ptr %arrayidx.6.i, align 8, !tbaa !5
%conv.6.i72 = sext i32 %15 to i64
%add.6.i73 = add nsw i64 %mul.6.i71, %conv.6.i72
%mul.7.i74 = mul nsw i64 %add.6.i73, 13
%arrayidx.7.i = getelementptr inbounds i32, ptr %arrayidx22, i64 7
%16 = load i32, ptr %arrayidx.7.i, align 4, !tbaa !5
%conv.7.i75 = sext i32 %16 to i64
%add.7.i76 = add nsw i64 %mul.7.i74, %conv.7.i75
%mul.8.i77 = mul nsw i64 %add.7.i76, 13
%arrayidx.8.i = getelementptr inbounds i32, ptr %arrayidx22, i64 8
%17 = load i32, ptr %arrayidx.8.i, align 8, !tbaa !5
%conv.8.i78 = sext i32 %17 to i64
%add.8.i79 = add nsw i64 %mul.8.i77, %conv.8.i78
%mul.9.i80 = mul nsw i64 %add.8.i79, 13
%arrayidx.9.i = getelementptr inbounds i32, ptr %arrayidx22, i64 9
%18 = load i32, ptr %arrayidx.9.i, align 4, !tbaa !5
%conv.9.i81 = sext i32 %18 to i64
%add.9.i82 = add nsw i64 %mul.9.i80, %conv.9.i81
%mul.10.i83 = mul nsw i64 %add.9.i82, 13
%arrayidx.10.i = getelementptr inbounds i32, ptr %arrayidx22, i64 10
%19 = load i32, ptr %arrayidx.10.i, align 8, !tbaa !5
%conv.10.i84 = sext i32 %19 to i64
%add.10.i85 = add nsw i64 %mul.10.i83, %conv.10.i84
%mul.11.i86 = mul nsw i64 %add.10.i85, 13
%arrayidx.11.i = getelementptr inbounds i32, ptr %arrayidx22, i64 11
%20 = load i32, ptr %arrayidx.11.i, align 4, !tbaa !5
%conv.11.i87 = sext i32 %20 to i64
%add.11.i88 = add nsw i64 %mul.11.i86, %conv.11.i87
%mul.12.i89 = mul nsw i64 %add.11.i88, 13
%arrayidx.12.i = getelementptr inbounds i32, ptr %arrayidx22, i64 12
%21 = load i32, ptr %arrayidx.12.i, align 8, !tbaa !5
%conv.12.i90 = sext i32 %21 to i64
%add.12.i91 = add nsw i64 %mul.12.i89, %conv.12.i90
%rem.i92 = srem i64 %add.12.i91, 100000
%arrayidx.i93 = getelementptr inbounds [100000 x i32], ptr @size, i64 0, i64 %rem.i92
%22 = load i32, ptr %arrayidx.i93, align 4, !tbaa !5
%23 = zext i32 %22 to i64
br label %for.cond.i
for.cond.i: ; preds = %for.body.i, %while.body21
%indvars.iv.i = phi i64 [ %25, %for.body.i ], [ %23, %while.body21 ]
%24 = trunc i64 %indvars.iv.i to i32
%cmp.i94 = icmp sgt i32 %24, 0
br i1 %cmp.i94, label %for.body.i, label %if.end
for.body.i: ; preds = %for.cond.i
%25 = add nsw i64 %indvars.iv.i, -1
%arrayidx5.i = getelementptr inbounds [100000 x [20 x ptr]], ptr @hash, i64 0, i64 %rem.i92, i64 %25
%26 = load ptr, ptr %arrayidx5.i, align 8, !tbaa !13
%27 = load i64, ptr %26, align 8, !tbaa !9
%cmp7.i = icmp eq i64 %27, %add.12.i91
br i1 %cmp7.i, label %hashsearch.exit, label %for.cond.i, !llvm.loop !15
hashsearch.exit: ; preds = %for.body.i
%steps.i96 = getelementptr inbounds %struct.puzz, ptr %26, i64 0, i32 1
%28 = load i32, ptr %steps.i96, align 8, !tbaa !12
%cmp25 = icmp sgt i32 %28, -1
br i1 %cmp25, label %while.end37, label %if.end
if.end: ; preds = %for.cond.i, %hashsearch.exit
%arrayidx31 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %8, i64 13
%29 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%cmp32 = icmp slt i32 %29, 6
br i1 %cmp32, label %if.then34, label %if.end35
if.then34: ; preds = %if.end
tail call void @check()
%.pre = load i64, ptr @FR, align 8, !tbaa !17
%.pre116 = load i64, ptr @TO, align 8, !tbaa !17
br label %if.end35
if.end35: ; preds = %if.then34, %if.end
%30 = phi i64 [ %.pre116, %if.then34 ], [ %7, %if.end ]
%31 = phi i64 [ %.pre, %if.then34 ], [ %8, %if.end ]
%inc36 = add nsw i64 %31, 1
store i64 %inc36, ptr @FR, align 8, !tbaa !17
%cmp20 = icmp slt i64 %inc36, %30
br i1 %cmp20, label %while.body21, label %if.then40, !llvm.loop !19
while.end37: ; preds = %hashsearch.exit
%arrayidx29 = getelementptr inbounds [1000000 x [14 x i32]], ptr @q, i64 0, i64 %8, i64 13
%32 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%add = add nsw i32 %32, %28
%cmp38 = icmp sgt i32 %add, 20
br i1 %cmp38, label %if.then40, label %if.else
if.then40: ; preds = %if.end35, %while.end37
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end43
if.else: ; preds = %while.end37
%call42 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %add)
br label %if.end43
if.end43: ; preds = %if.else, %if.then40
%call7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @q)
%33 = load i32, ptr @q, align 16, !tbaa !5
%mul = mul nsw i32 %33, %call7
%cmp8 = icmp sgt i32 %mul, -1
br i1 %cmp8, label %while.body21.preheader, label %while.end44, !llvm.loop !20
while.end44: ; preds = %if.end43, %while.end
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
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 nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { cold }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !6, i64 8}
!11 = !{!"long long", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!11, !11, i64 0}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main() {
int n, k;
scanf("%d %d", &n, &k);
int cnt = 1;
while (n / k != 0) {
n /= k;
cnt++;
}
printf("%d", cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193006/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193006/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%n.promoted = load i32, ptr %n, align 4, !tbaa !5
%div5 = sdiv i32 %n.promoted, %0
%cmp.not6 = icmp eq i32 %div5, 0
br i1 %cmp.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%div8 = phi i32 [ %div, %while.body ], [ %div5, %entry ]
%cnt.07 = phi i32 [ %inc, %while.body ], [ 1, %entry ]
%inc = add nuw nsw i32 %cnt.07, 1
%div = sdiv i32 %div8, %0
%cmp.not = icmp eq i32 %div, 0
br i1 %cmp.not, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i32 %div8, ptr %n, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%cnt.0.lcssa = phi i32 [ %inc, %while.cond.while.end_crit_edge ], [ 1, %entry ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
long long int lr,t,x,h,cnt=0;
scanf("%lld%lld",&x,&h);
lr=x;cnt++;
for(i=2;i<=n;i++)
{
scanf("%lld%lld",&x,&h);
if(x<=lr)
{
cnt--;
lr=t;
}
if((x-h)>lr)
{
cnt++;
lr=x;
}
else
{
cnt++;
lr=x+h;
t=x;
}
}
printf("%lld\n",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_19305/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_19305/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [9 x i8] c"%lld%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%x = alloca i64, align 8
%h = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %h) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %h)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not18 = icmp slt i32 %0, 2
br i1 %cmp.not18, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%1 = load i64, ptr %x, align 8, !tbaa !9
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%cnt.022 = phi i64 [ %cnt.2, %for.body ], [ 1, %for.body.preheader ]
%t.021 = phi i64 [ %t.1, %for.body ], [ undef, %for.body.preheader ]
%lr.020 = phi i64 [ %lr.2, %for.body ], [ %1, %for.body.preheader ]
%i.019 = phi i32 [ %inc9, %for.body ], [ 2, %for.body.preheader ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %h)
%2 = load i64, ptr %x, align 8, !tbaa !9
%cmp3.not = icmp sle i64 %2, %lr.020
%spec.select = select i1 %cmp3.not, i64 %t.021, i64 %lr.020
%dec = sext i1 %cmp3.not to i64
%3 = load i64, ptr %h, align 8, !tbaa !9
%sub = sub nsw i64 %2, %3
%cmp4 = icmp sgt i64 %sub, %spec.select
%add = select i1 %cmp4, i64 0, i64 %3
%lr.2 = add nsw i64 %add, %2
%t.1 = select i1 %cmp4, i64 %t.021, i64 %2
%spec.select17 = add i64 %cnt.022, 1
%cnt.2 = add i64 %spec.select17, %dec
%inc9 = add nuw nsw i32 %i.019, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.019, %4
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%cnt.0.lcssa = phi i64 [ 1, %entry ], [ %cnt.2, %for.body ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.