Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include<stdio.h>
int main(){
int N,A;
scanf("%d",&N);
A = N;
int X=0;
for(int i=0; i<9; i++){
if(A != 0){
X = X + A % 10;
A = A / 10;
}else{
}
}
if(N % X == 0){
printf("Yes");
}else{
printf("No");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144846/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144846/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yes\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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
%cmp1.not = icmp eq i32 %0, 0
br i1 %cmp1.not, label %for.inc.8, label %for.inc
for.inc: ; preds = %entry
%rem = srem i32 %0, 10
%div = sdiv i32 %0, 10
%.off = add i32 %0, 9
%cmp1.not.1 = icmp ult i32 %.off, 19
br i1 %cmp1.not.1, label %for.inc.8, label %for.inc.1
for.inc.1: ; preds = %for.inc
%rem.1 = srem i32 %div, 10
%add.1 = add nsw i32 %rem, %rem.1
%.off47 = add i32 %0, 99
%cmp1.not.2 = icmp ult i32 %.off47, 199
br i1 %cmp1.not.2, label %for.inc.8, label %for.inc.2
for.inc.2: ; preds = %for.inc.1
%div.1 = sdiv i32 %0, 100
%rem.2 = srem i32 %div.1, 10
%add.2 = add nsw i32 %add.1, %rem.2
%.off48 = add i32 %0, 999
%cmp1.not.3 = icmp ult i32 %.off48, 1999
br i1 %cmp1.not.3, label %for.inc.8, label %for.inc.3
for.inc.3: ; preds = %for.inc.2
%div.2 = sdiv i32 %0, 1000
%rem.3 = srem i32 %div.2, 10
%add.3 = add nsw i32 %add.2, %rem.3
%.off49 = add i32 %0, 9999
%cmp1.not.4 = icmp ult i32 %.off49, 19999
br i1 %cmp1.not.4, label %for.inc.8, label %for.inc.4
for.inc.4: ; preds = %for.inc.3
%div.3 = sdiv i32 %0, 10000
%rem.4 = srem i32 %div.3, 10
%add.4 = add nsw i32 %add.3, %rem.4
%.off50 = add i32 %0, 99999
%cmp1.not.5 = icmp ult i32 %.off50, 199999
br i1 %cmp1.not.5, label %for.inc.8, label %for.inc.5
for.inc.5: ; preds = %for.inc.4
%div.4 = sdiv i32 %0, 100000
%rem.5.lhs.trunc = trunc i32 %div.4 to i16
%rem.540 = srem i16 %rem.5.lhs.trunc, 10
%rem.5.sext = sext i16 %rem.540 to i32
%add.5 = add nsw i32 %add.4, %rem.5.sext
%div.5.lhs.trunc = trunc i32 %div.4 to i16
%div.5.lhs.trunc.off = add i16 %div.5.lhs.trunc, 9
%cmp1.not.6 = icmp ult i16 %div.5.lhs.trunc.off, 19
br i1 %cmp1.not.6, label %for.inc.8, label %for.inc.6
for.inc.6: ; preds = %for.inc.5
%div.541 = sdiv i16 %div.5.lhs.trunc, 10
%rem.642 = srem i16 %div.541, 10
%rem.6.sext = sext i16 %rem.642 to i32
%add.6 = add nsw i32 %add.5, %rem.6.sext
%div.5.lhs.trunc.off51 = add i16 %div.5.lhs.trunc, 99
%cmp1.not.7 = icmp ult i16 %div.5.lhs.trunc.off51, 199
br i1 %cmp1.not.7, label %for.inc.8, label %for.inc.7
for.inc.7: ; preds = %for.inc.6
%div.643 = sdiv i16 %div.5.lhs.trunc, 100
%rem.744 = srem i16 %div.643, 10
%rem.7.sext = sext i16 %rem.744 to i32
%add.7 = add nsw i32 %add.6, %rem.7.sext
%div.5.lhs.trunc.off52 = add i16 %div.5.lhs.trunc, 999
%cmp1.not.8 = icmp ult i16 %div.5.lhs.trunc.off52, 1999
br i1 %cmp1.not.8, label %for.inc.8, label %if.then.8
if.then.8: ; preds = %for.inc.7
%div.745 = sdiv i16 %div.5.lhs.trunc, 1000
%rem.8.lhs.trunc = trunc i16 %div.745 to i8
%rem.846 = srem i8 %rem.8.lhs.trunc, 10
%rem.8.sext = sext i8 %rem.846 to i32
%add.8 = add nsw i32 %add.7, %rem.8.sext
br label %for.inc.8
for.inc.8: ; preds = %entry, %for.inc, %for.inc.1, %for.inc.2, %for.inc.3, %for.inc.4, %for.inc.5, %for.inc.6, %if.then.8, %for.inc.7
%X.1.8 = phi i32 [ %add.8, %if.then.8 ], [ %add.7, %for.inc.7 ], [ %add.6, %for.inc.6 ], [ %add.5, %for.inc.5 ], [ %add.4, %for.inc.4 ], [ %add.3, %for.inc.3 ], [ %add.2, %for.inc.2 ], [ %add.1, %for.inc.1 ], [ %rem, %for.inc ], [ 0, %entry ]
%rem2 = srem i32 %0, %X.1.8
%cmp3 = icmp eq i32 %rem2, 0
%.str.1..str.2 = select i1 %cmp3, ptr @.str.1, ptr @.str.2
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
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"}
|
#include <stdio.h>
#include <string.h>
void copy(char *s,char *t, int n)
{
int i;
for (i=0;i<n;i++)
s[i] = t[i];
s[i]=0;
}
void reverse(char *s, char *t, int d)
{
int i;
for (i=0;i<d;i++)
{
s[i] = t[d-1-i];
}
}
int main()
{
int n,i;
char s[101],t[101];
scanf("%d",&n);
scanf("%s",t);
copy(s,t,n);
for (i=2;i<=n;i++)
{
if (n%i == 0)
{
reverse(s,t,i);
copy(t,s,n);
}
}
printf("%s\n",t);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14489/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14489/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @copy(ptr nocapture noundef writeonly %s, ptr nocapture noundef readonly %t, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp10 = icmp sgt i32 %n, 0
br i1 %cmp10, label %iter.check, label %for.end
iter.check: ; preds = %entry
%s13 = ptrtoint ptr %s to i64
%t14 = ptrtoint ptr %t to i64
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
%0 = sub i64 %s13, %t14
%diff.check = icmp ult i64 %0, 32
%or.cond = or i1 %min.iters.check, %diff.check
br i1 %or.cond, label %for.body.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %iter.check
%min.iters.check15 = icmp ult i32 %n, 32
br i1 %min.iters.check15, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.vec = and i64 %wide.trip.count, 4294967264
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%1 = getelementptr inbounds i8, ptr %t, i64 %index
%wide.load = load <16 x i8>, ptr %1, align 1, !tbaa !5
%2 = getelementptr inbounds i8, ptr %1, i64 16
%wide.load16 = load <16 x i8>, ptr %2, align 1, !tbaa !5
%3 = getelementptr inbounds i8, ptr %s, i64 %index
store <16 x i8> %wide.load, ptr %3, align 1, !tbaa !5
%4 = getelementptr inbounds i8, ptr %3, i64 16
store <16 x i8> %wide.load16, ptr %4, align 1, !tbaa !5
%index.next = add nuw i64 %index, 32
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end.loopexit, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%n.vec.remaining = and i64 %wide.trip.count, 24
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
br i1 %min.epilog.iters.check, label %for.body.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
%n.vec18 = and i64 %wide.trip.count, 4294967288
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index20 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next22, %vec.epilog.vector.body ]
%6 = getelementptr inbounds i8, ptr %t, i64 %index20
%wide.load21 = load <8 x i8>, ptr %6, align 1, !tbaa !5
%7 = getelementptr inbounds i8, ptr %s, i64 %index20
store <8 x i8> %wide.load21, ptr %7, align 1, !tbaa !5
%index.next22 = add nuw i64 %index20, 8
%8 = icmp eq i64 %index.next22, %n.vec18
br i1 %8, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !12
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n19 = icmp eq i64 %n.vec18, %wide.trip.count
br i1 %cmp.n19, label %for.end.loopexit, label %for.body.preheader
for.body.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec18, %vec.epilog.middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader ]
%arrayidx.prol = getelementptr inbounds i8, ptr %t, i64 %indvars.iv.prol
%11 = load i8, ptr %arrayidx.prol, align 1, !tbaa !5
%arrayidx2.prol = getelementptr inbounds i8, ptr %s, i64 %indvars.iv.prol
store i8 %11, ptr %arrayidx2.prol, align 1, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !13
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.end.loopexit, label %for.body
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%arrayidx = getelementptr inbounds i8, ptr %t, i64 %indvars.iv
%13 = load i8, ptr %arrayidx, align 1, !tbaa !5
%arrayidx2 = getelementptr inbounds i8, ptr %s, i64 %indvars.iv
store i8 %13, ptr %arrayidx2, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i8, ptr %t, i64 %indvars.iv.next
%14 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%arrayidx2.1 = getelementptr inbounds i8, ptr %s, i64 %indvars.iv.next
store i8 %14, ptr %arrayidx2.1, align 1, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds i8, ptr %t, i64 %indvars.iv.next.1
%15 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
%arrayidx2.2 = getelementptr inbounds i8, ptr %s, i64 %indvars.iv.next.1
store i8 %15, ptr %arrayidx2.2, align 1, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds i8, ptr %t, i64 %indvars.iv.next.2
%16 = load i8, ptr %arrayidx.3, align 1, !tbaa !5
%arrayidx2.3 = getelementptr inbounds i8, ptr %s, i64 %indvars.iv.next.2
store i8 %16, ptr %arrayidx2.3, align 1, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.end.loopexit, label %for.body, !llvm.loop !15
for.end.loopexit: ; preds = %for.body.prol.loopexit, %for.body, %vec.epilog.middle.block, %middle.block
%17 = zext i32 %n to i64
br label %for.end
for.end: ; preds = %entry, %for.end.loopexit
%i.0.lcssa = phi i64 [ %17, %for.end.loopexit ], [ 0, %entry ]
%arrayidx4 = getelementptr inbounds i8, ptr %s, i64 %i.0.lcssa
store i8 0, ptr %arrayidx4, align 1, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @reverse(ptr nocapture noundef writeonly %s, ptr nocapture noundef readonly %t, i32 noundef %d) local_unnamed_addr #0 {
entry:
%cmp8 = icmp sgt i32 %d, 0
br i1 %cmp8, label %iter.check, label %for.end
iter.check: ; preds = %entry
%wide.trip.count = zext i32 %d to i64
%min.iters.check = icmp ult i32 %d, 8
br i1 %min.iters.check, label %for.body.preheader, label %vector.scevcheck
vector.scevcheck: ; preds = %iter.check
%0 = add nsw i64 %wide.trip.count, -1
%1 = add i32 %d, -1
%2 = trunc i64 %0 to i32
%3 = sub i32 %1, %2
%4 = icmp sgt i32 %3, %1
%5 = icmp ugt i64 %0, 4294967295
%6 = or i1 %4, %5
br i1 %6, label %for.body.preheader, label %vector.memcheck
vector.memcheck: ; preds = %vector.scevcheck
%scevgep = getelementptr i8, ptr %s, i64 %wide.trip.count
%7 = add i32 %d, -1
%8 = sext i32 %7 to i64
%9 = add nsw i64 %8, 1
%10 = sub nsw i64 %9, %wide.trip.count
%scevgep11 = getelementptr i8, ptr %t, i64 %10
%11 = getelementptr i8, ptr %t, i64 %8
%scevgep12 = getelementptr i8, ptr %11, i64 1
%bound0 = icmp ugt ptr %scevgep12, %s
%bound1 = icmp ult ptr %scevgep11, %scevgep
%found.conflict = and i1 %bound0, %bound1
br i1 %found.conflict, label %for.body.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %vector.memcheck
%min.iters.check13 = icmp ult i32 %d, 32
br i1 %min.iters.check13, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.vec = and i64 %wide.trip.count, 4294967264
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%offset.idx = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%12 = trunc i64 %offset.idx to i32
%13 = xor i32 %12, -1
%14 = add i32 %13, %d
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, ptr %t, i64 %15
%17 = getelementptr inbounds i8, ptr %16, i64 -15
%wide.load = load <16 x i8>, ptr %17, align 1, !tbaa !5, !alias.scope !16
%reverse = shufflevector <16 x i8> %wide.load, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%18 = getelementptr inbounds i8, ptr %16, i64 -31
%wide.load14 = load <16 x i8>, ptr %18, align 1, !tbaa !5, !alias.scope !16
%reverse15 = shufflevector <16 x i8> %wide.load14, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%19 = getelementptr inbounds i8, ptr %s, i64 %offset.idx
store <16 x i8> %reverse, ptr %19, align 1, !tbaa !5, !alias.scope !19, !noalias !16
%20 = getelementptr inbounds i8, ptr %19, i64 16
store <16 x i8> %reverse15, ptr %20, align 1, !tbaa !5, !alias.scope !19, !noalias !16
%index.next = add nuw i64 %offset.idx, 32
%21 = icmp eq i64 %index.next, %n.vec
br i1 %21, label %middle.block, label %vector.body, !llvm.loop !21
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%n.vec.remaining = and i64 %wide.trip.count, 24
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
br i1 %min.epilog.iters.check, label %for.body.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
%n.vec17 = and i64 %wide.trip.count, 4294967288
%invariant.gep = getelementptr i8, ptr %t, i64 -7
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%offset.idx19 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next22, %vec.epilog.vector.body ]
%22 = trunc i64 %offset.idx19 to i32
%23 = xor i32 %22, -1
%24 = add i32 %23, %d
%25 = sext i32 %24 to i64
%gep = getelementptr i8, ptr %invariant.gep, i64 %25
%wide.load20 = load <8 x i8>, ptr %gep, align 1, !tbaa !5, !alias.scope !22
%reverse21 = shufflevector <8 x i8> %wide.load20, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%26 = getelementptr inbounds i8, ptr %s, i64 %offset.idx19
store <8 x i8> %reverse21, ptr %26, align 1, !tbaa !5, !alias.scope !25, !noalias !22
%index.next22 = add nuw i64 %offset.idx19, 8
%27 = icmp eq i64 %index.next22, %n.vec17
br i1 %27, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !27
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n18 = icmp eq i64 %n.vec17, %wide.trip.count
br i1 %cmp.n18, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %vector.memcheck, %vector.scevcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.memcheck ], [ 0, %vector.scevcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec17, %vec.epilog.middle.block ]
%xtraiter = and i64 %wide.trip.count, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader
%28 = trunc i64 %indvars.iv.ph to i32
%29 = xor i32 %28, -1
%sub1.prol = add i32 %29, %d
%idxprom.prol = sext i32 %sub1.prol to i64
%arrayidx.prol = getelementptr inbounds i8, ptr %t, i64 %idxprom.prol
%30 = load i8, ptr %arrayidx.prol, align 1, !tbaa !5
%arrayidx3.prol = getelementptr inbounds i8, ptr %s, i64 %indvars.iv.ph
store i8 %30, ptr %arrayidx3.prol, align 1, !tbaa !5
%indvars.iv.next.prol = or i64 %indvars.iv.ph, 1
br label %for.body.prol.loopexit
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader ], [ %indvars.iv.next.prol, %for.body.prol ]
%31 = sub nsw i64 0, %wide.trip.count
%32 = xor i64 %indvars.iv.ph, %31
%33 = icmp eq i64 %32, -1
br i1 %33, label %for.end, label %for.body
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%34 = trunc i64 %indvars.iv to i32
%35 = xor i32 %34, -1
%sub1 = add i32 %35, %d
%idxprom = sext i32 %sub1 to i64
%arrayidx = getelementptr inbounds i8, ptr %t, i64 %idxprom
%36 = load i8, ptr %arrayidx, align 1, !tbaa !5
%arrayidx3 = getelementptr inbounds i8, ptr %s, i64 %indvars.iv
store i8 %36, ptr %arrayidx3, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%37 = trunc i64 %indvars.iv.next to i32
%38 = xor i32 %37, -1
%sub1.1 = add i32 %38, %d
%idxprom.1 = sext i32 %sub1.1 to i64
%arrayidx.1 = getelementptr inbounds i8, ptr %t, i64 %idxprom.1
%39 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
%arrayidx3.1 = getelementptr inbounds i8, ptr %s, i64 %indvars.iv.next
store i8 %39, ptr %arrayidx3.1, align 1, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.end, label %for.body, !llvm.loop !28
for.end: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %vec.epilog.middle.block, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%s = alloca [101 x i8], align 16
%t = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %s) #6
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %t) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t)
%0 = load i32, ptr %n, align 4, !tbaa !29
%cmp10.i = icmp sgt i32 %0, 0
br i1 %cmp10.i, label %copy.exit, label %for.end
copy.exit: ; preds = %entry
%wide.trip.count.i = zext i32 %0 to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %s, ptr nonnull align 16 %t, i64 %wide.trip.count.i, i1 false), !tbaa !5
%arrayidx4.i = getelementptr inbounds i8, ptr %s, i64 %wide.trip.count.i
store i8 0, ptr %arrayidx4.i, align 1, !tbaa !5
%cmp.not34 = icmp eq i32 %0, 1
br i1 %cmp.not34, label %for.end, label %for.body.lr.ph.split.us
for.body.lr.ph.split.us: ; preds = %copy.exit
%wide.trip.count.i25 = zext i32 %0 to i64
%arrayidx4.i23.us = getelementptr inbounds i8, ptr %t, i64 %wide.trip.count.i25
%1 = add nuw i32 %0, 1
%wide.trip.count41 = zext i32 %1 to i64
%invariant.gep = getelementptr i8, ptr %t, i64 -7
%invariant.gep57 = getelementptr i8, ptr %s, i64 1
br label %for.body.us
for.body.us: ; preds = %for.inc.us, %for.body.lr.ph.split.us
%indvar = phi i64 [ %indvar.next, %for.inc.us ], [ 0, %for.body.lr.ph.split.us ]
%indvars.iv38 = phi i64 [ %indvars.iv.next39, %for.inc.us ], [ 2, %for.body.lr.ph.split.us ]
%2 = add i64 %indvar, 1
%3 = trunc i64 %indvars.iv38 to i32
%rem.us = srem i32 %0, %3
%cmp4.us = icmp eq i32 %rem.us, 0
br i1 %cmp4.us, label %iter.check, label %for.inc.us
iter.check: ; preds = %for.body.us
%4 = add i64 %indvar, 1
%min.iters.check = icmp ugt i64 %indvars.iv38, 7
%.not = icmp ult i64 %4, 2147483648
%or.cond = select i1 %min.iters.check, i1 %.not, i1 false
br i1 %or.cond, label %vector.main.loop.iter.check, label %for.body.i16.us.preheader
vector.main.loop.iter.check: ; preds = %iter.check
%min.iters.check47 = icmp ult i64 %indvars.iv38, 32
br i1 %min.iters.check47, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.vec = and i64 %indvars.iv38, 9223372036854775776
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%5 = xor i64 %index, -1
%6 = add nsw i64 %indvars.iv38, %5
%7 = shl i64 %6, 32
%8 = ashr exact i64 %7, 32
%9 = getelementptr inbounds i8, ptr %t, i64 %8
%10 = getelementptr inbounds i8, ptr %9, i64 -15
%wide.load = load <16 x i8>, ptr %10, align 1, !tbaa !5
%reverse = shufflevector <16 x i8> %wide.load, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%11 = getelementptr inbounds i8, ptr %9, i64 -31
%wide.load48 = load <16 x i8>, ptr %11, align 1, !tbaa !5
%reverse49 = shufflevector <16 x i8> %wide.load48, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%12 = getelementptr inbounds i8, ptr %s, i64 %index
store <16 x i8> %reverse, ptr %12, align 16, !tbaa !5
%13 = getelementptr inbounds i8, ptr %12, i64 16
store <16 x i8> %reverse49, ptr %13, align 16, !tbaa !5
%index.next = add nuw i64 %index, 32
%14 = icmp eq i64 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !31
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %indvars.iv38, %n.vec
br i1 %cmp.n, label %for.body.i26.us.preheader, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%n.vec.remaining = and i64 %indvars.iv38, 24
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
br i1 %min.epilog.iters.check, label %for.body.i16.us.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
%n.vec51 = and i64 %indvars.iv38, 9223372036854775800
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index53 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next56, %vec.epilog.vector.body ]
%15 = xor i64 %index53, -1
%16 = add nsw i64 %indvars.iv38, %15
%17 = shl i64 %16, 32
%18 = ashr exact i64 %17, 32
%gep = getelementptr i8, ptr %invariant.gep, i64 %18
%wide.load54 = load <8 x i8>, ptr %gep, align 1, !tbaa !5
%reverse55 = shufflevector <8 x i8> %wide.load54, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%19 = getelementptr inbounds i8, ptr %s, i64 %index53
store <8 x i8> %reverse55, ptr %19, align 8, !tbaa !5
%index.next56 = add nuw i64 %index53, 8
%20 = icmp eq i64 %index.next56, %n.vec51
br i1 %20, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !32
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n52 = icmp eq i64 %indvars.iv38, %n.vec51
br i1 %cmp.n52, label %for.body.i26.us.preheader, label %for.body.i16.us.preheader
for.body.i16.us.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv.i17.us.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec51, %vec.epilog.middle.block ]
%xtraiter = and i64 %indvars.iv38, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i16.us.prol.loopexit, label %for.body.i16.us.prol
for.body.i16.us.prol: ; preds = %for.body.i16.us.preheader
%21 = xor i64 %indvars.iv.i17.us.ph, -1
%sub1.i.us.prol = add nsw i64 %indvars.iv38, %21
%sext43.prol = shl i64 %sub1.i.us.prol, 32
%idxprom.i.us.prol = ashr exact i64 %sext43.prol, 32
%arrayidx.i18.us.prol = getelementptr inbounds i8, ptr %t, i64 %idxprom.i.us.prol
%22 = load i8, ptr %arrayidx.i18.us.prol, align 1, !tbaa !5
%arrayidx3.i.us.prol = getelementptr inbounds i8, ptr %s, i64 %indvars.iv.i17.us.ph
store i8 %22, ptr %arrayidx3.i.us.prol, align 8, !tbaa !5
%indvars.iv.next.i19.us.prol = or i64 %indvars.iv.i17.us.ph, 1
br label %for.body.i16.us.prol.loopexit
for.body.i16.us.prol.loopexit: ; preds = %for.body.i16.us.prol, %for.body.i16.us.preheader
%indvars.iv.i17.us.unr = phi i64 [ %indvars.iv.i17.us.ph, %for.body.i16.us.preheader ], [ %indvars.iv.next.i19.us.prol, %for.body.i16.us.prol ]
%23 = icmp eq i64 %2, %indvars.iv.i17.us.ph
br i1 %23, label %for.body.i26.us.preheader, label %for.body.i16.us
for.body.i16.us: ; preds = %for.body.i16.us.prol.loopexit, %for.body.i16.us
%indvars.iv.i17.us = phi i64 [ %indvars.iv.next.i19.us.1, %for.body.i16.us ], [ %indvars.iv.i17.us.unr, %for.body.i16.us.prol.loopexit ]
%24 = xor i64 %indvars.iv.i17.us, -1
%sub1.i.us = add nsw i64 %indvars.iv38, %24
%sext43 = shl i64 %sub1.i.us, 32
%idxprom.i.us = ashr exact i64 %sext43, 32
%arrayidx.i18.us = getelementptr inbounds i8, ptr %t, i64 %idxprom.i.us
%25 = load i8, ptr %arrayidx.i18.us, align 1, !tbaa !5
%arrayidx3.i.us = getelementptr inbounds i8, ptr %s, i64 %indvars.iv.i17.us
store i8 %25, ptr %arrayidx3.i.us, align 1, !tbaa !5
%reass.sub = sub i64 %indvars.iv38, %indvars.iv.i17.us
%sub1.i.us.1 = shl i64 %reass.sub, 32
%sext43.1 = add i64 %sub1.i.us.1, -8589934592
%idxprom.i.us.1 = ashr exact i64 %sext43.1, 32
%arrayidx.i18.us.1 = getelementptr inbounds i8, ptr %t, i64 %idxprom.i.us.1
%26 = load i8, ptr %arrayidx.i18.us.1, align 1, !tbaa !5
%gep58 = getelementptr i8, ptr %invariant.gep57, i64 %indvars.iv.i17.us
store i8 %26, ptr %gep58, align 1, !tbaa !5
%indvars.iv.next.i19.us.1 = add nuw nsw i64 %indvars.iv.i17.us, 2
%exitcond.not.i20.us.1 = icmp eq i64 %indvars.iv.next.i19.us.1, %indvars.iv38
br i1 %exitcond.not.i20.us.1, label %for.body.i26.us.preheader, label %for.body.i16.us, !llvm.loop !33
for.body.i26.us.preheader: ; preds = %for.body.i16.us.prol.loopexit, %for.body.i16.us, %vec.epilog.middle.block, %middle.block
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %t, ptr nonnull align 16 %s, i64 %wide.trip.count.i25, i1 false), !tbaa !5
store i8 0, ptr %arrayidx4.i23.us, align 1, !tbaa !5
br label %for.inc.us
for.inc.us: ; preds = %for.body.i26.us.preheader, %for.body.us
%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
%exitcond42.not = icmp eq i64 %indvars.iv.next39, %wide.trip.count41
%indvar.next = add i64 %indvar, 1
br i1 %exitcond42.not, label %for.end, label %for.body.us, !llvm.loop !34
for.end: ; preds = %for.inc.us, %entry, %copy.exit
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %t)
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %t) #6
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %s) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !10, !11}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !9, !10}
!16 = !{!17}
!17 = distinct !{!17, !18}
!18 = distinct !{!18, !"LVerDomain"}
!19 = !{!20}
!20 = distinct !{!20, !18}
!21 = distinct !{!21, !9, !10, !11}
!22 = !{!23}
!23 = distinct !{!23, !24}
!24 = distinct !{!24, !"LVerDomain"}
!25 = !{!26}
!26 = distinct !{!26, !24}
!27 = distinct !{!27, !9, !10, !11}
!28 = distinct !{!28, !9, !10}
!29 = !{!30, !30, i64 0}
!30 = !{!"int", !6, i64 0}
!31 = distinct !{!31, !9, !10, !11}
!32 = distinct !{!32, !9, !10, !11}
!33 = distinct !{!33, !9, !10}
!34 = distinct !{!34, !9}
|
#include <stdio.h>
#include <stdbool.h>
int digit_sum(int n){
int res=0;
while(n>0){
res += n%10;
n /= 10;
}
return res;
}
int main(){
int n;
scanf("%d",&n);
if(n%digit_sum(n)==0) printf("Yes\n");
else printf("No\n");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144932/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144932/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @digit_sum(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp4 = icmp sgt i32 %n, 0
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%res.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%n.addr.05 = phi i32 [ %div, %while.body ], [ %n, %entry ]
%rem = urem i32 %n.addr.05, 10
%add = add nuw nsw i32 %res.06, %rem
%div = udiv i32 %n.addr.05, 10
%cmp.not = icmp ult i32 %n.addr.05, 10
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%res.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %res.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 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 !7
%cmp4.i = icmp sgt i32 %0, 0
br i1 %cmp4.i, label %while.body.i, label %digit_sum.exit
while.body.i: ; preds = %entry, %while.body.i
%res.06.i = phi i32 [ %add.i, %while.body.i ], [ 0, %entry ]
%n.addr.05.i = phi i32 [ %div.i, %while.body.i ], [ %0, %entry ]
%rem.i = urem i32 %n.addr.05.i, 10
%add.i = add nuw nsw i32 %rem.i, %res.06.i
%div.i = udiv i32 %n.addr.05.i, 10
%cmp.not.i = icmp ult i32 %n.addr.05.i, 10
br i1 %cmp.not.i, label %digit_sum.exit, label %while.body.i, !llvm.loop !5
digit_sum.exit: ; preds = %while.body.i, %entry
%res.0.lcssa.i = phi i32 [ 0, %entry ], [ %add.i, %while.body.i ]
%rem = srem i32 %0, %res.0.lcssa.i
%cmp = icmp eq i32 %rem, 0
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
|
/*
cat <<EOF >mistaken-paste
*/
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>
#define BIG 2000000007
#define VERYBIG 200000000000007LL
#define MOD 1000000007
#define FOD 998244353
typedef uint64_t ull;
typedef int64_t sll;
#define N_MAX 300000
#define M_MAX 200000
#ifdef __cplusplus
#include <queue>
#include <stack>
// #include <tuple>
#include <set>
#include <map>
// using namespace std; // HELL
using std::queue;
using std::priority_queue;
using std::stack;
// using std::tuple;
using std::set;
using std::map;
using std::vector;
using std::greater;
using std::pair;
#endif
typedef struct {
int32_t a;
int32_t b;
} hw;
typedef struct {
sll a;
sll b;
} hwll;
typedef struct {
sll a;
sll b;
sll c;
} hwllc;
typedef struct {
hwll a;
hwll b;
} linell;
ull n, m;
ull h, w;
ull k;
ull q;
ull vua, vub, vuc, vud, vue, vuf;
sll vsa, vsb, vsc, vsd, vse, vsf;
long double vra, vrb, vrc;
double vda, vdb, vdc;
size_t slen;
size_t tlen;
char ch, dh;
ull umin (ull x, ull y) {
return (x < y) ? x : y;
}
ull umax (ull x, ull y) {
return (x > y) ? x : y;
}
sll smin (sll x, sll y) {
return (x < y) ? x : y;
}
sll smax (sll x, sll y) {
return (x > y) ? x : y;
}
ull gcd (ull x, ull y) {
if (x < y) {
return gcd(y, x);
} else if (y == 0) {
return x;
} else {
return gcd(y, x % y);
}
}
ull bitpow (ull a, ull x, ull modulo) {
ull result = 1;
while (x) {
if (x & 1) {
result *= a;
result %= modulo;
}
x /= 2;
a = (a * a) % modulo;
}
return result;
}
ull divide (ull a, ull b, ull modulo) {
return (a * bitpow(b, modulo - 2, modulo)) % modulo;
}
ull udiff (ull a, ull b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
sll sdiff (sll a, sll b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
void printUquotient (ull left, ull right) {
const int32_t digits = 20;
printf("%llu.", left / right);
left %= right;
for (int32_t i = 0; i < digits; i++) {
left *= 10;
printf("%1d", left / right);
left %= right;
}
puts("");
return;
}
void printSquotient (sll left, sll right) {
if (left * right < 0) putchar('-');
printUquotient(sdiff(left, 0), sdiff(right, 0));
return;
}
int bitcount (ull n) {
int result = 0;
while (n) {
if (n & 1) result++;
n /= 2;
}
return result;
}
#ifdef __cplusplus
bool setfind (set<ull> s, ull x) {
return (s.find(x) != s.end());
}
#endif
// double distance (sll x1, sll y1, sll x2, sll y2) {
// double xdist2, ydist2, origindist, dist;
// xdist2 = (x1 - x2) * (x1 - x2);
// ydist2 = (y1 - y2) * (y1 - y2);
// return sqrt(xdist2 + ydist2);
// }
int32_t pullcomp (const void *left, const void *right) {
ull l = *(ull*)left;
ull r = *(ull*)right;
if (l < r) {
return -1;
}
if (l > r) {
return +1;
}
return 0;
}
int32_t psllcomp (const void *left, const void *right) {
sll l = *(sll*)left;
sll r = *(sll*)right;
if (l < r) {
return -1;
}
if (l > r) {
return +1;
}
return 0;
}
int32_t pcharcomp (const void *left, const void *right) {
char l = *(char*)left;
char r = *(char*)right;
if (l < r) {
return -1;
}
if (l > r) {
return +1;
}
return 0;
}
int32_t pstrcomp (const void *left, const void *right) {
char* l = *(char**)left;
char* r = *(char**)right;
return strcmp(l, r);
}
int32_t phwllABcomp (const void *left, const void *right) {
hwll l = *(hwll*)left;
hwll r = *(hwll*)right;
if (l.a < r.a) {
return -1;
}
if (l.a > r.a) {
return +1;
}
if (l.b < r.b) {
return -1;
}
if (l.b > r.b) {
return +1;
}
return 0;
}
int32_t phwllREVcomp (const void *left, const void *right) {
hwll l = *(hwll*)left;
hwll r = *(hwll*)right;
if (l.b < r.b) {
return -1;
}
if (l.b > r.b) {
return +1;
}
if (l.a < r.a) {
return -1;
}
if (l.a > r.a) {
return +1;
}
return 0;
}
int32_t ptriplecomp (const void *left, const void *right) {
hwllc l = *(hwllc*)left;
hwllc r = *(hwllc*)right;
if (l.a < r.a) {
return -1;
}
if (l.a > r.a) {
return +1;
}
if (l.b < r.b) {
return -1;
}
if (l.b > r.b) {
return +1;
}
if (l.c < r.c) {
return -1;
}
if (l.c > r.c) {
return +1;
}
return 0;
}
bool isinrange (sll left, sll x, sll right) {
return (left <= x && x <= right);
}
bool isinrange_soft (sll left, sll x, sll right) {
return (left <= x && x <= right) || (left >= x && x >= right);
}
ull parent[N_MAX];
ull rank[N_MAX];
void uf_init (ull n) {
for (sll i = 0; i < n; i++) {
parent[i] = i;
rank[i] = 0;
}
}
ull uf_find (ull x) {
if (parent[x] == x) return x;
return parent[x] = uf_find(parent[x]);
}
bool uf_union (ull a, ull b) {
a = uf_find(a);
b = uf_find(b);
if (a == b) return false;
if (rank[a] > rank[b]) {
parent[b] = a;
} else {
parent[a] = b;
if (rank[a] == rank[b]) {
rank[b]++;
}
}
return true;
}
sll a[N_MAX];
// sll a[3001][3001];
sll b[N_MAX];
sll c[N_MAX];
char s[N_MAX + 1];
// char s[3010][3010];
char t[N_MAX + 1];
// hwll xy[N_MAX];
ull dig (ull n) {
if (n == 0) return 0;
return dig(n / 10) + (n % 10);
}
ull solve () {
sll i, j, ki, li;
ull result = 0;
// sll result = 0;
double dresult = 0;
// ull maybe = 0;
sll maybe = 0;
// ull sum = 0;
sll sum = 0;
sll item;
ull *dpcell;
if (n % dig(n)) {
goto fail;
} else {
goto success;
}
printf("%llu\n", result);
// printf("%.15lf\n", dresult);
// puts(s);
return 0;
success:
// puts("YES");
puts("Yes");
// printf("%llu\n", result);
// puts("0");
// puts("First");
return 0;
fail:
// puts("NO");
puts("No");
// puts("0");
// puts("-1");
// puts("-1 -1 -1");
// puts("Second");
return 1;
}
int32_t main (void) {
int32_t i, j;
int32_t x, y;
// scanf("%lf%lf", &vda, &vdb, &vdc);
// scanf("%lld%lld", &vsa, &vsb, &vsc, &vsd);
// scanf("%llu%llu%llu%llu", &vua, &vub, &vuc, &vud);
// scanf("%*llu%*llu");
// scanf("%llu%llu", &h, &w);
scanf("%llu", &n, &m);
// scanf("%llu", &k, &n);
// scanf("%llu%llu", &vua, &vub, &vuc, &vud, &vue, &vuf);
// vua--;
// vub--;
// vuc--;
// vud--;
// scanf("%lld%lld", &vsa, &vsb, &vsc);
// scanf("%s", s);
// scanf("%s", t);
// scanf("%llu", &k);
// scanf("%llu", &q);
// for (i = 0; i < n; i++) {
// scanf("%lld", &a[i]);
// // scanf("%lld", &b[i]);
// // scanf("%lld%lld", &xy[i].a, &xy[i].b);
// // scanf("%lld", &c[i]);
// // a[i]--;
// // b[i]--;
// // c[i]--;
// }
// scanf("%llu%llu", &m, &k);
// for (i = 0; i < m; i++) {
// scanf("%llu", &b[i]);
// b[i]--;
// }
// scanf("%llu", &q);
// for (i = 0; i < n; i++) {
// for (j = 0; j < n; j++) {
// scanf("%llu", &a[i][j]);
// }
// }
// for (i = 0; i < h; i++) {
// scanf("%s", &s[i]);
// }
// scanf("%llu", &k);
// scanf("%llu", &q);
solve();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_144983/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_144983/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%llu.\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%1d\00", align 1
@parent = dso_local local_unnamed_addr global [300000 x i64] zeroinitializer, align 16
@rank = dso_local local_unnamed_addr global [300000 x i64] zeroinitializer, align 16
@n = dso_local global i64 0, align 8
@.str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.5 = private unnamed_addr constant [5 x i8] c"%llu\00", align 1
@m = dso_local global i64 0, align 8
@h = dso_local local_unnamed_addr global i64 0, align 8
@w = dso_local local_unnamed_addr global i64 0, align 8
@k = dso_local local_unnamed_addr global i64 0, align 8
@q = dso_local local_unnamed_addr global i64 0, align 8
@vua = dso_local local_unnamed_addr global i64 0, align 8
@vub = dso_local local_unnamed_addr global i64 0, align 8
@vuc = dso_local local_unnamed_addr global i64 0, align 8
@vud = dso_local local_unnamed_addr global i64 0, align 8
@vue = dso_local local_unnamed_addr global i64 0, align 8
@vuf = dso_local local_unnamed_addr global i64 0, align 8
@vsa = dso_local local_unnamed_addr global i64 0, align 8
@vsb = dso_local local_unnamed_addr global i64 0, align 8
@vsc = dso_local local_unnamed_addr global i64 0, align 8
@vsd = dso_local local_unnamed_addr global i64 0, align 8
@vse = dso_local local_unnamed_addr global i64 0, align 8
@vsf = dso_local local_unnamed_addr global i64 0, align 8
@vra = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vrb = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vrc = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vda = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@vdb = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@vdc = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@slen = dso_local local_unnamed_addr global i64 0, align 8
@tlen = dso_local local_unnamed_addr global i64 0, align 8
@ch = dso_local local_unnamed_addr global i8 0, align 1
@dh = dso_local local_unnamed_addr global i8 0, align 1
@a = dso_local local_unnamed_addr global [300000 x i64] zeroinitializer, align 16
@b = dso_local local_unnamed_addr global [300000 x i64] zeroinitializer, align 16
@c = dso_local local_unnamed_addr global [300000 x i64] zeroinitializer, align 16
@s = dso_local local_unnamed_addr global [300001 x i8] zeroinitializer, align 16
@t = dso_local local_unnamed_addr global [300001 x i8] zeroinitializer, align 16
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @umin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.umin.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @umax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.umax.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @smin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @smax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #1 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse.backedge, %entry
%x.tr = phi i64 [ %x, %entry ], [ %y.tr, %tailrecurse.backedge ]
%y.tr = phi i64 [ %y, %entry ], [ %y.tr.be, %tailrecurse.backedge ]
%cmp = icmp ult i64 %x.tr, %y.tr
br i1 %cmp, label %tailrecurse.backedge, label %if.else
if.else: ; preds = %tailrecurse
%cmp1 = icmp eq i64 %y.tr, 0
br i1 %cmp1, label %return, label %if.else3
if.else3: ; preds = %if.else
%rem = urem i64 %x.tr, %y.tr
br label %tailrecurse.backedge
tailrecurse.backedge: ; preds = %if.else3, %tailrecurse
%y.tr.be = phi i64 [ %rem, %if.else3 ], [ %x.tr, %tailrecurse ]
br label %tailrecurse
return: ; preds = %if.else
ret i64 %x.tr
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @bitpow(i64 noundef %a, i64 noundef %x, i64 noundef %modulo) local_unnamed_addr #1 {
entry:
%tobool.not12 = icmp eq i64 %x, 0
br i1 %tobool.not12, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%result.015 = phi i64 [ %result.1, %if.end ], [ 1, %entry ]
%a.addr.014 = phi i64 [ %rem3, %if.end ], [ %a, %entry ]
%x.addr.013 = phi i64 [ %div11, %if.end ], [ %x, %entry ]
%and = and i64 %x.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 i64 %result.015, %a.addr.014
%rem = urem i64 %mul, %modulo
br label %if.end
if.end: ; preds = %if.then, %while.body
%result.1 = phi i64 [ %rem, %if.then ], [ %result.015, %while.body ]
%div11 = lshr i64 %x.addr.013, 1
%mul2 = mul i64 %a.addr.014, %a.addr.014
%rem3 = urem i64 %mul2, %modulo
%tobool.not = icmp ult i64 %x.addr.013, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %if.end, %entry
%result.0.lcssa = phi i64 [ 1, %entry ], [ %result.1, %if.end ]
ret i64 %result.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @divide(i64 noundef %a, i64 noundef %b, i64 noundef %modulo) local_unnamed_addr #1 {
entry:
%sub = add i64 %modulo, -2
%tobool.not12.i = icmp eq i64 %sub, 0
br i1 %tobool.not12.i, label %bitpow.exit, label %while.body.i
while.body.i: ; preds = %entry, %if.end.i
%result.015.i = phi i64 [ %result.1.i, %if.end.i ], [ 1, %entry ]
%a.addr.014.i = phi i64 [ %rem3.i, %if.end.i ], [ %b, %entry ]
%x.addr.013.i = phi i64 [ %div11.i, %if.end.i ], [ %sub, %entry ]
%and.i = and i64 %x.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 i64 %a.addr.014.i, %result.015.i
%rem.i = urem i64 %mul.i, %modulo
br label %if.end.i
if.end.i: ; preds = %if.then.i, %while.body.i
%result.1.i = phi i64 [ %rem.i, %if.then.i ], [ %result.015.i, %while.body.i ]
%div11.i = lshr i64 %x.addr.013.i, 1
%mul2.i = mul i64 %a.addr.014.i, %a.addr.014.i
%rem3.i = urem i64 %mul2.i, %modulo
%tobool.not.i = icmp ult i64 %x.addr.013.i, 2
br i1 %tobool.not.i, label %bitpow.exit, label %while.body.i, !llvm.loop !5
bitpow.exit: ; preds = %if.end.i, %entry
%result.0.lcssa.i = phi i64 [ 1, %entry ], [ %result.1.i, %if.end.i ]
%mul = mul i64 %result.0.lcssa.i, %a
%rem = urem i64 %mul, %modulo
ret i64 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @udiff(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not = icmp ult i64 %a, %b
%sub = sub i64 %a, %b
%sub1 = sub i64 %b, %a
%retval.0 = select i1 %cmp.not, i64 %sub1, i64 %sub
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @sdiff(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub = sub nsw i64 %a, %b
%retval.0 = tail call i64 @llvm.abs.i64(i64 %sub, i1 true)
ret i64 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @printUquotient(i64 noundef %left, i64 noundef %right) local_unnamed_addr #3 {
entry:
%div = udiv i64 %left, %right
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %div)
%left.addr.0 = urem i64 %left, %right
%mul = mul i64 %left.addr.0, 10
%div1 = udiv i64 %mul, %right
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1)
%left.addr.0.1 = urem i64 %mul, %right
%mul.1 = mul i64 %left.addr.0.1, 10
%div1.1 = udiv i64 %mul.1, %right
%call2.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.1)
%left.addr.0.2 = urem i64 %mul.1, %right
%mul.2 = mul i64 %left.addr.0.2, 10
%div1.2 = udiv i64 %mul.2, %right
%call2.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.2)
%left.addr.0.3 = urem i64 %mul.2, %right
%mul.3 = mul i64 %left.addr.0.3, 10
%div1.3 = udiv i64 %mul.3, %right
%call2.3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.3)
%left.addr.0.4 = urem i64 %mul.3, %right
%mul.4 = mul i64 %left.addr.0.4, 10
%div1.4 = udiv i64 %mul.4, %right
%call2.4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.4)
%left.addr.0.5 = urem i64 %mul.4, %right
%mul.5 = mul i64 %left.addr.0.5, 10
%div1.5 = udiv i64 %mul.5, %right
%call2.5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.5)
%left.addr.0.6 = urem i64 %mul.5, %right
%mul.6 = mul i64 %left.addr.0.6, 10
%div1.6 = udiv i64 %mul.6, %right
%call2.6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.6)
%left.addr.0.7 = urem i64 %mul.6, %right
%mul.7 = mul i64 %left.addr.0.7, 10
%div1.7 = udiv i64 %mul.7, %right
%call2.7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.7)
%left.addr.0.8 = urem i64 %mul.7, %right
%mul.8 = mul i64 %left.addr.0.8, 10
%div1.8 = udiv i64 %mul.8, %right
%call2.8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.8)
%left.addr.0.9 = urem i64 %mul.8, %right
%mul.9 = mul i64 %left.addr.0.9, 10
%div1.9 = udiv i64 %mul.9, %right
%call2.9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.9)
%left.addr.0.10 = urem i64 %mul.9, %right
%mul.10 = mul i64 %left.addr.0.10, 10
%div1.10 = udiv i64 %mul.10, %right
%call2.10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.10)
%left.addr.0.11 = urem i64 %mul.10, %right
%mul.11 = mul i64 %left.addr.0.11, 10
%div1.11 = udiv i64 %mul.11, %right
%call2.11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.11)
%left.addr.0.12 = urem i64 %mul.11, %right
%mul.12 = mul i64 %left.addr.0.12, 10
%div1.12 = udiv i64 %mul.12, %right
%call2.12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.12)
%left.addr.0.13 = urem i64 %mul.12, %right
%mul.13 = mul i64 %left.addr.0.13, 10
%div1.13 = udiv i64 %mul.13, %right
%call2.13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.13)
%left.addr.0.14 = urem i64 %mul.13, %right
%mul.14 = mul i64 %left.addr.0.14, 10
%div1.14 = udiv i64 %mul.14, %right
%call2.14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.14)
%left.addr.0.15 = urem i64 %mul.14, %right
%mul.15 = mul i64 %left.addr.0.15, 10
%div1.15 = udiv i64 %mul.15, %right
%call2.15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.15)
%left.addr.0.16 = urem i64 %mul.15, %right
%mul.16 = mul i64 %left.addr.0.16, 10
%div1.16 = udiv i64 %mul.16, %right
%call2.16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.16)
%left.addr.0.17 = urem i64 %mul.16, %right
%mul.17 = mul i64 %left.addr.0.17, 10
%div1.17 = udiv i64 %mul.17, %right
%call2.17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.17)
%left.addr.0.18 = urem i64 %mul.17, %right
%mul.18 = mul i64 %left.addr.0.18, 10
%div1.18 = udiv i64 %mul.18, %right
%call2.18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.18)
%left.addr.0.19 = urem i64 %mul.18, %right
%mul.19 = mul i64 %left.addr.0.19, 10
%div1.19 = udiv i64 %mul.19, %right
%call2.19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.19)
%0 = load ptr, ptr @stdout, align 8, !tbaa !7
%call.i = tail call noundef i32 @putc(i32 noundef 10, ptr noundef %0)
ret void
}
; 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 #4
; Function Attrs: nofree nounwind uwtable
define dso_local void @printSquotient(i64 noundef %left, i64 noundef %right) local_unnamed_addr #3 {
entry:
%mul = mul nsw i64 %right, %left
%cmp = icmp slt i64 %mul, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%0 = load ptr, ptr @stdout, align 8, !tbaa !7
%call.i = tail call noundef i32 @putc(i32 noundef 45, ptr noundef %0)
br label %if.end
if.end: ; preds = %if.then, %entry
%retval.0.i = tail call i64 @llvm.abs.i64(i64 %left, i1 true)
%retval.0.i5 = tail call i64 @llvm.abs.i64(i64 %right, i1 true)
tail call void @printUquotient(i64 noundef %retval.0.i, i64 noundef %retval.0.i5)
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @bitcount(i64 noundef %n) local_unnamed_addr #1 {
entry:
%tobool.not6 = icmp eq i64 %n, 0
br i1 %tobool.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%result.08 = phi i32 [ %spec.select, %while.body ], [ 0, %entry ]
%n.addr.07 = phi i64 [ %div5, %while.body ], [ %n, %entry ]
%0 = trunc i64 %n.addr.07 to i32
%1 = and i32 %0, 1
%spec.select = add i32 %1, %result.08
%div5 = lshr i64 %n.addr.07, 1
%tobool.not = icmp ult i64 %n.addr.07, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %while.body, %entry
%result.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %while.body ]
ret i32 %result.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pullcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #5 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !12
%1 = load i64, ptr %right, align 8, !tbaa !12
%cmp = icmp ult i64 %0, %1
%cmp1 = icmp ugt i64 %0, %1
%. = zext 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 @psllcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #5 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !12
%1 = load i64, ptr %right, align 8, !tbaa !12
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%. = zext 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 @pcharcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #5 {
entry:
%0 = load i8, ptr %left, align 1, !tbaa !14
%1 = load i8, ptr %right, align 1, !tbaa !14
%cmp = icmp slt i8 %0, %1
%cmp5 = icmp sgt i8 %0, %1
%. = zext i1 %cmp5 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @pstrcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #6 {
entry:
%0 = load ptr, ptr %left, align 8, !tbaa !7
%1 = load ptr, ptr %right, align 8, !tbaa !7
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #13
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @phwllABcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #5 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !15
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !16
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !15
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !16
%cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
%. = zext i1 %cmp13 to i32
br label %cleanup
cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @phwllREVcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #5 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !15
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !16
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !15
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !16
%cmp = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
%. = zext i1 %cmp13 to i32
br label %cleanup
cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ptriplecomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #5 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !17
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !15
%l.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.7.0.copyload = load i64, ptr %l.sroa.7.0..sroa_idx, align 8, !tbaa.struct !16
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !17
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !15
%r.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.7.0.copyload = load i64, ptr %r.sroa.7.0..sroa_idx, align 8, !tbaa.struct !16
%cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp13, label %cleanup, label %if.end15
if.end15: ; preds = %if.end10
%cmp17 = icmp slt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
br i1 %cmp17, label %cleanup, label %if.end19
if.end19: ; preds = %if.end15
%cmp22 = icmp sgt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
%. = zext i1 %cmp22 to i32
br label %cleanup
cleanup: ; preds = %if.end19, %if.end15, %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ 1, %if.end10 ], [ -1, %if.end15 ], [ %., %if.end19 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local zeroext i1 @isinrange(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #2 {
entry:
%cmp = icmp sle i64 %left, %x
%cmp1 = icmp sle i64 %x, %right
%0 = and i1 %cmp, %cmp1
ret i1 %0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local zeroext i1 @isinrange_soft(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #2 {
entry:
%cmp.not = icmp sgt i64 %left, %x
%cmp1.not = icmp sgt i64 %x, %right
%or.cond = or i1 %cmp.not, %cmp1.not
br i1 %or.cond, label %lor.rhs, label %lor.end
lor.rhs: ; preds = %entry
%cmp2 = icmp sge i64 %left, %x
%cmp3 = icmp sge i64 %x, %right
%0 = and i1 %cmp2, %cmp3
br label %lor.end
lor.end: ; preds = %entry, %lor.rhs
%1 = phi i1 [ %0, %lor.rhs ], [ true, %entry ]
ret i1 %1
}
; Function Attrs: nofree nosync nounwind memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @uf_init(i64 noundef %n) local_unnamed_addr #8 {
entry:
%cmp6.not = icmp eq i64 %n, 0
br i1 %cmp6.not, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = shl nuw i64 %n, 3
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @rank, i8 0, i64 %0, i1 false), !tbaa !12
%min.iters.check = icmp ult i64 %n, 4
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %n, -4
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 0, i64 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <2 x i64> %vec.ind, <i64 2, i64 2>
%1 = getelementptr inbounds [300000 x i64], ptr @parent, i64 0, i64 %index
store <2 x i64> %vec.ind, ptr %1, align 16, !tbaa !12
%2 = getelementptr inbounds i64, ptr %1, i64 2
store <2 x i64> %step.add, ptr %2, align 16, !tbaa !12
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !18
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %n
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%i.07.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
ret void
for.body: ; preds = %for.body.preheader9, %for.body
%i.07 = phi i64 [ %inc, %for.body ], [ %i.07.ph, %for.body.preheader9 ]
%arrayidx = getelementptr inbounds [300000 x i64], ptr @parent, i64 0, i64 %i.07
store i64 %i.07, ptr %arrayidx, align 8, !tbaa !12
%inc = add nuw nsw i64 %i.07, 1
%exitcond.not = icmp eq i64 %inc, %n
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !21
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @uf_find(i64 noundef %x) local_unnamed_addr #9 {
entry:
%arrayidx = getelementptr inbounds [300000 x i64], ptr @parent, i64 0, i64 %x
%0 = load i64, ptr %arrayidx, align 8, !tbaa !12
%cmp = icmp eq i64 %0, %x
br i1 %cmp, label %common.ret7, label %if.end
common.ret7: ; preds = %entry, %if.end
%common.ret7.op = phi i64 [ %call, %if.end ], [ %x, %entry ]
ret i64 %common.ret7.op
if.end: ; preds = %entry
%call = tail call i64 @uf_find(i64 noundef %0)
store i64 %call, ptr %arrayidx, align 8, !tbaa !12
br label %common.ret7
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local zeroext i1 @uf_union(i64 noundef %a, i64 noundef %b) local_unnamed_addr #10 {
entry:
%call = tail call i64 @uf_find(i64 noundef %a)
%call1 = tail call i64 @uf_find(i64 noundef %b)
%cmp = icmp ne i64 %call, %call1
br i1 %cmp, label %if.end, label %return
if.end: ; preds = %entry
%arrayidx = getelementptr inbounds [300000 x i64], ptr @rank, i64 0, i64 %call
%0 = load i64, ptr %arrayidx, align 8, !tbaa !12
%arrayidx2 = getelementptr inbounds [300000 x i64], ptr @rank, i64 0, i64 %call1
%1 = load i64, ptr %arrayidx2, align 8, !tbaa !12
%cmp3 = icmp ugt i64 %0, %1
br i1 %cmp3, label %if.then4, label %if.else
if.then4: ; preds = %if.end
%arrayidx5 = getelementptr inbounds [300000 x i64], ptr @parent, i64 0, i64 %call1
store i64 %call, ptr %arrayidx5, align 8, !tbaa !12
br label %return
if.else: ; preds = %if.end
%arrayidx6 = getelementptr inbounds [300000 x i64], ptr @parent, i64 0, i64 %call
store i64 %call1, ptr %arrayidx6, align 8, !tbaa !12
%cmp9 = icmp eq i64 %0, %1
br i1 %cmp9, label %if.then10, label %return
if.then10: ; preds = %if.else
%inc = add i64 %0, 1
store i64 %inc, ptr %arrayidx2, align 8, !tbaa !12
br label %return
return: ; preds = %if.then4, %if.then10, %if.else, %entry
ret i1 %cmp
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @dig(i64 noundef %n) local_unnamed_addr #1 {
entry:
%cmp3 = icmp eq i64 %n, 0
br i1 %cmp3, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%n.tr5 = phi i64 [ %div, %if.end ], [ %n, %entry ]
%accumulator.tr4 = phi i64 [ %add, %if.end ], [ 0, %entry ]
%div = udiv i64 %n.tr5, 10
%rem = urem i64 %n.tr5, 10
%add = add i64 %rem, %accumulator.tr4
%cmp = icmp ult i64 %n.tr5, 10
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
%accumulator.tr.lcssa = phi i64 [ 0, %entry ], [ %add, %if.end ]
ret i64 %accumulator.tr.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @solve() local_unnamed_addr #3 {
entry:
%0 = load i64, ptr @n, align 8, !tbaa !12
%cmp3.i = icmp eq i64 %0, 0
br i1 %cmp3.i, label %dig.exit, label %if.end.i
if.end.i: ; preds = %entry, %if.end.i
%n.tr5.i = phi i64 [ %div.i, %if.end.i ], [ %0, %entry ]
%accumulator.tr4.i = phi i64 [ %add.i, %if.end.i ], [ 0, %entry ]
%div.i = udiv i64 %n.tr5.i, 10
%rem.i = urem i64 %n.tr5.i, 10
%add.i = add i64 %rem.i, %accumulator.tr4.i
%cmp.i = icmp ult i64 %n.tr5.i, 10
br i1 %cmp.i, label %dig.exit, label %if.end.i
dig.exit: ; preds = %if.end.i, %entry
%accumulator.tr.lcssa.i = phi i64 [ 0, %entry ], [ %add.i, %if.end.i ]
%rem = urem i64 %0, %accumulator.tr.lcssa.i
%tobool.not = icmp ne i64 %rem, 0
%.str.3..str.4 = select i1 %tobool.not, ptr @.str.4, ptr @.str.3
%. = zext i1 %tobool.not to i64
%call2 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.3..str.4)
ret i64 %.
}
; 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.5, ptr noundef nonnull @n, ptr noundef nonnull @m)
%0 = load i64, ptr @n, align 8, !tbaa !12
%cmp3.i.i = icmp eq i64 %0, 0
br i1 %cmp3.i.i, label %solve.exit, label %if.end.i.i
if.end.i.i: ; preds = %entry, %if.end.i.i
%n.tr5.i.i = phi i64 [ %div.i.i, %if.end.i.i ], [ %0, %entry ]
%accumulator.tr4.i.i = phi i64 [ %add.i.i, %if.end.i.i ], [ 0, %entry ]
%div.i.i = udiv i64 %n.tr5.i.i, 10
%rem.i.i = urem i64 %n.tr5.i.i, 10
%add.i.i = add i64 %rem.i.i, %accumulator.tr4.i.i
%cmp.i.i = icmp ult i64 %n.tr5.i.i, 10
br i1 %cmp.i.i, label %solve.exit, label %if.end.i.i
solve.exit: ; preds = %if.end.i.i, %entry
%accumulator.tr.lcssa.i.i = phi i64 [ 0, %entry ], [ %add.i.i, %if.end.i.i ]
%rem.i = urem i64 %0, %accumulator.tr.lcssa.i.i
%tobool.not.i.not = icmp eq i64 %rem.i, 0
%.str.3..str.4.i = select i1 %tobool.not.i.not, ptr @.str.3, ptr @.str.4
%call2.i = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.3..str.4.i)
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 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #11
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #11
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #12
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree 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 #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree 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 #6 = { mustprogress nofree 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 #7 = { 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 #8 = { nofree nosync nounwind memory(write, 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 #9 = { 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 #10 = { 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 #11 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #12 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #13 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !9, i64 0}
!14 = !{!9, !9, i64 0}
!15 = !{i64 0, i64 8, !12, i64 8, i64 8, !12}
!16 = !{i64 0, i64 8, !12}
!17 = !{i64 0, i64 8, !12, i64 8, i64 8, !12, i64 16, i64 8, !12}
!18 = distinct !{!18, !6, !19, !20}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = distinct !{!21, !6, !20, !19}
|
#include <stdio.h>
int main(void) {
int N;
int a[9] = {0}, i, j = 0, t, sum = 0;
scanf("%d", &N);
t = N;
for (i = 0; 1; i++) {
if (t < 10) {
a[i] = t;
break;
}
a[i] = t % 10;
t /= 10;
}
for (i = 0; i < 9; i++) {
sum += a[i];
}
if ((N % sum) == 0) {
printf("Yes\n");
}
else printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145025/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145025/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%a = alloca [9 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %a) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(36) %a, i8 0, i64 36, 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
%cmp27 = icmp slt i32 %0, 10
br i1 %cmp27, label %if.then, label %if.end
if.then.loopexit: ; preds = %if.end
%1 = and i64 %indvars.iv.next, 4294967295
br label %if.then
if.then: ; preds = %if.then.loopexit, %entry
%i.0.lcssa = phi i64 [ 0, %entry ], [ %1, %if.then.loopexit ]
%t.0.lcssa = phi i32 [ %0, %entry ], [ %div, %if.then.loopexit ]
%arrayidx = getelementptr inbounds [9 x i32], ptr %a, i64 0, i64 %i.0.lcssa
store i32 %t.0.lcssa, ptr %arrayidx, align 4, !tbaa !5
%2 = load <8 x i32>, ptr %a, align 16, !tbaa !5
%arrayidx7.8 = getelementptr inbounds [9 x i32], ptr %a, i64 0, i64 8
%3 = load i32, ptr %arrayidx7.8, align 16, !tbaa !5
%4 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %2)
%op.rdx = add i32 %4, %3
%rem11 = srem i32 %0, %op.rdx
%cmp12 = icmp eq i32 %rem11, 0
%str.3.str = select i1 %cmp12, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
if.end: ; preds = %entry, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %entry ]
%t.029 = phi i32 [ %div, %if.end ], [ %0, %entry ]
%rem = urem i32 %t.029, 10
%arrayidx2 = getelementptr inbounds [9 x i32], ptr %a, i64 0, i64 %indvars.iv
store i32 %rem, ptr %arrayidx2, align 4, !tbaa !5
%div = udiv i32 %t.029, 10
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%cmp = icmp ult i32 %t.029, 100
br i1 %cmp, label %if.then.loopexit, label %if.end
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v8i32(<8 x i32>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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"}
|
#include <stdio.h>
int main(void)
{
int n;
int sum = 0;
int tmp;
scanf("%d", &n);
tmp = n;
while (tmp){
sum += tmp % 10;
tmp /= 10;
}
puts(n % sum ? "No" : "Yes");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145069/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145069/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"No\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca 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
%tobool.not7 = icmp eq i32 %0, 0
br i1 %tobool.not7, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%tmp.09 = phi i32 [ %div, %while.body ], [ %0, %entry ]
%sum.08 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%rem = srem i32 %tmp.09, 10
%add = add nsw i32 %rem, %sum.08
%div = sdiv i32 %tmp.09, 10
%tmp.09.off = add i32 %tmp.09, 9
%tobool.not = icmp ult i32 %tmp.09.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
%rem1 = srem i32 %0, %sum.0.lcssa
%tobool2.not = icmp eq i32 %rem1, 0
%cond = select i1 %tobool2.not, ptr @.str.2, ptr @.str.1
%call3 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %cond)
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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int score,n,sum[100],i,j,blank;
while(1){
scanf("%d",&n);
if(n == 0) break;
for(i = 0; i < n; i++){
sum[i]=0;
for(j = 0; j < 5; j++){
scanf("%d",&score);
sum[i] += score;
}
}
// for(i = 0; i < n; i++) printf("%d ",sum[i]);
for(i = 0; i < n-1; i++){
for(j = 0; j < n-1; j++){
if(sum[j] > sum[j+1]){
blank=sum[j];
sum[j]=sum[j+1];
sum[j+1]=blank;
}
}
}
// for(i = 0; i < n; i++) printf("%dテ」ツ??,sum[i]);
printf("%d %d\n",sum[n-1],sum[0]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145111/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145111/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%score = alloca i32, align 4
%n = alloca i32, align 4
%sum = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %score) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %sum) #3
%call70 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp71 = icmp eq i32 %0, 0
br i1 %cmp71, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end41
%1 = phi i32 [ %18, %for.end41 ], [ %0, %entry ]
%cmp163 = icmp sgt i32 %1, 0
br i1 %cmp163, label %for.body, label %for.cond11.preheader.thread
for.cond11.preheader.thread: ; preds = %for.cond.preheader
%sub79 = add i32 %1, -1
br label %for.end41
for.cond11.preheader: ; preds = %for.body
%sub = add i32 %14, -1
%cmp1267 = icmp sgt i32 %14, 1
br i1 %cmp1267, label %for.cond14.preheader.us.preheader, label %for.end41
for.cond14.preheader.us.preheader: ; preds = %for.cond11.preheader
%wide.trip.count = zext i32 %sub to i64
%xtraiter = and i64 %wide.trip.count, 1
%2 = icmp eq i32 %sub, 1
%unroll_iter = and i64 %wide.trip.count, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond14.preheader.us
for.cond14.preheader.us: ; preds = %for.cond14.preheader.us.preheader, %for.cond14.for.inc39_crit_edge.us
%i.168.us = phi i32 [ %inc40.us, %for.cond14.for.inc39_crit_edge.us ], [ 0, %for.cond14.preheader.us.preheader ]
%.pre = load i32, ptr %sum, align 16, !tbaa !5
br i1 %2, label %for.cond14.for.inc39_crit_edge.us.unr-lcssa, label %for.body17.us
for.body17.us: ; preds = %for.cond14.preheader.us, %for.inc36.us.1
%3 = phi i32 [ %7, %for.inc36.us.1 ], [ %.pre, %for.cond14.preheader.us ]
%indvars.iv74 = phi i64 [ %indvars.iv.next75.1, %for.inc36.us.1 ], [ 0, %for.cond14.preheader.us ]
%niter = phi i64 [ %niter.next.1, %for.inc36.us.1 ], [ 0, %for.cond14.preheader.us ]
%indvars.iv.next75 = or i64 %indvars.iv74, 1
%arrayidx22.us = getelementptr inbounds [100 x i32], ptr %sum, i64 0, i64 %indvars.iv.next75
%4 = load i32, ptr %arrayidx22.us, align 4, !tbaa !5
%cmp23.us = icmp sgt i32 %3, %4
br i1 %cmp23.us, label %if.then24.us, label %for.inc36.us
if.then24.us: ; preds = %for.body17.us
%arrayidx19.us = getelementptr inbounds [100 x i32], ptr %sum, i64 0, i64 %indvars.iv74
store i32 %4, ptr %arrayidx19.us, align 8, !tbaa !5
store i32 %3, ptr %arrayidx22.us, align 4, !tbaa !5
br label %for.inc36.us
for.inc36.us: ; preds = %if.then24.us, %for.body17.us
%5 = phi i32 [ %3, %if.then24.us ], [ %4, %for.body17.us ]
%indvars.iv.next75.1 = add nuw nsw i64 %indvars.iv74, 2
%arrayidx22.us.1 = getelementptr inbounds [100 x i32], ptr %sum, i64 0, i64 %indvars.iv.next75.1
%6 = load i32, ptr %arrayidx22.us.1, align 8, !tbaa !5
%cmp23.us.1 = icmp sgt i32 %5, %6
br i1 %cmp23.us.1, label %if.then24.us.1, label %for.inc36.us.1
if.then24.us.1: ; preds = %for.inc36.us
%arrayidx19.us.1 = getelementptr inbounds [100 x i32], ptr %sum, i64 0, i64 %indvars.iv.next75
store i32 %6, ptr %arrayidx19.us.1, align 4, !tbaa !5
store i32 %5, ptr %arrayidx22.us.1, align 8, !tbaa !5
br label %for.inc36.us.1
for.inc36.us.1: ; preds = %if.then24.us.1, %for.inc36.us
%7 = phi i32 [ %5, %if.then24.us.1 ], [ %6, %for.inc36.us ]
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond14.for.inc39_crit_edge.us.unr-lcssa, label %for.body17.us, !llvm.loop !9
for.cond14.for.inc39_crit_edge.us.unr-lcssa: ; preds = %for.inc36.us.1, %for.cond14.preheader.us
%.unr = phi i32 [ %.pre, %for.cond14.preheader.us ], [ %7, %for.inc36.us.1 ]
%indvars.iv74.unr = phi i64 [ 0, %for.cond14.preheader.us ], [ %indvars.iv.next75.1, %for.inc36.us.1 ]
br i1 %lcmp.mod.not, label %for.cond14.for.inc39_crit_edge.us, label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond14.for.inc39_crit_edge.us.unr-lcssa
%indvars.iv.next75.epil = add nuw nsw i64 %indvars.iv74.unr, 1
%arrayidx22.us.epil = getelementptr inbounds [100 x i32], ptr %sum, i64 0, i64 %indvars.iv.next75.epil
%8 = load i32, ptr %arrayidx22.us.epil, align 4, !tbaa !5
%cmp23.us.epil = icmp sgt i32 %.unr, %8
br i1 %cmp23.us.epil, label %if.then24.us.epil, label %for.cond14.for.inc39_crit_edge.us
if.then24.us.epil: ; preds = %for.body17.us.epil
%arrayidx19.us.epil = getelementptr inbounds [100 x i32], ptr %sum, i64 0, i64 %indvars.iv74.unr
store i32 %8, ptr %arrayidx19.us.epil, align 4, !tbaa !5
store i32 %.unr, ptr %arrayidx22.us.epil, align 4, !tbaa !5
br label %for.cond14.for.inc39_crit_edge.us
for.cond14.for.inc39_crit_edge.us: ; preds = %for.body17.us.epil, %if.then24.us.epil, %for.cond14.for.inc39_crit_edge.us.unr-lcssa
%inc40.us = add nuw nsw i32 %i.168.us, 1
%exitcond77.not = icmp eq i32 %inc40.us, %sub
br i1 %exitcond77.not, label %for.end41, label %for.cond14.preheader.us, !llvm.loop !11
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %sum, i64 0, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %score)
%9 = load i32, ptr %score, align 4, !tbaa !5
%call5.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %score)
%10 = load i32, ptr %score, align 4, !tbaa !5
%add.1 = add nsw i32 %9, %10
%call5.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %score)
%11 = load i32, ptr %score, align 4, !tbaa !5
%add.2 = add nsw i32 %add.1, %11
%call5.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %score)
%12 = load i32, ptr %score, align 4, !tbaa !5
%add.3 = add nsw i32 %add.2, %12
%call5.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %score)
%13 = load i32, ptr %score, align 4, !tbaa !5
%add.4 = add nsw i32 %add.3, %13
store i32 %add.4, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%14 = load i32, ptr %n, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %15
br i1 %cmp1, label %for.body, label %for.cond11.preheader, !llvm.loop !12
for.end41: ; preds = %for.cond14.for.inc39_crit_edge.us, %for.cond11.preheader.thread, %for.cond11.preheader
%sub81 = phi i32 [ %sub79, %for.cond11.preheader.thread ], [ %sub, %for.cond11.preheader ], [ %sub, %for.cond14.for.inc39_crit_edge.us ]
%idxprom43 = sext i32 %sub81 to i64
%arrayidx44 = getelementptr inbounds [100 x i32], ptr %sum, i64 0, i64 %idxprom43
%16 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%17 = load i32, ptr %sum, align 16, !tbaa !5
%call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %16, i32 noundef %17)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%18 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %18, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end41, %entry
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %sum) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %score) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
/* ex 6_1
potter0723sw */
#include <stdio.h>
typedef struct point{
int x_elem;
int y_elem;
}point;
point shift_point(point pre, int x_shift, int y_shift){
point post;
post.x_elem = pre.x_elem + x_shift;
post.y_elem = pre.y_elem + y_shift;
return post;
}
int main(void){
int dif_x, dif_y;
point point_a, point_b, point_c, point_d;
scanf("%d %d %d %d", &point_a.x_elem, &point_a.y_elem, &point_b.x_elem, &point_b.y_elem);
dif_x = point_a.x_elem - point_b.x_elem;
dif_y = point_a.y_elem - point_b.y_elem;
point_c = shift_point(point_b, dif_y, -dif_x);
point_d = shift_point(point_a, dif_y, -dif_x);
printf("%d %d %d %d\n", point_c.x_elem, point_c.y_elem, point_d.x_elem, point_d.y_elem);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145162/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145162/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.point = type { i32, i32 }
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%d %d %d %d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @shift_point(i64 %pre.coerce, i32 noundef %x_shift, i32 noundef %y_shift) local_unnamed_addr #0 {
entry:
%pre.sroa.0.0.extract.trunc = trunc i64 %pre.coerce to i32
%pre.sroa.2.0.extract.shift = lshr i64 %pre.coerce, 32
%pre.sroa.2.0.extract.trunc = trunc i64 %pre.sroa.2.0.extract.shift to i32
%add = add nsw i32 %pre.sroa.0.0.extract.trunc, %x_shift
%add2 = add nsw i32 %pre.sroa.2.0.extract.trunc, %y_shift
%retval.sroa.2.0.insert.ext = zext i32 %add2 to i64
%retval.sroa.2.0.insert.shift = shl nuw i64 %retval.sroa.2.0.insert.ext, 32
%retval.sroa.0.0.insert.ext = zext i32 %add to i64
%retval.sroa.0.0.insert.insert = or i64 %retval.sroa.2.0.insert.shift, %retval.sroa.0.0.insert.ext
ret i64 %retval.sroa.0.0.insert.insert
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%point_a = alloca %struct.point, align 8
%point_b = alloca %struct.point, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %point_a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %point_b) #4
%y_elem = getelementptr inbounds %struct.point, ptr %point_a, i64 0, i32 1
%y_elem2 = getelementptr inbounds %struct.point, ptr %point_b, i64 0, i32 1
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %point_a, ptr noundef nonnull %y_elem, ptr noundef nonnull %point_b, ptr noundef nonnull %y_elem2)
%0 = load i32, ptr %point_a, align 8, !tbaa !5
%1 = load i32, ptr %point_b, align 8, !tbaa !5
%sub.neg = sub nsw i32 %1, %0
%2 = load i32, ptr %y_elem, align 4, !tbaa !10
%3 = load i32, ptr %y_elem2, align 4, !tbaa !10
%sub7 = sub nsw i32 %2, %3
%4 = load i64, ptr %point_b, align 8
%pre.sroa.0.0.extract.trunc.i = trunc i64 %4 to i32
%pre.sroa.2.0.extract.shift.i = lshr i64 %4, 32
%pre.sroa.2.0.extract.trunc.i = trunc i64 %pre.sroa.2.0.extract.shift.i to i32
%add.i = add nsw i32 %sub7, %pre.sroa.0.0.extract.trunc.i
%add2.i = add nsw i32 %sub.neg, %pre.sroa.2.0.extract.trunc.i
%5 = load i64, ptr %point_a, align 8
%pre.sroa.0.0.extract.trunc.i20 = trunc i64 %5 to i32
%pre.sroa.2.0.extract.shift.i21 = lshr i64 %5, 32
%pre.sroa.2.0.extract.trunc.i22 = trunc i64 %pre.sroa.2.0.extract.shift.i21 to i32
%add.i23 = add nsw i32 %sub7, %pre.sroa.0.0.extract.trunc.i20
%add2.i24 = add nsw i32 %sub.neg, %pre.sroa.2.0.extract.trunc.i22
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add.i, i32 noundef %add2.i, i32 noundef %add.i23, i32 noundef %add2.i24)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %point_b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %point_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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"point", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 4}
|
/* ex7_1
Acro */
#include <stdio.h>
typedef struct point
{
int x_elem;
int y_elem;
}point;
/* vec1を支点としてvec2を反時計回り90°回転させた点を返す*/
point shift_point(point vec1, point vec2)
{
point new_vec;
/* 支点の移動 */
new_vec.x_elem = vec2.x_elem - vec1.x_elem;
new_vec.y_elem = vec2.y_elem - vec1.y_elem;
/* 回転 */
new_vec.x_elem = new_vec.y_elem*(-1);
/* new_vec.y_elem = new_vec.x_elem */
new_vec.y_elem = vec2.x_elem - vec1.x_elem;
/* 支点を戻す */
new_vec.x_elem += vec1.x_elem;
new_vec.y_elem += vec1.y_elem;
return new_vec;
}
int main(void){
point vec1,vec2,vec3,vec4;
/* 入力 */
scanf("%d %d %d %d",&vec1.x_elem,&vec1.y_elem,&vec2.x_elem,&vec2.y_elem);
/* 順番に注意 */
vec4 = shift_point(vec1,vec2);
vec3 = shift_point(vec4,vec1);
/* 出力 */
printf("%d %d %d %d\n",vec3.x_elem, vec3.y_elem, vec4.x_elem, vec4.y_elem);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145205/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145205/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.point = type { i32, i32 }
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%d %d %d %d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @shift_point(i64 %vec1.coerce, i64 %vec2.coerce) local_unnamed_addr #0 {
entry:
%vec1.sroa.4.0.extract.shift = lshr i64 %vec1.coerce, 32
%vec2.sroa.3.0.extract.shift = lshr i64 %vec2.coerce, 32
%sub10 = sub i64 %vec2.coerce, %vec1.coerce
%sub4.neg = add i64 %vec1.sroa.4.0.extract.shift, %vec1.coerce
%add = sub i64 %sub4.neg, %vec2.sroa.3.0.extract.shift
%add16 = add i64 %sub10, %vec1.sroa.4.0.extract.shift
%retval.sroa.5.0.insert.ext = shl i64 %add16, 32
%retval.sroa.0.0.insert.ext = and i64 %add, 4294967295
%retval.sroa.0.0.insert.insert = or i64 %retval.sroa.0.0.insert.ext, %retval.sroa.5.0.insert.ext
ret i64 %retval.sroa.0.0.insert.insert
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%vec1 = alloca %struct.point, align 8
%vec2 = alloca %struct.point, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %vec1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %vec2) #4
%y_elem = getelementptr inbounds %struct.point, ptr %vec1, i64 0, i32 1
%y_elem2 = getelementptr inbounds %struct.point, ptr %vec2, i64 0, i32 1
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %vec1, ptr noundef nonnull %y_elem, ptr noundef nonnull %vec2, ptr noundef nonnull %y_elem2)
%0 = load i64, ptr %vec1, align 8
%1 = load i64, ptr %vec2, align 8
%vec1.sroa.4.0.extract.shift.i = lshr i64 %0, 32
%vec2.sroa.3.0.extract.shift.i = lshr i64 %1, 32
%sub10.i = sub i64 %1, %0
%sub4.neg.i = add i64 %vec1.sroa.4.0.extract.shift.i, %0
%add.i = sub i64 %sub4.neg.i, %vec2.sroa.3.0.extract.shift.i
%add16.i = add i64 %sub10.i, %vec1.sroa.4.0.extract.shift.i
%vec4.sroa.0.0.extract.trunc = trunc i64 %add.i to i32
%vec4.sroa.5.0.extract.trunc = trunc i64 %add16.i to i32
%sub10.i14 = sub i64 %0, %add.i
%add.i16 = add i64 %sub10.i, %add.i
%add16.i17 = add i64 %sub10.i14, %add16.i
%vec3.sroa.0.0.extract.trunc = trunc i64 %add.i16 to i32
%vec3.sroa.4.0.extract.trunc = trunc i64 %add16.i17 to i32
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %vec3.sroa.0.0.extract.trunc, i32 noundef %vec3.sroa.4.0.extract.trunc, i32 noundef %vec4.sroa.0.0.extract.trunc, i32 noundef %vec4.sroa.5.0.extract.trunc)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %vec2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %vec1) #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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
/* ex 7_1
offNaria */
#include <stdio.h>
typedef struct point
{
int x_elem;
int y_elem;
} point;
//b-aベクトルをaを中心として反時計まわりに90度回転し,始点をbにしたものの終点を計算する関数
point rotate(point a, point b);
int main(void)
{
point p_1, p_2, p_3, p_4;
scanf("%d %d %d %d", &p_1.x_elem, &p_1.y_elem, &p_2.x_elem, &p_2.y_elem);
p_3 = rotate(p_1, p_2); //p_2-p_1ベクトルをp_1を中心として反時計回りに90度回転し,始点をp_2としたベクトルの終点がp_3
p_4 = rotate(p_2, p_3); //p_3-p_2ベクトルをp_2を中心として反時計回りに90度回転し,始点をp_3としたベクトルの終点がp_4
printf("%d %d %d %d\n", p_3.x_elem, p_3.y_elem, p_4.x_elem, p_4.y_elem);
return 0;
}
point rotate(point a, point b)
{
point rotatedVec = {b.x_elem + (a.y_elem - b.y_elem), b.y_elem + (b.x_elem - a.x_elem)};
return rotatedVec;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145256/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145256/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.point = type { i32, i32 }
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%d %d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%p_1 = alloca %struct.point, align 8
%p_2 = alloca %struct.point, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %p_1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %p_2) #4
%y_elem = getelementptr inbounds %struct.point, ptr %p_1, i64 0, i32 1
%y_elem2 = getelementptr inbounds %struct.point, ptr %p_2, i64 0, i32 1
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %p_1, ptr noundef nonnull %y_elem, ptr noundef nonnull %p_2, ptr noundef nonnull %y_elem2)
%0 = load i64, ptr %p_1, align 8
%1 = load i64, ptr %p_2, align 8
%a.sroa.2.0.extract.shift.i = lshr i64 %0, 32
%b.sroa.3.0.extract.shift.i = lshr i64 %1, 32
%sub.i = add i64 %a.sroa.2.0.extract.shift.i, %1
%add.i = sub i64 %sub.i, %b.sroa.3.0.extract.shift.i
%sub7.i = sub i64 %1, %0
%add8.i = add i64 %sub7.i, %b.sroa.3.0.extract.shift.i
%p_3.sroa.0.0.extract.trunc = trunc i64 %add.i to i32
%p_3.sroa.5.0.extract.trunc = trunc i64 %add8.i to i32
%add.i15 = sub i64 %sub.i, %add8.i
%sub7.i16 = sub i64 %add.i, %1
%add8.i17 = add i64 %sub7.i16, %add8.i
%p_4.sroa.0.0.extract.trunc = trunc i64 %add.i15 to i32
%p_4.sroa.4.0.extract.trunc = trunc i64 %add8.i17 to i32
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %p_3.sroa.0.0.extract.trunc, i32 noundef %p_3.sroa.5.0.extract.trunc, i32 noundef %p_4.sroa.0.0.extract.trunc, i32 noundef %p_4.sroa.4.0.extract.trunc)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %p_2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %p_1) #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 norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @rotate(i64 %a.coerce, i64 %b.coerce) local_unnamed_addr #3 {
entry:
%a.sroa.2.0.extract.shift = lshr i64 %a.coerce, 32
%b.sroa.3.0.extract.shift = lshr i64 %b.coerce, 32
%sub = add i64 %a.sroa.2.0.extract.shift, %b.coerce
%add = sub i64 %sub, %b.sroa.3.0.extract.shift
%sub7 = sub i64 %b.coerce, %a.coerce
%add8 = add i64 %sub7, %b.sroa.3.0.extract.shift
%retval.sroa.2.0.insert.ext = shl i64 %add8, 32
%retval.sroa.0.0.insert.ext = and i64 %add, 4294967295
%retval.sroa.0.0.insert.insert = or i64 %retval.sroa.0.0.insert.ext, %retval.sroa.2.0.insert.ext
ret i64 %retval.sroa.0.0.insert.insert
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main()
{
int i,n,flag=0;
scanf("%d",&n);
char A[n][6];
for(i=0;i<n;i++)
{
scanf("%s",A[i]);
if(flag==0&&A[i][0]=='O'&&A[i][1]=='O')
{
A[i][0] = '+';
A[i][1] = '+';
flag = 1;
}
if(flag==0&&A[i][3]=='O'&&A[i][4]=='O')
{
A[i][3] = '+';
A[i][4] = '+';
flag = 1;
}
}
if(flag==0)
{
printf("NO\n");
}
else
{
printf("YES\n");
for(i=0;i<n;i++)
printf("%s\n",A[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1453/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1453/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@str.5 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca [6 x i8], i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp79 = icmp sgt i32 %3, 0
br i1 %cmp79, label %for.body, label %if.then47
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%flag.080 = phi i32 [ %flag.2, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [6 x i8], ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%cmp2 = icmp eq i32 %flag.080, 0
br i1 %cmp2, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%4 = load i8, ptr %arrayidx, align 2, !tbaa !9
%cmp6 = icmp eq i8 %4, 79
br i1 %cmp6, label %land.lhs.true8, label %land.lhs.true23
land.lhs.true8: ; preds = %land.lhs.true
%arrayidx11 = getelementptr inbounds [6 x i8], ptr %vla, i64 %indvars.iv, i64 1
%5 = load i8, ptr %arrayidx11, align 1, !tbaa !9
%cmp13 = icmp eq i8 %5, 79
br i1 %cmp13, label %if.then, label %land.lhs.true23
if.then: ; preds = %land.lhs.true8
store i8 43, ptr %arrayidx, align 2, !tbaa !9
store i8 43, ptr %arrayidx11, align 1, !tbaa !9
br label %for.inc
land.lhs.true23: ; preds = %land.lhs.true, %land.lhs.true8
%arrayidx26 = getelementptr inbounds [6 x i8], ptr %vla, i64 %indvars.iv, i64 3
%6 = load i8, ptr %arrayidx26, align 1, !tbaa !9
%cmp28 = icmp eq i8 %6, 79
br i1 %cmp28, label %land.lhs.true30, label %for.inc
land.lhs.true30: ; preds = %land.lhs.true23
%arrayidx33 = getelementptr inbounds [6 x i8], ptr %vla, i64 %indvars.iv, i64 4
%7 = load i8, ptr %arrayidx33, align 2, !tbaa !9
%cmp35 = icmp eq i8 %7, 79
br i1 %cmp35, label %if.then37, label %for.inc
if.then37: ; preds = %land.lhs.true30
store i8 43, ptr %arrayidx26, align 1, !tbaa !9
store i8 43, ptr %arrayidx33, align 2, !tbaa !9
br label %for.inc
for.inc: ; preds = %if.then, %for.body, %land.lhs.true23, %land.lhs.true30, %if.then37
%8 = phi i1 [ false, %if.then37 ], [ true, %land.lhs.true30 ], [ true, %land.lhs.true23 ], [ false, %for.body ], [ false, %if.then ]
%flag.2 = phi i32 [ 1, %if.then37 ], [ 0, %land.lhs.true30 ], [ 0, %land.lhs.true23 ], [ 1, %for.body ], [ 1, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp = icmp slt i64 %indvars.iv.next, %10
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %for.inc
br i1 %8, label %if.then47, label %if.else
if.then47: ; preds = %entry, %for.end
%puts78 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
br label %if.end61
if.else: ; preds = %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%11 = load i32, ptr %n, align 4, !tbaa !5
%cmp5182 = icmp sgt i32 %11, 0
br i1 %cmp5182, label %for.body53, label %if.end61
for.body53: ; preds = %if.else, %for.body53
%indvars.iv85 = phi i64 [ %indvars.iv.next86, %for.body53 ], [ 0, %if.else ]
%arrayidx55 = getelementptr inbounds [6 x i8], ptr %vla, i64 %indvars.iv85
%puts77 = call i32 @puts(ptr nonnull dereferenceable(1) %arrayidx55)
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp51 = icmp slt i64 %indvars.iv.next86, %13
br i1 %cmp51, label %for.body53, label %if.end61, !llvm.loop !12
if.end61: ; preds = %for.body53, %if.else, %if.then47
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
int main(void)
{
int x1, y1, x2, y2, dx, dy;
scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
dx = y1-y2;
dy = x2-x1;
printf("%d %d %d %d\n", dx+x2, dy+y2, dx+x1, dy+y1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145342/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145342/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%d %d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca i32, align 4
%y1 = alloca i32, align 4
%x2 = alloca i32, align 4
%y2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x2) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y2) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load i32, ptr %y1, align 4, !tbaa !5
%1 = load i32, ptr %y2, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = load i32, ptr %x2, align 4, !tbaa !5
%3 = load i32, ptr %x1, align 4, !tbaa !5
%sub1 = sub nsw i32 %2, %3
%add = add nsw i32 %sub, %2
%add2 = add nsw i32 %sub1, %1
%add3 = add nsw i32 %3, %sub
%add4 = add nsw i32 %sub1, %0
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add, i32 noundef %add2, i32 noundef %add3, i32 noundef %add4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y1) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x1) #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[4],y[4];
for(i=0;i<2;i++){
scanf("%d %d",&x[i],&y[i]);
}
for(i=2;i<4;i++){
x[i]=x[i-1]+y[i-2]-y[i-1];
y[i]=-x[i-2]+x[i-1]+y[i-1];
printf("%d %d ",x[i],y[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145386/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145386/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca [4 x i32], align 16
%y = alloca [4 x i32], align 16
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%arrayidx.1 = getelementptr inbounds [4 x i32], ptr %x, i64 0, i64 1
%arrayidx2.1 = getelementptr inbounds [4 x i32], ptr %y, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1, ptr noundef nonnull %arrayidx2.1)
%0 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%1 = load i32, ptr %y, align 16, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %arrayidx2.1, align 4, !tbaa !5
%sub14 = sub i32 %add, %2
%arrayidx16 = getelementptr inbounds [4 x i32], ptr %x, i64 0, i64 2
store i32 %sub14, ptr %arrayidx16, align 8, !tbaa !5
%3 = load i32, ptr %x, align 16, !tbaa !5
%add24 = sub i32 %0, %3
%add28 = add nsw i32 %add24, %2
%arrayidx30 = getelementptr inbounds [4 x i32], ptr %y, i64 0, i64 2
store i32 %add28, ptr %arrayidx30, align 8, !tbaa !5
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub14, i32 noundef %add28)
%4 = load i32, ptr %arrayidx16, align 8, !tbaa !5
%5 = load i32, ptr %arrayidx2.1, align 4, !tbaa !5
%add.1 = add nsw i32 %5, %4
%6 = load i32, ptr %arrayidx30, align 8, !tbaa !5
%sub14.1 = sub i32 %add.1, %6
%arrayidx16.1 = getelementptr inbounds [4 x i32], ptr %x, i64 0, i64 3
store i32 %sub14.1, ptr %arrayidx16.1, align 4, !tbaa !5
%7 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%add24.1 = sub i32 %4, %7
%add28.1 = add nsw i32 %add24.1, %6
%arrayidx30.1 = getelementptr inbounds [4 x i32], ptr %y, i64 0, i64 3
store i32 %add28.1, ptr %arrayidx30.1, align 4, !tbaa !5
%call35.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub14.1, i32 noundef %add28.1)
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int x1, x2, y1, y2;
scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
int dx, dy;
dx = x2 - x1;
dy = y2 - y1;
printf("%d %d %d %d\n", x2 - dy, y2 + dx, x1 - dy, y1 + dx);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145436/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145436/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%d %d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca i32, align 4
%x2 = alloca i32, align 4
%y1 = alloca i32, align 4
%y2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x2) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y2) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load i32, ptr %x2, align 4, !tbaa !5
%1 = load i32, ptr %x1, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = load i32, ptr %y2, align 4, !tbaa !5
%3 = load i32, ptr %y1, align 4, !tbaa !5
%sub1 = sub nsw i32 %2, %3
%sub2 = sub nsw i32 %0, %sub1
%add = add nsw i32 %2, %sub
%sub3 = sub nsw i32 %1, %sub1
%add4 = add nsw i32 %3, %sub
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2, i32 noundef %add, i32 noundef %sub3, i32 noundef %add4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y1) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x1) #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 a[105];
int main()
{
int i,n,k,cntl=0,cntr=0;
scanf("%d%d",&n,&k);
for(i=0;i<n;i++)
scanf("%d",a+i);
for(i=0;i<n;i++)
{
if(a[i]<=k)
cntl++;
else
break;
}
for(i=n-1;i>=0;i--)
{
if(a[i]<=k)
cntr++;
else
break;
}
if(cntl+cntr<n)
printf("%d",cntl+cntr);
else
printf("%d",n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14548/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14548/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@a = dso_local global [105 x i32] zeroinitializer, align 16
; 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) #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 %n, align 4, !tbaa !5
%cmp41 = icmp sgt i32 %0, 0
br i1 %cmp41, label %for.body, label %for.end21
for.cond2.preheader: ; preds = %for.body
%cmp343 = icmp sgt i32 %2, 0
br i1 %cmp343, label %for.body4.lr.ph, label %for.end21
for.body4.lr.ph: ; preds = %for.cond2.preheader
%1 = load i32, ptr %k, align 4, !tbaa !5
%wide.trip.count = zext i32 %2 to i64
br label %for.body4
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
%call1 = 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
%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.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4.lr.ph, %if.then
%indvars.iv56 = phi i64 [ 0, %for.body4.lr.ph ], [ %indvars.iv.next57, %if.then ]
%arrayidx = getelementptr inbounds [105 x i32], ptr @a, i64 0, i64 %indvars.iv56
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp5.not = icmp sgt i32 %4, %1
br i1 %cmp5.not, label %for.end9.split.loop.exit74, label %if.then
if.then: ; preds = %for.body4
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%exitcond.not = icmp eq i64 %indvars.iv.next57, %wide.trip.count
br i1 %exitcond.not, label %for.end9, label %for.body4, !llvm.loop !11
for.end9.split.loop.exit74: ; preds = %for.body4
%indvars58.le = trunc i64 %indvars.iv56 to i32
br label %for.end9
for.end9: ; preds = %if.then, %for.end9.split.loop.exit74
%cntl.0.lcssa = phi i32 [ %indvars58.le, %for.end9.split.loop.exit74 ], [ %2, %if.then ]
br i1 %cmp343, label %for.body12.lr.ph, label %for.end21
for.body12.lr.ph: ; preds = %for.end9
%5 = load i32, ptr %k, align 4, !tbaa !5
%6 = zext i32 %2 to i64
br label %for.body12
for.body12: ; preds = %for.body12.lr.ph, %if.then16
%indvars.iv61 = phi i64 [ %6, %for.body12.lr.ph ], [ %indvars.iv.next62, %if.then16 ]
%cntr.050 = phi i32 [ 0, %for.body12.lr.ph ], [ %inc17, %if.then16 ]
%indvars.iv.next62 = add nsw i64 %indvars.iv61, -1
%idxprom13 = and i64 %indvars.iv.next62, 4294967295
%arrayidx14 = getelementptr inbounds [105 x i32], ptr @a, i64 0, i64 %idxprom13
%7 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp15.not = icmp sgt i32 %7, %5
br i1 %cmp15.not, label %for.end21, label %if.then16
if.then16: ; preds = %for.body12
%inc17 = add nuw nsw i32 %cntr.050, 1
%exitcond64.not = icmp eq i32 %inc17, %2
br i1 %exitcond64.not, label %for.end21, label %for.body12, !llvm.loop !12
for.end21: ; preds = %if.then16, %for.body12, %entry, %for.cond2.preheader, %for.end9
%cntl.0.lcssa73 = phi i32 [ %cntl.0.lcssa, %for.end9 ], [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %cntl.0.lcssa, %for.body12 ], [ %cntl.0.lcssa, %if.then16 ]
%.lcssa6772 = phi i32 [ %2, %for.end9 ], [ %2, %for.cond2.preheader ], [ %0, %entry ], [ %2, %for.body12 ], [ %2, %if.then16 ]
%cntr.0.lcssa = phi i32 [ 0, %for.end9 ], [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %2, %if.then16 ], [ %cntr.050, %for.body12 ]
%add = add nuw nsw i32 %cntr.0.lcssa, %cntl.0.lcssa73
%add..lcssa6772 = call i32 @llvm.smin.i32(i32 %add, i32 %.lcssa6772)
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add..lcssa6772)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define N 10
#define C 10000
long n, a, b;
int main(){
scanf("%ld %ld %ld",&n, &a, &b);
long c, d, d1;
c = n/(a+b);
d = n%(a+b);
if (d<=a){
d1 = d;
}
else{
d1 = a;
}
printf("%ld\n", c*a+d1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145522/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145522/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%ld %ld %ld\00", align 1
@n = dso_local global i64 0, align 8
@a = dso_local global i64 0, align 8
@b = dso_local global i64 0, align 8
@.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:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @a, ptr noundef nonnull @b)
%0 = load i64, ptr @n, align 8, !tbaa !5
%1 = load i64, ptr @a, align 8, !tbaa !5
%2 = load i64, ptr @b, align 8, !tbaa !5
%add = add nsw i64 %2, %1
%rem = srem i64 %0, %add
%.rem = tail call i64 @llvm.smin.i64(i64 %rem, i64 %1)
%div = sdiv i64 %0, %add
%mul = mul nsw i64 %div, %1
%add2 = add nsw i64 %mul, %.rem
%call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add2)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
long n, a, b;
scanf("%ld%ld%ld",&n,&a,&b);
long sum = 0;
long mod;
long div;
if (a == 0)
{
printf("0");
return 0;
}
if (n >= a + b)
{
mod = n % (a + b);
div = n / (a + b);
if (a >= mod)
sum = a * div + mod;
else if (mod > a)
{
sum = div * a;
sum += a;
}
printf("%ld", sum);
return 0;
}
else if (n < a + b)
{
if (n > a)
sum = a;
else
sum = n;
}
printf("%ld", sum);
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145566/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145566/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"%ld%ld%ld\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:
%n = alloca i64, align 8
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i64, ptr %a, align 8, !tbaa !5
%cmp = icmp eq i64 %0, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%putchar = call i32 @putchar(i32 48)
br label %cleanup
if.end: ; preds = %entry
%1 = load i64, ptr %n, align 8, !tbaa !5
%2 = load i64, ptr %b, align 8, !tbaa !5
%add = add nsw i64 %2, %0
%cmp2.not = icmp slt i64 %1, %add
br i1 %cmp2.not, label %if.then20, label %if.then3
if.then3: ; preds = %if.end
%rem = srem i64 %1, %add
%div6 = sdiv i64 %1, %add
%cmp7.not = icmp slt i64 %0, %rem
br i1 %cmp7.not, label %if.then11, label %if.then8
if.then8: ; preds = %if.then3
%mul = mul nsw i64 %div6, %0
%add9 = add nsw i64 %mul, %rem
br label %if.end15
if.then11: ; preds = %if.then3
%mul1239 = add i64 %div6, 1
%add13 = mul i64 %mul1239, %0
br label %if.end15
if.end15: ; preds = %if.then11, %if.then8
%sum.0 = phi i64 [ %add9, %if.then8 ], [ %add13, %if.then11 ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %sum.0)
br label %cleanup
if.then20: ; preds = %if.end
%. = call i64 @llvm.smin.i64(i64 %1, i64 %0)
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %.)
br label %cleanup
cleanup: ; preds = %if.then20, %if.end15, %if.then
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 8, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>
#define ll long long int
int main(void)
{
ll N,A,B;
scanf("%lld %lld %lld",&N,&A,&B);
ll result;
ll divi = N / (A + B);
ll remaind = N % (A + B);
if(remaind < A)
{
result = A * divi + remaind;
}
else
{
result = A * divi + A;
}
printf("%lld",result);
return EXIT_SUCCESS;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145609/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145609/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"%lld %lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
%A = alloca i64, align 8
%B = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #3
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 %N, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i64, ptr %N, align 8, !tbaa !5
%1 = load i64, ptr %A, align 8, !tbaa !5
%2 = load i64, ptr %B, align 8, !tbaa !5
%add = add nsw i64 %2, %1
%div = sdiv i64 %0, %add
%rem = srem i64 %0, %add
%cmp = icmp slt i64 %rem, %1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%mul = mul nsw i64 %div, %1
%add2 = add nsw i64 %mul, %rem
br label %if.end
if.else: ; preds = %entry
%3 = add i64 %div, 1
%add4 = mul i64 %3, %1
br label %if.end
if.end: ; preds = %if.else, %if.then
%result.0 = phi i64 [ %add2, %if.then ], [ %add4, %if.else ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %result.0)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
long n,a,b;
long z = 0;
long ans = 0;
if(scanf("%ld%ld%ld",&n,&a,&b) != -1){
ans = n / (a + b) * a;
z = n % (a + b);
if(a <= z){
ans = ans + a;
}else{
ans = ans + z;
}
printf("%ld",ans);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145652/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145652/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [10 x i8] c"%ld%ld%ld\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:
%n = alloca i64, align 8
%a = alloca i64, align 8
%b = 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 %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %if.end7, label %if.then
if.then: ; preds = %entry
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
%2 = load i64, ptr %b, align 8, !tbaa !5
%add = add nsw i64 %2, %1
%div = sdiv i64 %0, %add
%mul = mul nsw i64 %div, %1
%rem = srem i64 %0, %add
%rem. = call i64 @llvm.smin.i64(i64 %1, i64 %rem)
%ans.0 = add nsw i64 %rem., %mul
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0)
br label %if.end7
if.end7: ; preds = %if.then, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.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"}
|
#include<stdio.h>
int main()
{
long long n,a,b,k,s,p;
scanf("%lld",&n);
scanf("%lld",&a);
scanf("%lld",&b);
if(a==0 && b==0)
{
printf("0");
}
if(a==0 && b!=0)
{
printf("0");
}
if(a!=0)
{
k=n/(a+b);
s=n%(a+b);
if(s<=a)
{
p=s;
}
else
{
p=a;
}
printf("%lld",(k*a)+p);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145696/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145696/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%0 = load i64, ptr %a, align 8, !tbaa !5
%cmp = icmp eq i64 %0, 0
%1 = load i64, ptr %b, align 8
%cmp3 = icmp eq i64 %1, 0
%or.cond = select i1 %cmp, i1 %cmp3, i1 false
br i1 %or.cond, label %if.then, label %if.end
if.then: ; preds = %entry
%putchar = call i32 @putchar(i32 48)
%.pre = load i64, ptr %a, align 8, !tbaa !5
%.pre23 = load i64, ptr %b, align 8
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i64 [ %.pre23, %if.then ], [ %1, %entry ]
%3 = phi i64 [ %.pre, %if.then ], [ %0, %entry ]
%cmp5 = icmp eq i64 %3, 0
%cmp7 = icmp ne i64 %2, 0
%or.cond20 = select i1 %cmp5, i1 %cmp7, i1 false
br i1 %or.cond20, label %if.then8, label %if.end10
if.then8: ; preds = %if.end
%putchar22 = call i32 @putchar(i32 48)
%.pr = load i64, ptr %a, align 8, !tbaa !5
br label %if.end10
if.end10: ; preds = %if.then8, %if.end
%4 = phi i64 [ %.pr, %if.then8 ], [ %3, %if.end ]
%cmp11.not = icmp eq i64 %4, 0
br i1 %cmp11.not, label %if.end19, label %if.then12
if.then12: ; preds = %if.end10
%5 = load i64, ptr %n, align 8, !tbaa !5
%6 = load i64, ptr %b, align 8, !tbaa !5
%add = add nsw i64 %6, %4
%div = sdiv i64 %5, %add
%rem = srem i64 %5, %add
%.rem = call i64 @llvm.smin.i64(i64 %rem, i64 %4)
%mul = mul nsw i64 %div, %4
%add17 = add nsw i64 %.rem, %mul
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %add17)
br label %if.end19
if.end19: ; preds = %if.then12, %if.end10
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 8, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main() {
long long int N, A, B, n, tmp, ans;
scanf("%lld %lld %lld", &N, &A, &B);
n = A + B;
tmp = N % n; // 余り
N /= n; // 何セットできたか
if(tmp > A) {// 余りがAより多いか少ないか
ans = (N+1) * A;
} else {
ans = N * A + tmp;
}
printf("%lld", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145739/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145739/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"%lld %lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
%A = alloca i64, align 8
%B = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #3
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 %N, 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
%add = add nsw i64 %1, %0
%2 = load i64, ptr %N, align 8, !tbaa !5
%rem = srem i64 %2, %add
%div = sdiv i64 %2, %add
store i64 %div, ptr %N, align 8, !tbaa !5
%cmp = icmp sgt i64 %rem, %0
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%add1 = add nsw i64 %div, 1
%mul = mul nsw i64 %add1, %0
br label %if.end
if.else: ; preds = %entry
%mul2 = mul nsw i64 %div, %0
%add3 = add nsw i64 %mul2, %rem
br label %if.end
if.end: ; preds = %if.else, %if.then
%ans.0 = phi i64 [ %mul, %if.then ], [ %add3, %if.else ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <string.h>
int main(){
long long N,A,B;
int a=0,b=0,i;
char s[110];
long long K=0,amari,ans_amari;
scanf("%lld%lld%lld",&N,&A,&B);
if(A==0){
printf("0\n");return 0;
}
K = N/(A+B);
amari = N%(A+B);
if(amari<A)ans_amari=amari;
else ans_amari=A;
printf("%lld\n", A*K+ans_amari);
//printf("%ld %ld*(%ld - %ld)\n", cnt,edge,K,sa);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145782/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145782/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%lld%lld%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
%A = alloca i64, align 8
%B = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %B) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i64, ptr %A, align 8, !tbaa !5
%cmp = icmp eq i64 %0, 0
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
%1 = load i64, ptr %N, align 8, !tbaa !5
%2 = load i64, ptr %B, align 8, !tbaa !5
%add = add nsw i64 %2, %0
%div = sdiv i64 %1, %add
%rem = srem i64 %1, %add
%rem. = call i64 @llvm.smin.i64(i64 %rem, i64 %0)
%mul = mul nsw i64 %div, %0
%add6 = add nsw i64 %rem., %mul
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add6)
br label %cleanup
cleanup: ; preds = %if.end, %if.then
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 8, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct robot {
intmax_t X;
intmax_t L;
bool d;
};
int compare(const void *a, const void *b)
{
if ((((struct robot *)a)->X + ((struct robot *)a)->L) < (((struct robot *)b)->X + ((struct robot *)b)->L))
return -1;
if ((((struct robot *)a)->X + ((struct robot *)a)->L) > (((struct robot *)b)->X + ((struct robot *)b)->L))
return 1;
return 0;
}
int main(void)
{
intmax_t N;
struct robot robot[100000] = {};
intmax_t ans = 0;
scanf("%jd", &N);
for (size_t i = 0; i < N; i++) {
scanf("%jd%jd", &robot[i].X, &robot[i].L);
}
qsort(robot, N, sizeof(struct robot), compare);
intmax_t e = robot[0].X + robot[0].L;
ans = 1;
for (size_t i = 1; i < N; i++) {
if (e > (robot[i].X - robot[i].L))
continue;
ans++;
e = (robot[i].X + robot[i].L);
}
printf("%jd\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145825/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145825/source.c"
target datalayout = "e-m:e-p270: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.robot = type { i64, i64, i8 }
@.str = private unnamed_addr constant [4 x i8] c"%jd\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%jd%jd\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%jd\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 i64, ptr %a, align 8, !tbaa !5
%L = getelementptr inbounds %struct.robot, ptr %a, i64 0, i32 1
%1 = load i64, ptr %L, align 8, !tbaa !11
%add = add nsw i64 %1, %0
%2 = load i64, ptr %b, align 8, !tbaa !5
%L2 = getelementptr inbounds %struct.robot, ptr %b, i64 0, i32 1
%3 = load i64, ptr %L2, align 8, !tbaa !11
%add3 = add nsw i64 %3, %2
%cmp = icmp slt i64 %add, %add3
%cmp10 = icmp sgt i64 %add, %add3
%. = zext i1 %cmp10 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 #1 {
entry:
%N = alloca i64, align 8
%robot = alloca [100000 x %struct.robot], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 2400000, ptr nonnull %robot) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2400000) %robot, i8 0, i64 2400000, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !12
%cmp36.not = icmp eq i64 %0, 0
br i1 %cmp36.not, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i64 [ 0, %entry ], [ %6, %for.body ]
call void @qsort(ptr noundef nonnull %robot, i64 noundef %.lcssa, i64 noundef 24, ptr noundef nonnull @compare) #6
%1 = load i64, ptr %N, align 8, !tbaa !12
%cmp938 = icmp ugt i64 %1, 1
br i1 %cmp938, label %for.body11.preheader, label %for.cond.cleanup10
for.body11.preheader: ; preds = %for.cond.cleanup
%L6 = getelementptr inbounds %struct.robot, ptr %robot, i64 0, i32 1
%2 = load i64, ptr %L6, align 8, !tbaa !11
%3 = load i64, ptr %robot, align 16, !tbaa !5
%add = add nsw i64 %2, %3
%4 = add i64 %1, -1
%xtraiter = and i64 %4, 1
%5 = icmp eq i64 %1, 2
br i1 %5, label %for.cond.cleanup10.loopexit.unr-lcssa, label %for.body11.preheader.new
for.body11.preheader.new: ; preds = %for.body11.preheader
%unroll_iter = and i64 %4, -2
br label %for.body11
for.body: ; preds = %entry, %for.body
%i.037 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x %struct.robot], ptr %robot, i64 0, i64 %i.037
%L = getelementptr inbounds [100000 x %struct.robot], ptr %robot, i64 0, i64 %i.037, i32 1
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %L)
%inc = add nuw i64 %i.037, 1
%6 = load i64, ptr %N, align 8, !tbaa !12
%cmp = icmp ult i64 %inc, %6
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
for.cond.cleanup10.loopexit.unr-lcssa: ; preds = %for.body11, %for.body11.preheader
%ans.1.lcssa.ph = phi i64 [ undef, %for.body11.preheader ], [ %ans.1.1, %for.body11 ]
%i7.041.unr = phi i64 [ 1, %for.body11.preheader ], [ %inc24.1, %for.body11 ]
%e.040.unr = phi i64 [ %add, %for.body11.preheader ], [ %e.1.1, %for.body11 ]
%ans.039.unr = phi i64 [ 1, %for.body11.preheader ], [ %ans.1.1, %for.body11 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup10, label %for.body11.epil
for.body11.epil: ; preds = %for.cond.cleanup10.loopexit.unr-lcssa
%arrayidx12.epil = getelementptr inbounds [100000 x %struct.robot], ptr %robot, i64 0, i64 %i7.041.unr
%7 = load i64, ptr %arrayidx12.epil, align 8, !tbaa !5
%L15.epil = getelementptr inbounds [100000 x %struct.robot], ptr %robot, i64 0, i64 %i7.041.unr, i32 1
%8 = load i64, ptr %L15.epil, align 8, !tbaa !11
%sub.epil = sub nsw i64 %7, %8
%cmp16.epil = icmp sle i64 %e.040.unr, %sub.epil
%inc17.epil = zext i1 %cmp16.epil to i64
%ans.1.epil = add nuw nsw i64 %ans.039.unr, %inc17.epil
br label %for.cond.cleanup10
for.cond.cleanup10: ; preds = %for.body11.epil, %for.cond.cleanup10.loopexit.unr-lcssa, %for.cond.cleanup
%ans.0.lcssa = phi i64 [ 1, %for.cond.cleanup ], [ %ans.1.lcssa.ph, %for.cond.cleanup10.loopexit.unr-lcssa ], [ %ans.1.epil, %for.body11.epil ]
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2400000, ptr nonnull %robot) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #6
ret i32 0
for.body11: ; preds = %for.body11, %for.body11.preheader.new
%i7.041 = phi i64 [ 1, %for.body11.preheader.new ], [ %inc24.1, %for.body11 ]
%e.040 = phi i64 [ %add, %for.body11.preheader.new ], [ %e.1.1, %for.body11 ]
%ans.039 = phi i64 [ 1, %for.body11.preheader.new ], [ %ans.1.1, %for.body11 ]
%niter = phi i64 [ 0, %for.body11.preheader.new ], [ %niter.next.1, %for.body11 ]
%arrayidx12 = getelementptr inbounds [100000 x %struct.robot], ptr %robot, i64 0, i64 %i7.041
%9 = load i64, ptr %arrayidx12, align 8, !tbaa !5
%L15 = getelementptr inbounds [100000 x %struct.robot], ptr %robot, i64 0, i64 %i7.041, i32 1
%10 = load i64, ptr %L15, align 8, !tbaa !11
%sub = sub nsw i64 %9, %10
%cmp16 = icmp sle i64 %e.040, %sub
%add22 = add nsw i64 %10, %9
%inc17 = zext i1 %cmp16 to i64
%ans.1 = add nuw nsw i64 %ans.039, %inc17
%e.1 = select i1 %cmp16, i64 %add22, i64 %e.040
%inc24 = add nuw i64 %i7.041, 1
%arrayidx12.1 = getelementptr inbounds [100000 x %struct.robot], ptr %robot, i64 0, i64 %inc24
%11 = load i64, ptr %arrayidx12.1, align 8, !tbaa !5
%L15.1 = getelementptr inbounds [100000 x %struct.robot], ptr %robot, i64 0, i64 %inc24, i32 1
%12 = load i64, ptr %L15.1, align 8, !tbaa !11
%sub.1 = sub nsw i64 %11, %12
%cmp16.1 = icmp sle i64 %e.1, %sub.1
%add22.1 = add nsw i64 %12, %11
%inc17.1 = zext i1 %cmp16.1 to i64
%ans.1.1 = add nuw nsw i64 %ans.1, %inc17.1
%e.1.1 = select i1 %cmp16.1, i64 %add22.1, i64 %e.1
%inc24.1 = add nuw i64 %i7.041, 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 %for.body11, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; 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
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"robot", !7, i64 0, !7, i64 8, !10, i64 16}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_Bool", !8, i64 0}
!11 = !{!6, !7, i64 8}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{ char a[4];
int i,t;
while(~scanf("%s",&a))
{ int t=0;
for(i=0;i<4;i++)
{
if(a[i]=='+')
t++;
else
if(a[i]=='-')
t--;
}
printf("%d\n",t);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145883/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145883/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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() local_unnamed_addr #0 {
entry:
%a = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%tobool.not21 = icmp eq i32 %call20, -1
br i1 %tobool.not21, label %while.end, label %for.cond.preheader.preheader
for.cond.preheader.preheader: ; preds = %entry
%arrayidx.1 = getelementptr inbounds [4 x i8], ptr %a, i64 0, i64 1
%arrayidx.2 = getelementptr inbounds [4 x i8], ptr %a, i64 0, i64 2
%arrayidx.3 = getelementptr inbounds [4 x i8], ptr %a, i64 0, i64 3
br label %for.cond.preheader
for.cond.preheader: ; preds = %for.cond.preheader.preheader, %for.inc.3
%0 = load i8, ptr %a, align 1, !tbaa !5
%switch.selectcmp = icmp eq i8 %0, 45
%switch.select = sext i1 %switch.selectcmp to i32
%switch.selectcmp23 = icmp eq i8 %0, 43
%switch.select24 = select i1 %switch.selectcmp23, i32 1, i32 %switch.select
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %1, label %for.inc.1 [
i8 43, label %if.then.1
i8 45, label %if.then9.1
]
if.then9.1: ; preds = %for.cond.preheader
%dec.1 = add nsw i32 %switch.select24, -1
br label %for.inc.1
if.then.1: ; preds = %for.cond.preheader
%inc.1 = add nsw i32 %switch.select24, 1
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %if.then9.1, %for.cond.preheader
%t1.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ %dec.1, %if.then9.1 ], [ %switch.select24, %for.cond.preheader ]
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
switch i8 %2, label %for.inc.2 [
i8 43, label %if.then.2
i8 45, label %if.then9.2
]
if.then9.2: ; preds = %for.inc.1
%dec.2 = add nsw i32 %t1.1.1, -1
br label %for.inc.2
if.then.2: ; preds = %for.inc.1
%inc.2 = add nsw i32 %t1.1.1, 1
br label %for.inc.2
for.inc.2: ; preds = %if.then.2, %if.then9.2, %for.inc.1
%t1.1.2 = phi i32 [ %inc.2, %if.then.2 ], [ %dec.2, %if.then9.2 ], [ %t1.1.1, %for.inc.1 ]
%3 = load i8, ptr %arrayidx.3, align 1, !tbaa !5
switch i8 %3, label %for.inc.3 [
i8 43, label %if.then.3
i8 45, label %if.then9.3
]
if.then9.3: ; preds = %for.inc.2
%dec.3 = add nsw i32 %t1.1.2, -1
br label %for.inc.3
if.then.3: ; preds = %for.inc.2
%inc.3 = add nsw i32 %t1.1.2, 1
br label %for.inc.3
for.inc.3: ; preds = %if.then.3, %if.then9.3, %for.inc.2
%t1.1.3 = phi i32 [ %inc.3, %if.then.3 ], [ %dec.3, %if.then9.3 ], [ %t1.1.2, %for.inc.2 ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %t1.1.3)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%tobool.not = icmp eq i32 %call, -1
br i1 %tobool.not, label %while.end, label %for.cond.preheader, !llvm.loop !8
while.end: ; preds = %for.inc.3, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int a,b,i,j,k=0,l=0;
char s[10];
scanf("%s",s);
for(i=0;i<4;i++)
{
if(s[i]=='+')
{
k++;
}
else if(s[i]=='-')
{
l++;
}
}
j=k-l;
printf("%d",j);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_145926/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_145926/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
switch i8 %0, label %for.inc [
i8 43, label %if.then
i8 45, label %if.then8
]
if.then: ; preds = %entry
br label %for.inc
if.then8: ; preds = %entry
br label %for.inc
for.inc: ; preds = %entry, %if.then, %if.then8
%k.1 = phi i32 [ 1, %if.then ], [ 0, %if.then8 ], [ 0, %entry ]
%l.1 = phi i32 [ 0, %if.then ], [ 1, %if.then8 ], [ 0, %entry ]
%arrayidx.1 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %1, label %for.inc.1 [
i8 43, label %if.then.1
i8 45, label %if.then8.1
]
if.then8.1: ; preds = %for.inc
%inc9.1 = add nuw nsw i32 %l.1, 1
br label %for.inc.1
if.then.1: ; preds = %for.inc
%inc.1 = add nuw nsw i32 %k.1, 1
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %if.then8.1, %for.inc
%k.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ %k.1, %if.then8.1 ], [ %k.1, %for.inc ]
%l.1.1 = phi i32 [ %l.1, %if.then.1 ], [ %inc9.1, %if.then8.1 ], [ %l.1, %for.inc ]
%arrayidx.2 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
switch i8 %2, label %for.inc.2 [
i8 43, label %if.then.2
i8 45, label %if.then8.2
]
if.then8.2: ; preds = %for.inc.1
%inc9.2 = add nuw nsw i32 %l.1.1, 1
br label %for.inc.2
if.then.2: ; preds = %for.inc.1
%inc.2 = add nuw nsw i32 %k.1.1, 1
br label %for.inc.2
for.inc.2: ; preds = %if.then.2, %if.then8.2, %for.inc.1
%k.1.2 = phi i32 [ %inc.2, %if.then.2 ], [ %k.1.1, %if.then8.2 ], [ %k.1.1, %for.inc.1 ]
%l.1.2 = phi i32 [ %l.1.1, %if.then.2 ], [ %inc9.2, %if.then8.2 ], [ %l.1.1, %for.inc.1 ]
%arrayidx.3 = getelementptr inbounds [10 x i8], ptr %s, i64 0, i64 3
%3 = load i8, ptr %arrayidx.3, align 1, !tbaa !5
switch i8 %3, label %for.inc.3 [
i8 43, label %if.then.3
i8 45, label %if.then8.3
]
if.then8.3: ; preds = %for.inc.2
%inc9.3 = add nuw nsw i32 %l.1.2, 1
br label %for.inc.3
if.then.3: ; preds = %for.inc.2
%inc.3 = add nuw nsw i32 %k.1.2, 1
br label %for.inc.3
for.inc.3: ; preds = %if.then.3, %if.then8.3, %for.inc.2
%k.1.3 = phi i32 [ %inc.3, %if.then.3 ], [ %k.1.2, %if.then8.3 ], [ %k.1.2, %for.inc.2 ]
%l.1.3 = phi i32 [ %l.1.2, %if.then.3 ], [ %inc9.3, %if.then8.3 ], [ %l.1.2, %for.inc.2 ]
%sub = sub nsw i32 %k.1.3, %l.1.3
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int t,n,i;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("1 ");
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14597/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14597/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"1 \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec7 = add nsw i32 %0, -1
store i32 %dec7, ptr %t, align 4, !tbaa !5
%tobool.not8 = icmp eq i32 %0, 0
br i1 %tobool.not8, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not5 = icmp slt i32 %1, 1
br i1 %cmp.not5, label %for.end, label %for.body
for.body: ; preds = %while.body, %for.body
%i.06 = phi i32 [ %inc, %for.body ], [ 1, %while.body ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
%inc = add nuw nsw i32 %i.06, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.06, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %while.body
%putchar = call i32 @putchar(i32 10)
%3 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %3, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %3, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void){
char sign[256];
int i;
int j,takahashi=0;
for(i=1;i<=4;i++){
scanf("%s",sign);
}
for(j=1;j<=4;j++){
if(sign[j-1]=='+'){
takahashi++;
}else{
takahashi--;
}
}
printf("%d\n",takahashi);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146011/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146011/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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() local_unnamed_addr #0 {
entry:
%sign = alloca [256 x i8], align 16
call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %sign) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sign)
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sign)
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sign)
%call.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sign)
%0 = load <4 x i8>, ptr %sign, align 16, !tbaa !5
%1 = icmp eq <4 x i8> %0, <i8 43, i8 43, i8 43, i8 43>
%2 = select <4 x i1> %1, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
%3 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %2)
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %sign) #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.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
int main(void)
{
char s[4];
int i,r=0;
scanf("%s",s);
for(i=0;i<4;i++){
if('+'==s[i]){
r=r+1;
}else if('-'==s[i]){
r=r-1;
}
}
printf("%d\n",r);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146055/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146055/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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() local_unnamed_addr #0 {
entry:
%s = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%switch.selectcmp = icmp eq i8 %0, 45
%switch.select = sext i1 %switch.selectcmp to i32
%switch.selectcmp19 = icmp eq i8 %0, 43
%switch.select20 = select i1 %switch.selectcmp19, i32 1, i32 %switch.select
%arrayidx.1 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
switch i8 %1, label %for.inc.1 [
i8 43, label %if.then.1
i8 45, label %if.then8.1
]
if.then8.1: ; preds = %entry
%sub.1 = add nsw i32 %switch.select20, -1
br label %for.inc.1
if.then.1: ; preds = %entry
%add.1 = add nsw i32 %switch.select20, 1
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %if.then8.1, %entry
%r.1.1 = phi i32 [ %add.1, %if.then.1 ], [ %sub.1, %if.then8.1 ], [ %switch.select20, %entry ]
%arrayidx.2 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx.2, align 1, !tbaa !5
switch i8 %2, label %for.inc.2 [
i8 43, label %if.then.2
i8 45, label %if.then8.2
]
if.then8.2: ; preds = %for.inc.1
%sub.2 = add nsw i32 %r.1.1, -1
br label %for.inc.2
if.then.2: ; preds = %for.inc.1
%add.2 = add nsw i32 %r.1.1, 1
br label %for.inc.2
for.inc.2: ; preds = %if.then.2, %if.then8.2, %for.inc.1
%r.1.2 = phi i32 [ %add.2, %if.then.2 ], [ %sub.2, %if.then8.2 ], [ %r.1.1, %for.inc.1 ]
%arrayidx.3 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 3
%3 = load i8, ptr %arrayidx.3, align 1, !tbaa !5
switch i8 %3, label %for.inc.3 [
i8 43, label %if.then.3
i8 45, label %if.then8.3
]
if.then8.3: ; preds = %for.inc.2
%sub.3 = add nsw i32 %r.1.2, -1
br label %for.inc.3
if.then.3: ; preds = %for.inc.2
%add.3 = add nsw i32 %r.1.2, 1
br label %for.inc.3
for.inc.3: ; preds = %if.then.3, %if.then8.3, %for.inc.2
%r.1.3 = phi i32 [ %add.3, %if.then.3 ], [ %sub.3, %if.then8.3 ], [ %r.1.2, %for.inc.2 ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %r.1.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
// Your code here!
int a = 0;
char s[5];
scanf("%s",s);
for(int i = 0; i < 4; i++)
{
a += (s[i] == '+')? 1:(-1);
}
printf("%d\n",a);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146099/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146099/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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() local_unnamed_addr #0 {
entry:
%s = alloca [5 x i8], align 4
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load <4 x i8>, ptr %s, align 4, !tbaa !5
%1 = icmp eq <4 x i8> %0, <i8 43, i8 43, i8 43, i8 43>
%2 = select <4 x i1> %1, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
%3 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %2)
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
char str[5];
int i=0,j;
scanf("%s",str);
for(j=0;j<4;j++)
{
if(str[j]=='+')
{
i++;
}
else
{
i--;
}
}
printf("%d",i);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146141/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146141/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [5 x i8], align 4
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %str) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%0 = load <4 x i8>, ptr %str, align 4, !tbaa !5
%1 = icmp eq <4 x i8> %0, <i8 43, i8 43, i8 43, i8 43>
%2 = select <4 x i1> %1, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
%3 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %2)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
call void @llvm.lifetime.end.p0(i64 5, 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 i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(int argc, char const *argv[]) {
int a = 0;
char S[5];
scanf("%s", S);
for (int i = 0; i < 4; i++) {
if (S[i] == '+')
a++;
else
a--;
}
printf("%d", a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146192/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146192/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\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:
%S = alloca [5 x i8], align 4
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %S) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%0 = load <4 x i8>, ptr %S, align 4, !tbaa !5
%1 = icmp eq <4 x i8> %0, <i8 43, i8 43, i8 43, i8 43>
%2 = select <4 x i1> %1, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
%3 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %2)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %S) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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"}
|
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
int main() {
int h, m, s,t,t3;
while (scanf("%d%d%d", &h, &m, &s)) {
if (h + m + s == -3) break;
t = t3 = 7200 - h * 3600 - m * 60 - s;
t3 *= 3;
h = t / 3600, t %= 3600;
m = t / 60, t %= 60;
printf("%02d:%02d:%02d\n", h, m, t);
h = t3 / 3600, t3 %= 3600;
m = t3 / 60, t3 %= 60;
printf("%02d:%02d:%02d\n", h, m, t3);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146242/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146242/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [16 x i8] c"%02d:%02d:%02d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%m = alloca i32, align 4
%s = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
%call27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %m, ptr noundef nonnull %s)
%tobool.not28 = icmp eq i32 %call27, 0
br i1 %tobool.not28, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%0 = load i32, ptr %h, align 4, !tbaa !5
%1 = load i32, ptr %m, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %s, align 4, !tbaa !5
%add1 = add nsw i32 %add, %2
%cmp = icmp eq i32 %add1, -3
br i1 %cmp, label %while.end, label %if.end
if.end: ; preds = %while.body
%mul.neg = mul i32 %0, -3600
%sub = add i32 %mul.neg, 7200
%mul2.neg = mul i32 %1, -60
%sub3 = add i32 %sub, %mul2.neg
%sub4 = sub i32 %sub3, %2
%mul5 = mul nsw i32 %sub4, 3
%div = sdiv i32 %sub4, 3600
store i32 %div, ptr %h, align 4, !tbaa !5
%rem = srem i32 %sub4, 3600
%div6.lhs.trunc = trunc i32 %rem to i16
%div623 = sdiv i16 %div6.lhs.trunc, 60
%div6.sext = sext i16 %div623 to i32
store i32 %div6.sext, ptr %m, align 4, !tbaa !5
%rem724 = srem i16 %div6.lhs.trunc, 60
%rem7.sext = sext i16 %rem724 to i32
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div, i32 noundef %div6.sext, i32 noundef %rem7.sext)
%div9 = sdiv i32 %sub4, 1200
store i32 %div9, ptr %h, align 4, !tbaa !5
%rem10 = srem i32 %mul5, 3600
%div11.lhs.trunc = trunc i32 %rem10 to i16
%div1125 = sdiv i16 %div11.lhs.trunc, 60
%div11.sext = sext i16 %div1125 to i32
store i32 %div11.sext, ptr %m, align 4, !tbaa !5
%rem1226 = srem i16 %div11.lhs.trunc, 60
%rem12.sext = sext i16 %rem1226 to i32
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div9, i32 noundef %div11.sext, i32 noundef %rem12.sext)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %m, ptr noundef nonnull %s)
%tobool.not = icmp eq i32 %call, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end, %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#define MAX 7200
void out(int s){
int f, m;
f = s /3600;
s %= 3600;
m = s /60;
s %= 60;
printf("0%d:", f);
printf(m / 10 > 0 ?"%d:" :"0%d:", m);
printf(s / 10 > 0 ?"%d\n" : "0%d\n", s);
}
int main(){
int f, m, s, i, j, junk;
while(1){
scanf("%d%d%d", &f, &m, &s);
if(f == -1 && m == -1 && s == -1) break;
s += 60 * m;
s += 3600 * f;
s = MAX - s;
out(s);
out(s *3);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146314/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146314/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"0%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
@.str.3 = private unnamed_addr constant [5 x i8] c"0%d\0A\00", align 1
@.str.4 = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @out(i32 noundef %s) local_unnamed_addr #0 {
entry:
%div = sdiv i32 %s, 3600
%rem = srem i32 %s, 3600
%div1.lhs.trunc = trunc i32 %rem to i16
%div115 = sdiv i16 %div1.lhs.trunc, 60
%div1.sext = sext i16 %div115 to i32
%rem216 = srem i16 %div1.lhs.trunc, 60
%rem2.sext = sext i16 %rem216 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %div)
%cmp = icmp sgt i32 %rem, 599
%cond = select i1 %cmp, ptr @.str.1, ptr @.str
%call4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond, i32 noundef %div1.sext)
%cmp6 = icmp sgt i16 %rem216, 9
%cond7 = select i1 %cmp6, ptr @.str.2, ptr @.str.3
%call8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond7, i32 noundef %rem2.sext)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%f = alloca i32, align 4
%m = alloca i32, align 4
%s = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
%call22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %f, ptr noundef nonnull %m, ptr noundef nonnull %s)
%0 = load i32, ptr %f, align 4, !tbaa !5
%cmp23 = icmp eq i32 %0, -1
%1 = load i32, ptr %m, align 4
%cmp124 = icmp eq i32 %1, -1
%or.cond25 = select i1 %cmp23, i1 %cmp124, i1 false
%2 = load i32, ptr %s, align 4
%cmp326 = icmp eq i32 %2, -1
%or.cond727 = select i1 %or.cond25, i1 %cmp326, i1 false
br i1 %or.cond727, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end
%3 = phi i32 [ %9, %if.end ], [ %2, %entry ]
%4 = phi i32 [ %8, %if.end ], [ %1, %entry ]
%5 = phi i32 [ %7, %if.end ], [ %0, %entry ]
%mul4.neg = mul i32 %5, -3600
%mul.neg = mul i32 %4, -60
%add.neg = add i32 %mul4.neg, 7200
%add5.neg = add i32 %add.neg, %mul.neg
%sub = sub i32 %add5.neg, %3
store i32 %sub, ptr %s, align 4, !tbaa !5
%div.i = sdiv i32 %sub, 3600
%rem.i = srem i32 %sub, 3600
%div1.lhs.trunc.i = trunc i32 %rem.i to i16
%div115.i = sdiv i16 %div1.lhs.trunc.i, 60
%div1.sext.i = sext i16 %div115.i to i32
%rem216.i = srem i16 %div1.lhs.trunc.i, 60
%rem2.sext.i = sext i16 %rem216.i to i32
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %div.i)
%cmp.i = icmp sgt i32 %rem.i, 599
%cond.i = select i1 %cmp.i, ptr @.str.1, ptr @.str
%call4.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond.i, i32 noundef %div1.sext.i)
%cmp6.i = icmp sgt i16 %rem216.i, 9
%cond7.i = select i1 %cmp6.i, ptr @.str.2, ptr @.str.3
%call8.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond7.i, i32 noundef %rem2.sext.i)
%6 = load i32, ptr %s, align 4, !tbaa !5
%mul6 = mul nsw i32 %6, 3
%div.i8 = sdiv i32 %6, 1200
%rem.i9 = srem i32 %mul6, 3600
%div1.lhs.trunc.i10 = trunc i32 %rem.i9 to i16
%div115.i11 = sdiv i16 %div1.lhs.trunc.i10, 60
%div1.sext.i12 = sext i16 %div115.i11 to i32
%rem216.i13 = srem i16 %div1.lhs.trunc.i10, 60
%rem2.sext.i14 = sext i16 %rem216.i13 to i32
%call.i15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %div.i8)
%cmp.i16 = icmp sgt i32 %rem.i9, 599
%cond.i17 = select i1 %cmp.i16, ptr @.str.1, ptr @.str
%call4.i18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond.i17, i32 noundef %div1.sext.i12)
%cmp6.i19 = icmp sgt i16 %rem216.i13, 9
%cond7.i20 = select i1 %cmp6.i19, ptr @.str.2, ptr @.str.3
%call8.i21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond7.i20, i32 noundef %rem2.sext.i14)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %f, ptr noundef nonnull %m, ptr noundef nonnull %s)
%7 = load i32, ptr %f, align 4, !tbaa !5
%cmp = icmp eq i32 %7, -1
%8 = load i32, ptr %m, align 4
%cmp1 = icmp eq i32 %8, -1
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%9 = load i32, ptr %s, align 4
%cmp3 = icmp eq i32 %9, -1
%or.cond7 = select i1 %or.cond, i1 %cmp3, i1 false
br i1 %or.cond7, label %while.end, label %if.end
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #3
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(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<stdlib.h>
#include<string.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 SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)
#define MOD 1000000007
int main(void){
int N;
scanf("%d",&N);
int F[N][10];
for(int i=0;i<N;i++){
for(int j=0;j<10;j++) scanf("%d",&F[i][j]);
}
long P[N][11];
for(int i=0;i<N;i++){
for(int j=0;j<11;j++) scanf("%ld",&P[i][j]);
}
long ans=-9999999999;
for(int p=1;p<(1<<10);p++){
long tmp=0;
///店iについて
for(int i=0;i<N;i++){
int c=0;
for(int j=0;j<10;j++){
if((p>>j)&F[i][j]) c++;
}
tmp+=P[i][c];
}
ans=MAX(ans,tmp);
}
printf("%ld\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146372/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146372/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.2 = private unnamed_addr constant [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) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca [10 x i32], i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp90 = icmp sgt i32 %3, 0
br i1 %cmp90, label %for.cond1.preheader, label %for.cond.cleanup35
for.cond1.preheader: ; preds = %entry, %for.cond1.preheader
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond1.preheader ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [10 x i32], ptr %vla, i64 %indvars.iv, i64 0
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6)
%arrayidx6.1 = getelementptr inbounds [10 x i32], ptr %vla, i64 %indvars.iv, i64 1
%call7.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.1)
%arrayidx6.2 = getelementptr inbounds [10 x i32], ptr %vla, i64 %indvars.iv, i64 2
%call7.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.2)
%arrayidx6.3 = getelementptr inbounds [10 x i32], ptr %vla, i64 %indvars.iv, i64 3
%call7.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.3)
%arrayidx6.4 = getelementptr inbounds [10 x i32], ptr %vla, i64 %indvars.iv, i64 4
%call7.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.4)
%arrayidx6.5 = getelementptr inbounds [10 x i32], ptr %vla, i64 %indvars.iv, i64 5
%call7.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.5)
%arrayidx6.6 = getelementptr inbounds [10 x i32], ptr %vla, i64 %indvars.iv, i64 6
%call7.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.6)
%arrayidx6.7 = getelementptr inbounds [10 x i32], ptr %vla, i64 %indvars.iv, i64 7
%call7.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.7)
%arrayidx6.8 = getelementptr inbounds [10 x i32], ptr %vla, i64 %indvars.iv, i64 8
%call7.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.8)
%arrayidx6.9 = getelementptr inbounds [10 x i32], ptr %vla, i64 %indvars.iv, i64 9
%call7.9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.9)
%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.cond1.preheader, label %for.cond.cleanup, !llvm.loop !9
for.cond.cleanup: ; preds = %for.cond1.preheader
%6 = zext i32 %4 to i64
%vla11 = alloca [11 x i64], i64 %6, align 16
%cmp1493 = icmp sgt i32 %4, 0
br i1 %cmp1493, label %for.cond18.preheader, label %for.cond.cleanup35
for.cond18.preheader: ; preds = %for.cond.cleanup, %for.cond18.preheader
%indvars.iv112 = phi i64 [ %indvars.iv.next113, %for.cond18.preheader ], [ 0, %for.cond.cleanup ]
%arrayidx25 = getelementptr inbounds [11 x i64], ptr %vla11, i64 %indvars.iv112, i64 0
%call26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx25)
%arrayidx25.1 = getelementptr inbounds [11 x i64], ptr %vla11, i64 %indvars.iv112, i64 1
%call26.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx25.1)
%arrayidx25.2 = getelementptr inbounds [11 x i64], ptr %vla11, i64 %indvars.iv112, i64 2
%call26.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx25.2)
%arrayidx25.3 = getelementptr inbounds [11 x i64], ptr %vla11, i64 %indvars.iv112, i64 3
%call26.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx25.3)
%arrayidx25.4 = getelementptr inbounds [11 x i64], ptr %vla11, i64 %indvars.iv112, i64 4
%call26.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx25.4)
%arrayidx25.5 = getelementptr inbounds [11 x i64], ptr %vla11, i64 %indvars.iv112, i64 5
%call26.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx25.5)
%arrayidx25.6 = getelementptr inbounds [11 x i64], ptr %vla11, i64 %indvars.iv112, i64 6
%call26.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx25.6)
%arrayidx25.7 = getelementptr inbounds [11 x i64], ptr %vla11, i64 %indvars.iv112, i64 7
%call26.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx25.7)
%arrayidx25.8 = getelementptr inbounds [11 x i64], ptr %vla11, i64 %indvars.iv112, i64 8
%call26.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx25.8)
%arrayidx25.9 = getelementptr inbounds [11 x i64], ptr %vla11, i64 %indvars.iv112, i64 9
%call26.9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx25.9)
%arrayidx25.10 = getelementptr inbounds [11 x i64], ptr %vla11, i64 %indvars.iv112, i64 10
%call26.10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx25.10)
%indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
%7 = load i32, ptr %N, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp14 = icmp slt i64 %indvars.iv.next113, %8
br i1 %cmp14, label %for.cond18.preheader, label %for.cond33.preheader, !llvm.loop !11
for.cond33.preheader: ; preds = %for.cond18.preheader
%cmp3998 = icmp sgt i32 %7, 0
br i1 %cmp3998, label %for.cond38.preheader.us.preheader, label %for.cond.cleanup35
for.cond38.preheader.us.preheader: ; preds = %for.cond33.preheader
%wide.trip.count = zext i32 %7 to i64
br label %for.cond38.preheader.us
for.cond38.preheader.us: ; preds = %for.cond38.preheader.us.preheader, %for.cond38.for.cond.cleanup40_crit_edge.us
%p.0103.us = phi i32 [ %inc64.us, %for.cond38.for.cond.cleanup40_crit_edge.us ], [ 1, %for.cond38.preheader.us.preheader ]
%ans.0102.us = phi i64 [ %cond.us, %for.cond38.for.cond.cleanup40_crit_edge.us ], [ -9999999999, %for.cond38.preheader.us.preheader ]
%shr.us.1 = lshr i32 %p.0103.us, 1
%shr.us.2 = lshr i32 %p.0103.us, 2
%shr.us.3 = lshr i32 %p.0103.us, 3
%shr.us.4 = lshr i32 %p.0103.us, 4
%shr.us.5 = lshr i32 %p.0103.us, 5
%shr.us.6 = lshr i32 %p.0103.us, 6
%shr.us.7 = lshr i32 %p.0103.us, 7
%shr.us.8 = lshr i32 %p.0103.us, 8
%shr.us.9 = lshr i32 %p.0103.us, 9
%9 = insertelement <8 x i32> poison, i32 %p.0103.us, i64 0
%10 = insertelement <8 x i32> %9, i32 %shr.us.1, i64 1
%11 = insertelement <8 x i32> %10, i32 %shr.us.2, i64 2
%12 = insertelement <8 x i32> %11, i32 %shr.us.3, i64 3
%13 = insertelement <8 x i32> %12, i32 %shr.us.4, i64 4
%14 = insertelement <8 x i32> %13, i32 %shr.us.5, i64 5
%15 = insertelement <8 x i32> %14, i32 %shr.us.6, i64 6
%16 = insertelement <8 x i32> %15, i32 %shr.us.7, i64 7
br label %for.cond43.preheader.us
for.cond43.preheader.us: ; preds = %for.cond38.preheader.us, %for.cond43.preheader.us
%indvars.iv119 = phi i64 [ 0, %for.cond38.preheader.us ], [ %indvars.iv.next120, %for.cond43.preheader.us ]
%tmp.099.us = phi i64 [ 0, %for.cond38.preheader.us ], [ %add.us, %for.cond43.preheader.us ]
%arrayidx50.us = getelementptr inbounds [10 x i32], ptr %vla, i64 %indvars.iv119, i64 0
%17 = load <8 x i32>, ptr %arrayidx50.us, align 8, !tbaa !5
%18 = and <8 x i32> %17, %16
%19 = icmp ne <8 x i32> %18, zeroinitializer
%arrayidx50.us.8 = getelementptr inbounds [10 x i32], ptr %vla, i64 %indvars.iv119, i64 8
%20 = load i32, ptr %arrayidx50.us.8, align 8, !tbaa !5
%and.us.8 = and i32 %20, %shr.us.8
%tobool.not.us.8 = icmp ne i32 %and.us.8, 0
%inc51.us.8 = zext i1 %tobool.not.us.8 to i64
%arrayidx50.us.9 = getelementptr inbounds [10 x i32], ptr %vla, i64 %indvars.iv119, i64 9
%21 = load i32, ptr %arrayidx50.us.9, align 4, !tbaa !5
%and.us.9 = and i32 %21, %shr.us.9
%tobool.not.us.9 = icmp ne i32 %and.us.9, 0
%inc51.us.9 = zext i1 %tobool.not.us.9 to i64
%22 = bitcast <8 x i1> %19 to i8
%23 = call i8 @llvm.ctpop.i8(i8 %22), !range !12
%24 = zext i8 %23 to i64
%op.rdx = add nuw nsw i64 %24, %inc51.us.8
%op.rdx134 = add nuw nsw i64 %op.rdx, %inc51.us.9
%arrayidx58.us = getelementptr inbounds [11 x i64], ptr %vla11, i64 %indvars.iv119, i64 %op.rdx134
%25 = load i64, ptr %arrayidx58.us, align 8, !tbaa !13
%add.us = add nsw i64 %25, %tmp.099.us
%indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
%exitcond122.not = icmp eq i64 %indvars.iv.next120, %wide.trip.count
br i1 %exitcond122.not, label %for.cond38.for.cond.cleanup40_crit_edge.us, label %for.cond43.preheader.us, !llvm.loop !15
for.cond38.for.cond.cleanup40_crit_edge.us: ; preds = %for.cond43.preheader.us
%cond.us = call i64 @llvm.smax.i64(i64 %ans.0102.us, i64 %add.us)
%inc64.us = add nuw nsw i32 %p.0103.us, 1
%exitcond123.not = icmp eq i32 %inc64.us, 1024
br i1 %exitcond123.not, label %for.cond.cleanup35, label %for.cond38.preheader.us, !llvm.loop !16
for.cond.cleanup35: ; preds = %for.cond38.for.cond.cleanup40_crit_edge.us, %entry, %for.cond.cleanup, %for.cond33.preheader
%.us-phi = phi i64 [ 0, %for.cond33.preheader ], [ 0, %for.cond.cleanup ], [ 0, %entry ], [ %cond.us, %for.cond38.for.cond.cleanup40_crit_edge.us ]
%call66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %.us-phi)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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.smax.i64(i64, i64) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.ctpop.i8(i8) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{i8 0, i8 9}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
int N;
int F[100][14];
int P[100][15];
int main(){
scanf("%d",&N);
for(int i=0;i<N;i++) {
for(int j=0;j<10;j++)
scanf("%d",&F[i][j]);
}
for(int i=0;i<N;i++)
for(int j=0;j<11;j++)
scanf("%d",&P[i][j]);
int res = -(1<<30);
for(int b=1;b<(1<<10);b++){
int cc=0;
for(int i=0;i<N;i++){
int c=0;
for(int j=0;j<10;j++)
if((b>>j&1)&&F[i][j])
c++;
cc+=P[i][c];
}
if(res<cc)
res=cc;
}
printf("%d\n",res);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146415/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146415/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@N = dso_local global i32 0, align 4
@F = dso_local global [100 x [14 x i32]] zeroinitializer, align 16
@P = dso_local global [100 x [15 x i32]] zeroinitializer, align 16
@.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:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N)
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp91 = icmp sgt i32 %0, 0
br i1 %cmp91, label %for.cond1.preheader, label %for.cond.cleanup34
for.cond1.preheader: ; preds = %entry, %for.cond1.preheader
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond1.preheader ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv, i64 0
%call7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6)
%arrayidx6.1 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv, i64 1
%call7.1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.1)
%arrayidx6.2 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv, i64 2
%call7.2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.2)
%arrayidx6.3 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv, i64 3
%call7.3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.3)
%arrayidx6.4 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv, i64 4
%call7.4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.4)
%arrayidx6.5 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv, i64 5
%call7.5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.5)
%arrayidx6.6 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv, i64 6
%call7.6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.6)
%arrayidx6.7 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv, i64 7
%call7.7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.7)
%arrayidx6.8 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv, i64 8
%call7.8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.8)
%arrayidx6.9 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv, i64 9
%call7.9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6.9)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.cond1.preheader, label %for.cond12.preheader, !llvm.loop !9
for.cond12.preheader: ; preds = %for.cond1.preheader
%cmp1394 = icmp sgt i32 %1, 0
br i1 %cmp1394, label %for.cond17.preheader, label %for.cond.cleanup34
for.cond17.preheader: ; preds = %for.cond12.preheader, %for.cond17.preheader
%indvars.iv111 = phi i64 [ %indvars.iv.next112, %for.cond17.preheader ], [ 0, %for.cond12.preheader ]
%arrayidx24 = getelementptr inbounds [100 x [15 x i32]], ptr @P, i64 0, i64 %indvars.iv111, i64 0
%call25 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx24)
%arrayidx24.1 = getelementptr inbounds [100 x [15 x i32]], ptr @P, i64 0, i64 %indvars.iv111, i64 1
%call25.1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx24.1)
%arrayidx24.2 = getelementptr inbounds [100 x [15 x i32]], ptr @P, i64 0, i64 %indvars.iv111, i64 2
%call25.2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx24.2)
%arrayidx24.3 = getelementptr inbounds [100 x [15 x i32]], ptr @P, i64 0, i64 %indvars.iv111, i64 3
%call25.3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx24.3)
%arrayidx24.4 = getelementptr inbounds [100 x [15 x i32]], ptr @P, i64 0, i64 %indvars.iv111, i64 4
%call25.4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx24.4)
%arrayidx24.5 = getelementptr inbounds [100 x [15 x i32]], ptr @P, i64 0, i64 %indvars.iv111, i64 5
%call25.5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx24.5)
%arrayidx24.6 = getelementptr inbounds [100 x [15 x i32]], ptr @P, i64 0, i64 %indvars.iv111, i64 6
%call25.6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx24.6)
%arrayidx24.7 = getelementptr inbounds [100 x [15 x i32]], ptr @P, i64 0, i64 %indvars.iv111, i64 7
%call25.7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx24.7)
%arrayidx24.8 = getelementptr inbounds [100 x [15 x i32]], ptr @P, i64 0, i64 %indvars.iv111, i64 8
%call25.8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx24.8)
%arrayidx24.9 = getelementptr inbounds [100 x [15 x i32]], ptr @P, i64 0, i64 %indvars.iv111, i64 9
%call25.9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx24.9)
%arrayidx24.10 = getelementptr inbounds [100 x [15 x i32]], ptr @P, i64 0, i64 %indvars.iv111, i64 10
%call25.10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx24.10)
%indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
%3 = load i32, ptr @N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp13 = icmp slt i64 %indvars.iv.next112, %4
br i1 %cmp13, label %for.cond17.preheader, label %for.cond32.preheader, !llvm.loop !11
for.cond32.preheader: ; preds = %for.cond17.preheader
%cmp3898 = icmp sgt i32 %3, 0
br i1 %cmp3898, label %for.cond37.preheader.us.preheader, label %for.cond.cleanup34
for.cond37.preheader.us.preheader: ; preds = %for.cond32.preheader
%wide.trip.count = zext i32 %3 to i64
br label %for.cond37.preheader.us
for.cond37.preheader.us: ; preds = %for.cond37.preheader.us.preheader, %for.cond37.for.cond.cleanup39_crit_edge.us
%b.0103.us = phi i32 [ %inc66.us, %for.cond37.for.cond.cleanup39_crit_edge.us ], [ 1, %for.cond37.preheader.us.preheader ]
%res.0102.us = phi i32 [ %spec.select.us, %for.cond37.for.cond.cleanup39_crit_edge.us ], [ -1073741824, %for.cond37.preheader.us.preheader ]
%5 = and i32 %b.0103.us, 1
%tobool.not.us = icmp eq i32 %5, 0
%6 = and i32 %b.0103.us, 2
%tobool.not.us.1 = icmp eq i32 %6, 0
%7 = insertelement <8 x i32> poison, i32 %b.0103.us, i64 0
%8 = shufflevector <8 x i32> %7, <8 x i32> poison, <8 x i32> zeroinitializer
%9 = and <8 x i32> %8, <i32 512, i32 256, i32 128, i32 64, i32 32, i32 16, i32 8, i32 4>
%10 = icmp eq <8 x i32> %9, zeroinitializer
%11 = extractelement <8 x i1> %10, i64 0
%12 = extractelement <8 x i1> %10, i64 1
%13 = extractelement <8 x i1> %10, i64 2
%14 = extractelement <8 x i1> %10, i64 3
%15 = extractelement <8 x i1> %10, i64 4
%16 = extractelement <8 x i1> %10, i64 5
%17 = extractelement <8 x i1> %10, i64 6
%18 = extractelement <8 x i1> %10, i64 7
br label %for.cond42.preheader.us
land.lhs.true.us: ; preds = %for.cond42.preheader.us
%arrayidx49.us = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv118, i64 0
%19 = load i32, ptr %arrayidx49.us, align 8, !tbaa !5
%tobool50.not.us = icmp ne i32 %19, 0
%inc51.us = zext i1 %tobool50.not.us to i32
br label %for.inc52.us
for.inc52.us: ; preds = %land.lhs.true.us, %for.cond42.preheader.us
%c.1.us = phi i32 [ 0, %for.cond42.preheader.us ], [ %inc51.us, %land.lhs.true.us ]
br i1 %tobool.not.us.1, label %for.inc52.us.1, label %land.lhs.true.us.1
land.lhs.true.us.1: ; preds = %for.inc52.us
%arrayidx49.us.1 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv118, i64 1
%20 = load i32, ptr %arrayidx49.us.1, align 4, !tbaa !5
%tobool50.not.us.1 = icmp ne i32 %20, 0
%inc51.us.1 = zext i1 %tobool50.not.us.1 to i32
%spec.select89.us.1 = add nuw nsw i32 %c.1.us, %inc51.us.1
br label %for.inc52.us.1
for.inc52.us.1: ; preds = %land.lhs.true.us.1, %for.inc52.us
%c.1.us.1 = phi i32 [ %c.1.us, %for.inc52.us ], [ %spec.select89.us.1, %land.lhs.true.us.1 ]
br i1 %18, label %for.inc52.us.2, label %land.lhs.true.us.2
land.lhs.true.us.2: ; preds = %for.inc52.us.1
%arrayidx49.us.2 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv118, i64 2
%21 = load i32, ptr %arrayidx49.us.2, align 8, !tbaa !5
%tobool50.not.us.2 = icmp ne i32 %21, 0
%inc51.us.2 = zext i1 %tobool50.not.us.2 to i32
%spec.select89.us.2 = add nuw nsw i32 %c.1.us.1, %inc51.us.2
br label %for.inc52.us.2
for.inc52.us.2: ; preds = %land.lhs.true.us.2, %for.inc52.us.1
%c.1.us.2 = phi i32 [ %c.1.us.1, %for.inc52.us.1 ], [ %spec.select89.us.2, %land.lhs.true.us.2 ]
br i1 %17, label %for.inc52.us.3, label %land.lhs.true.us.3
land.lhs.true.us.3: ; preds = %for.inc52.us.2
%arrayidx49.us.3 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv118, i64 3
%22 = load i32, ptr %arrayidx49.us.3, align 4, !tbaa !5
%tobool50.not.us.3 = icmp ne i32 %22, 0
%inc51.us.3 = zext i1 %tobool50.not.us.3 to i32
%spec.select89.us.3 = add nuw nsw i32 %c.1.us.2, %inc51.us.3
br label %for.inc52.us.3
for.inc52.us.3: ; preds = %land.lhs.true.us.3, %for.inc52.us.2
%c.1.us.3 = phi i32 [ %c.1.us.2, %for.inc52.us.2 ], [ %spec.select89.us.3, %land.lhs.true.us.3 ]
br i1 %16, label %for.inc52.us.4, label %land.lhs.true.us.4
land.lhs.true.us.4: ; preds = %for.inc52.us.3
%arrayidx49.us.4 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv118, i64 4
%23 = load i32, ptr %arrayidx49.us.4, align 8, !tbaa !5
%tobool50.not.us.4 = icmp ne i32 %23, 0
%inc51.us.4 = zext i1 %tobool50.not.us.4 to i32
%spec.select89.us.4 = add nuw nsw i32 %c.1.us.3, %inc51.us.4
br label %for.inc52.us.4
for.inc52.us.4: ; preds = %land.lhs.true.us.4, %for.inc52.us.3
%c.1.us.4 = phi i32 [ %c.1.us.3, %for.inc52.us.3 ], [ %spec.select89.us.4, %land.lhs.true.us.4 ]
br i1 %15, label %for.inc52.us.5, label %land.lhs.true.us.5
land.lhs.true.us.5: ; preds = %for.inc52.us.4
%arrayidx49.us.5 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv118, i64 5
%24 = load i32, ptr %arrayidx49.us.5, align 4, !tbaa !5
%tobool50.not.us.5 = icmp ne i32 %24, 0
%inc51.us.5 = zext i1 %tobool50.not.us.5 to i32
%spec.select89.us.5 = add nuw nsw i32 %c.1.us.4, %inc51.us.5
br label %for.inc52.us.5
for.inc52.us.5: ; preds = %land.lhs.true.us.5, %for.inc52.us.4
%c.1.us.5 = phi i32 [ %c.1.us.4, %for.inc52.us.4 ], [ %spec.select89.us.5, %land.lhs.true.us.5 ]
br i1 %14, label %for.inc52.us.6, label %land.lhs.true.us.6
land.lhs.true.us.6: ; preds = %for.inc52.us.5
%arrayidx49.us.6 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv118, i64 6
%25 = load i32, ptr %arrayidx49.us.6, align 8, !tbaa !5
%tobool50.not.us.6 = icmp ne i32 %25, 0
%inc51.us.6 = zext i1 %tobool50.not.us.6 to i32
%spec.select89.us.6 = add nuw nsw i32 %c.1.us.5, %inc51.us.6
br label %for.inc52.us.6
for.inc52.us.6: ; preds = %land.lhs.true.us.6, %for.inc52.us.5
%c.1.us.6 = phi i32 [ %c.1.us.5, %for.inc52.us.5 ], [ %spec.select89.us.6, %land.lhs.true.us.6 ]
br i1 %13, label %for.inc52.us.7, label %land.lhs.true.us.7
land.lhs.true.us.7: ; preds = %for.inc52.us.6
%arrayidx49.us.7 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv118, i64 7
%26 = load i32, ptr %arrayidx49.us.7, align 4, !tbaa !5
%tobool50.not.us.7 = icmp ne i32 %26, 0
%inc51.us.7 = zext i1 %tobool50.not.us.7 to i32
%spec.select89.us.7 = add nuw nsw i32 %c.1.us.6, %inc51.us.7
br label %for.inc52.us.7
for.inc52.us.7: ; preds = %land.lhs.true.us.7, %for.inc52.us.6
%c.1.us.7 = phi i32 [ %c.1.us.6, %for.inc52.us.6 ], [ %spec.select89.us.7, %land.lhs.true.us.7 ]
br i1 %12, label %for.inc52.us.8, label %land.lhs.true.us.8
land.lhs.true.us.8: ; preds = %for.inc52.us.7
%arrayidx49.us.8 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv118, i64 8
%27 = load i32, ptr %arrayidx49.us.8, align 8, !tbaa !5
%tobool50.not.us.8 = icmp ne i32 %27, 0
%inc51.us.8 = zext i1 %tobool50.not.us.8 to i32
%spec.select89.us.8 = add nuw nsw i32 %c.1.us.7, %inc51.us.8
br label %for.inc52.us.8
for.inc52.us.8: ; preds = %land.lhs.true.us.8, %for.inc52.us.7
%c.1.us.8 = phi i32 [ %c.1.us.7, %for.inc52.us.7 ], [ %spec.select89.us.8, %land.lhs.true.us.8 ]
br i1 %11, label %for.inc52.us.9, label %land.lhs.true.us.9
land.lhs.true.us.9: ; preds = %for.inc52.us.8
%arrayidx49.us.9 = getelementptr inbounds [100 x [14 x i32]], ptr @F, i64 0, i64 %indvars.iv118, i64 9
%28 = load i32, ptr %arrayidx49.us.9, align 4, !tbaa !5
%tobool50.not.us.9 = icmp ne i32 %28, 0
%inc51.us.9 = zext i1 %tobool50.not.us.9 to i32
%spec.select89.us.9 = add nuw nsw i32 %c.1.us.8, %inc51.us.9
br label %for.inc52.us.9
for.inc52.us.9: ; preds = %land.lhs.true.us.9, %for.inc52.us.8
%c.1.us.9 = phi i32 [ %c.1.us.8, %for.inc52.us.8 ], [ %spec.select89.us.9, %land.lhs.true.us.9 ]
%idxprom57.us = zext i32 %c.1.us.9 to i64
%arrayidx58.us = getelementptr inbounds [100 x [15 x i32]], ptr @P, i64 0, i64 %indvars.iv118, i64 %idxprom57.us
%29 = load i32, ptr %arrayidx58.us, align 4, !tbaa !5
%add.us = add nsw i32 %29, %cc.099.us
%indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
%exitcond121.not = icmp eq i64 %indvars.iv.next119, %wide.trip.count
br i1 %exitcond121.not, label %for.cond37.for.cond.cleanup39_crit_edge.us, label %for.cond42.preheader.us, !llvm.loop !12
for.cond42.preheader.us: ; preds = %for.cond37.preheader.us, %for.inc52.us.9
%indvars.iv118 = phi i64 [ 0, %for.cond37.preheader.us ], [ %indvars.iv.next119, %for.inc52.us.9 ]
%cc.099.us = phi i32 [ 0, %for.cond37.preheader.us ], [ %add.us, %for.inc52.us.9 ]
br i1 %tobool.not.us, label %for.inc52.us, label %land.lhs.true.us
for.cond37.for.cond.cleanup39_crit_edge.us: ; preds = %for.inc52.us.9
%spec.select.us = tail call i32 @llvm.smax.i32(i32 %res.0102.us, i32 %add.us)
%inc66.us = add nuw nsw i32 %b.0103.us, 1
%exitcond122.not = icmp eq i32 %inc66.us, 1024
br i1 %exitcond122.not, label %for.cond.cleanup34, label %for.cond37.preheader.us, !llvm.loop !13
for.cond.cleanup34: ; preds = %for.cond37.for.cond.cleanup39_crit_edge.us, %entry, %for.cond12.preheader, %for.cond32.preheader
%.us-phi = phi i32 [ 0, %for.cond32.preheader ], [ 0, %for.cond12.preheader ], [ 0, %entry ], [ %spec.select.us, %for.cond37.for.cond.cleanup39_crit_edge.us ]
%call68 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.us-phi)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main(){
int x,y,z;
scanf("%d %d %d",&x,&y,&z);
for(int i=0;; i++){
if( x >= y*i + z*(i+1) ){
/*何もしない*/
}else{
printf("%d",i-1);
break;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146459/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146459/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; 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
%z = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %z) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%2 = load i32, ptr %z, align 4, !tbaa !5
br label %for.cond
for.cond: ; preds = %for.cond, %entry
%i.0 = phi i32 [ 0, %entry ], [ %add, %for.cond ]
%mul = mul nsw i32 %1, %i.0
%add = add nuw nsw i32 %i.0, 1
%mul1 = mul nsw i32 %2, %add
%add2 = add nsw i32 %mul1, %mul
%cmp.not = icmp slt i32 %0, %add2
br i1 %cmp.not, label %if.else, label %for.cond
if.else: ; preds = %for.cond
%sub = add nsw i32 %i.0, -1
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int x, y, z;
scanf("%d %d %d", &x, &y, &z);
x -= z;
y += z;
printf("%d\n", x/y);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146501/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146501/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %z) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%0 = load i32, ptr %z, align 4, !tbaa !5
%1 = load i32, ptr %x, align 4, !tbaa !5
%sub = sub nsw i32 %1, %0
store i32 %sub, ptr %x, align 4, !tbaa !5
%2 = load i32, ptr %y, align 4, !tbaa !5
%add = add nsw i32 %2, %0
store i32 %add, ptr %y, align 4, !tbaa !5
%div = sdiv i32 %sub, %add
%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 %z) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
int main()
{
int x, y, z;
scanf("%d%d%d", &x, &y, &z);
int ans = 1;
while (ans*(y+z)+z <= x) ans ++;
printf("%d\n", ans-1);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146552/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146552/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = 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 %y) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %z) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%0 = load i32, ptr %y, align 4, !tbaa !5
%1 = load i32, ptr %z, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %x, align 4, !tbaa !5
%3 = shl i32 %1, 1
%4 = add i32 %0, %3
%5 = add i32 %2, 1
%smax = call i32 @llvm.smax.i32(i32 %4, i32 %5)
%6 = sub i32 %smax, %0
%7 = icmp ne i32 %6, %3
%umin = zext i1 %7 to i32
%8 = or i32 %3, %umin
%9 = sub i32 %6, %8
%umax = call i32 @llvm.umax.i32(i32 %add, i32 1)
%10 = udiv i32 %9, %umax
%11 = add i32 %10, %umin
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(int argc, char const *argv[])
{
int x, y, z;
scanf("%d %d %d", &x, &y, &z);
int n = (x-z) / (y+z);
printf("%d\n", n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146602/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146602/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %z) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %z, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = load i32, ptr %y, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%div = sdiv i32 %sub, %add
%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 %z) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int x,y,z;
while(~scanf("%d %d %d",&x,&y,&z))
{
printf("%d\n",(x-z) / (y + z));
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146646/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146646/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %z) #3
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%tobool.not3 = icmp eq i32 %call2, -1
br i1 %tobool.not3, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %z, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = load i32, ptr %y, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%div = sdiv i32 %sub, %add
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %div)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%tobool.not = icmp eq i32 %call, -1
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
int calc(int number_of_district, char *index);
int count_district(char *str, char **next);
int comp(const void *a, const void *b);
char line[10010];
int main(void){
int n,i;
int number_of_children;
char *end;
scanf("%d%*c",&n);
for(;n>0;n--){
fgets(line, 10010, stdin);
number_of_children=count_district(line, &end);
//printf("number_of_children:%d\n",number_of_children);
printf("%d\n",calc(number_of_children,line));
}
return 0;
}
int comp(const void *a, const void *b){
return *(int *)a-*(int *)b;
}
int calc(int number_of_district, char *index){
int minimum[number_of_district];
int i,number_of_children;
int sum=0;
char *end;
for(i=0;i<number_of_district;i++){
number_of_children=count_district(index+1, &end);
if(number_of_children==0){
sscanf(index+2,"%d",&minimum[i]);
minimum[i]=minimum[i]/2+1;
index=end;
}else{
minimum[i]=calc(number_of_children,index+1);
index=end;
}
}
qsort(minimum, number_of_district, sizeof(int), comp);
for(i=0;i<number_of_district/2+1;i++){
sum+=minimum[i];
}
return sum;
}
int count_district(char *str, char **end){
int count=0;
int level=0;
while(1){
if(*str=='['){
if(level==1) count++;
level++;
}
if(*str==']'){
level--;
if(level==0){
*end=str;
return count;
}
}
str++;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146697/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146697/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@line = dso_local global [10010 x i8] zeroinitializer, align 16
@stdin = external local_unnamed_addr global ptr, align 8
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: 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) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%.pr = load i32, ptr %n, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %.pr, 0
br i1 %cmp5, label %for.body, label %for.end
for.body: ; preds = %entry, %count_district.exit
%0 = load ptr, ptr @stdin, align 8, !tbaa !9
%call1 = call ptr @fgets(ptr noundef nonnull @line, i32 noundef 10010, ptr noundef %0)
br label %while.cond.i
while.cond.i: ; preds = %if.end15.i, %for.body
%str.addr.0.i = phi ptr [ @line, %for.body ], [ %incdec.ptr.i, %if.end15.i ]
%count.0.i = phi i32 [ 0, %for.body ], [ %count.2.i, %if.end15.i ]
%level.0.i = phi i32 [ 0, %for.body ], [ %level.2.i, %if.end15.i ]
%1 = load i8, ptr %str.addr.0.i, align 1, !tbaa !11
%cmp.i = icmp eq i8 %1, 91
%cmp2.i = icmp eq i32 %level.0.i, 1
%narrow.i = select i1 %cmp.i, i1 %cmp2.i, i1 false
%spec.select.i = zext i1 %narrow.i to i32
%count.2.i = add nuw nsw i32 %count.0.i, %spec.select.i
%inc5.i = zext i1 %cmp.i to i32
%level.1.i = add nsw i32 %level.0.i, %inc5.i
%cmp8.i = icmp eq i8 %1, 93
br i1 %cmp8.i, label %if.then10.i, label %if.end15.i
if.then10.i: ; preds = %while.cond.i
%dec.i = add nsw i32 %level.1.i, -1
%cmp11.i = icmp eq i32 %dec.i, 0
br i1 %cmp11.i, label %count_district.exit, label %if.end15.i
if.end15.i: ; preds = %if.then10.i, %while.cond.i
%level.2.i = phi i32 [ %dec.i, %if.then10.i ], [ %level.1.i, %while.cond.i ]
%incdec.ptr.i = getelementptr inbounds i8, ptr %str.addr.0.i, i64 1
br label %while.cond.i
count_district.exit: ; preds = %if.then10.i
%call3 = call i32 @calc(i32 noundef %count.2.i, ptr noundef nonnull @line)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call3)
%2 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %2, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%cmp = icmp sgt i32 %2, 1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %count_district.exit, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @count_district(ptr noundef %str, ptr nocapture noundef writeonly %end) local_unnamed_addr #3 {
entry:
br label %while.cond
while.cond: ; preds = %if.end15, %entry
%str.addr.0 = phi ptr [ %str, %entry ], [ %incdec.ptr, %if.end15 ]
%count.0 = phi i32 [ 0, %entry ], [ %count.2, %if.end15 ]
%level.0 = phi i32 [ 0, %entry ], [ %level.2, %if.end15 ]
%0 = load i8, ptr %str.addr.0, align 1, !tbaa !11
%cmp = icmp eq i8 %0, 91
%cmp2 = icmp eq i32 %level.0, 1
%narrow = select i1 %cmp, i1 %cmp2, i1 false
%spec.select = zext i1 %narrow to i32
%count.2 = add nuw nsw i32 %count.0, %spec.select
%inc5 = zext i1 %cmp to i32
%level.1 = add nsw i32 %level.0, %inc5
%cmp8 = icmp eq i8 %0, 93
br i1 %cmp8, label %if.then10, label %if.end15
if.then10: ; preds = %while.cond
%dec = add nsw i32 %level.1, -1
%cmp11 = icmp eq i32 %dec, 0
br i1 %cmp11, label %if.then13, label %if.end15
if.then13: ; preds = %if.then10
store ptr %str.addr.0, ptr %end, align 8, !tbaa !9
ret i32 %count.2
if.end15: ; preds = %if.then10, %while.cond
%level.2 = phi i32 [ %dec, %if.then10 ], [ %level.1, %while.cond ]
%incdec.ptr = getelementptr inbounds i8, ptr %str.addr.0, i64 1
br label %while.cond
}
; 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 @calc(i32 noundef %number_of_district, ptr nocapture noundef readonly %index) local_unnamed_addr #0 {
entry:
%0 = zext i32 %number_of_district to i64
%vla = alloca i32, i64 %0, align 16
%cmp39 = icmp sgt i32 %number_of_district, 0
br i1 %cmp39, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%index.addr.041 = phi ptr [ %str.addr.0.i, %for.inc ], [ %index, %entry ]
%add.ptr = getelementptr inbounds i8, ptr %index.addr.041, i64 1
br label %while.cond.i
while.cond.i: ; preds = %if.end15.i, %for.body
%str.addr.0.i = phi ptr [ %add.ptr, %for.body ], [ %incdec.ptr.i, %if.end15.i ]
%count.0.i = phi i32 [ 0, %for.body ], [ %count.2.i, %if.end15.i ]
%level.0.i = phi i32 [ 0, %for.body ], [ %level.2.i, %if.end15.i ]
%1 = load i8, ptr %str.addr.0.i, align 1, !tbaa !11
%cmp.i = icmp eq i8 %1, 91
%cmp2.i = icmp eq i32 %level.0.i, 1
%narrow.i = select i1 %cmp.i, i1 %cmp2.i, i1 false
%spec.select.i = zext i1 %narrow.i to i32
%count.2.i = add nuw nsw i32 %count.0.i, %spec.select.i
%inc5.i = zext i1 %cmp.i to i32
%level.1.i = add nsw i32 %level.0.i, %inc5.i
%cmp8.i = icmp eq i8 %1, 93
br i1 %cmp8.i, label %if.then10.i, label %if.end15.i
if.then10.i: ; preds = %while.cond.i
%dec.i = add nsw i32 %level.1.i, -1
%cmp11.i = icmp eq i32 %dec.i, 0
br i1 %cmp11.i, label %count_district.exit, label %if.end15.i
if.end15.i: ; preds = %if.then10.i, %while.cond.i
%level.2.i = phi i32 [ %dec.i, %if.then10.i ], [ %level.1.i, %while.cond.i ]
%incdec.ptr.i = getelementptr inbounds i8, ptr %str.addr.0.i, i64 1
br label %while.cond.i
count_district.exit: ; preds = %if.then10.i
%cmp1 = icmp eq i32 %count.2.i, 0
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %count_district.exit
%add.ptr2 = getelementptr inbounds i8, ptr %index.addr.041, i64 2
%call3 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %add.ptr2, ptr noundef nonnull @.str.2, ptr noundef nonnull %arrayidx) #7
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%div = sdiv i32 %2, 2
%add = add nsw i32 %div, 1
br label %for.inc
if.else: ; preds = %count_district.exit
%call9 = call i32 @calc(i32 noundef %count.2.i, ptr noundef nonnull %add.ptr)
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%add.sink = phi i32 [ %add, %if.then ], [ %call9, %if.else ]
store i32 %add.sink, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %0
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !14
for.end: ; preds = %for.inc, %entry
%conv = sext i32 %number_of_district to i64
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv, i64 noundef 4, ptr noundef nonnull @comp) #7
%cmp15.not42 = icmp slt i32 %number_of_district, -1
br i1 %cmp15.not42, label %for.end23, label %for.body17.preheader
for.body17.preheader: ; preds = %for.end
%div13 = sdiv i32 %number_of_district, 2
%3 = add nuw nsw i32 %div13, 1
%wide.trip.count49 = zext i32 %3 to i64
%min.iters.check = icmp ult i32 %div13, 7
br i1 %min.iters.check, label %for.body17.preheader54, label %vector.ph
vector.ph: ; preds = %for.body17.preheader
%n.vec = and i64 %wide.trip.count49, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index51 = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%vec.phi52 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%4 = getelementptr inbounds i32, ptr %vla, i64 %index51
%wide.load = load <4 x i32>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load53 = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = add <4 x i32> %wide.load, %vec.phi
%7 = add <4 x i32> %wide.load53, %vec.phi52
%index.next = add nuw i64 %index51, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %7, %6
%9 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count49
br i1 %cmp.n, label %for.end23, label %for.body17.preheader54
for.body17.preheader54: ; preds = %for.body17.preheader, %middle.block
%indvars.iv46.ph = phi i64 [ 0, %for.body17.preheader ], [ %n.vec, %middle.block ]
%sum.044.ph = phi i32 [ 0, %for.body17.preheader ], [ %9, %middle.block ]
br label %for.body17
for.body17: ; preds = %for.body17.preheader54, %for.body17
%indvars.iv46 = phi i64 [ %indvars.iv.next47, %for.body17 ], [ %indvars.iv46.ph, %for.body17.preheader54 ]
%sum.044 = phi i32 [ %add20, %for.body17 ], [ %sum.044.ph, %for.body17.preheader54 ]
%arrayidx19 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv46
%10 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%add20 = add nsw i32 %10, %sum.044
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%exitcond50.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count49
br i1 %exitcond50.not, label %for.end23, label %for.body17, !llvm.loop !18
for.end23: ; preds = %for.body17, %middle.block, %for.end
%sum.0.lcssa = phi i32 [ 0, %for.end ], [ %9, %middle.block ], [ %add20, %for.body17 ]
ret i32 %sum.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @comp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #4 {
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
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x 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 norecurse nosync nounwind memory(read, 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 #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 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!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}
!15 = distinct !{!15, !13, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !13, !17, !16}
|
#include<stdio.h>
#include<stdlib.h>
int main()
{
int t,i,n,j;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d",&n);
for(j=0;j<n;j++)
{
printf("1 ");
}
printf("\n");
}
exit(0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14674/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14674/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"1 \00", align 1
; Function Attrs: noreturn nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp14 = icmp sgt i32 %0, 0
br i1 %cmp14, label %for.body, label %for.end9
for.body: ; preds = %entry, %for.end
%i.015 = phi i32 [ %inc8, %for.end ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp312 = icmp sgt i32 %1, 0
br i1 %cmp312, label %for.body4, label %for.end
for.body4: ; preds = %for.body, %for.body4
%j.013 = phi i32 [ %inc, %for.body4 ], [ 0, %for.body ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
%inc = add nuw nsw i32 %j.013, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc, %2
br i1 %cmp3, label %for.body4, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body4, %for.body
%putchar = call i32 @putchar(i32 10)
%inc8 = add nuw nsw i32 %i.015, 1
%3 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc8, %3
br i1 %cmp, label %for.body, label %for.end9, !llvm.loop !11
for.end9: ; preds = %for.end, %entry
call void @exit(i32 noundef 0) #6
unreachable
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { noreturn nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(){
int a,b,num;
scanf("%d%d",&a,&b);
if((b-1)%(a-1)==0)
num=(b-1)/(a-1);
else
num=(b-1)/(a-1)+1;
printf("%d\n",num);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146783/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146783/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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 %b, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub1 = add nsw i32 %1, -1
%rem = srem i32 %sub, %sub1
%cmp = icmp ne i32 %rem, 0
%div = sdiv i32 %sub, %sub1
%add = zext i1 %cmp to i32
%num.0 = add nsw i32 %div, %add
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %num.0)
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,i,rA,sum=1,c=0;
scanf("%d %d",&A,&B);
rA=A-1;
while(B>sum){
sum += rA;
c++;
}
printf("%d",c);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146826/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146826/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%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
%sub = add i32 %0, -1
%1 = load i32, ptr %B, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %1, 1
br i1 %cmp4, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %entry
%smax = call i32 @llvm.smax.i32(i32 %0, i32 %1)
%2 = icmp slt i32 %0, %1
%umin = zext i1 %2 to i32
%3 = add i32 %0, %umin
%4 = sub i32 %smax, %3
%5 = udiv i32 %4, %sub
%6 = add i32 %5, %umin
%7 = add i32 %6, 1
%min.iters.check = icmp ult i32 %7, 8
br i1 %min.iters.check, label %while.body.preheader8, label %vector.ph
vector.ph: ; preds = %while.body.preheader
%n.vec = and i32 %7, -8
%8 = mul i32 %n.vec, %sub
%ind.end = or i32 %8, 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> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%vec.phi7 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%9 = add <4 x i32> %vec.phi, <i32 1, i32 1, i32 1, i32 1>
%10 = add <4 x i32> %vec.phi7, <i32 1, i32 1, i32 1, i32 1>
%index.next = add nuw i32 %index, 8
%11 = icmp eq i32 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %10, %9
%12 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %7, %n.vec
br i1 %cmp.n, label %while.end, label %while.body.preheader8
while.body.preheader8: ; preds = %while.body.preheader, %middle.block
%c.06.ph = phi i32 [ 0, %while.body.preheader ], [ %12, %middle.block ]
%sum.05.ph = phi i32 [ 1, %while.body.preheader ], [ %ind.end, %middle.block ]
br label %while.body
while.body: ; preds = %while.body.preheader8, %while.body
%c.06 = phi i32 [ %inc, %while.body ], [ %c.06.ph, %while.body.preheader8 ]
%sum.05 = phi i32 [ %add, %while.body ], [ %sum.05.ph, %while.body.preheader8 ]
%add = add nsw i32 %sub, %sum.05
%inc = add nuw nsw i32 %c.06, 1
%cmp = icmp sgt i32 %1, %add
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !13
while.end: ; preds = %while.body, %middle.block, %entry
%c.0.lcssa = phi i32 [ 0, %entry ], [ %12, %middle.block ], [ %inc, %while.body ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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}
|
/*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int min(int a, int b){
return (a < b) ? a : b;
}
int main(){
int casos, n, i;
scanf("%d", &casos);
while(casos--){
scanf("%d", &n);
for(i = 0; i < n; ++i)
printf("1%c", (i == n - 1) ? '\n' : ' ');
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14687/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14687/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"1%c\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%casos = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %casos) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %casos)
%0 = load i32, ptr %casos, align 4, !tbaa !5
%dec8 = add nsw i32 %0, -1
store i32 %dec8, ptr %casos, align 4, !tbaa !5
%tobool.not9 = icmp eq i32 %0, 0
br i1 %tobool.not9, label %while.end, label %while.body
while.cond.loopexit: ; preds = %for.body, %while.body
%1 = load i32, ptr %casos, align 4, !tbaa !5
%dec = add nsw i32 %1, -1
store i32 %dec, ptr %casos, align 4, !tbaa !5
%tobool.not = icmp eq i32 %1, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.body: ; preds = %entry, %while.cond.loopexit
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %2, 0
br i1 %cmp6, label %for.body, label %while.cond.loopexit
for.body: ; preds = %while.body, %for.body
%3 = phi i32 [ %4, %for.body ], [ %2, %while.body ]
%i.07 = phi i32 [ %inc, %for.body ], [ 0, %while.body ]
%sub = add nsw i32 %3, -1
%cmp2 = icmp eq i32 %i.07, %sub
%cond = select i1 %cmp2, i32 10, i32 32
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cond)
%inc = add nuw nsw i32 %i.07, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %while.cond.loopexit, !llvm.loop !11
while.end: ; preds = %while.cond.loopexit, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %casos) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(){
int a, b, i;
scanf("%d %d", &a, &b);
if(b == 1){
puts("0");
return 0;
}
for(i = 0; a + (a - 1) * i < b; i++){}
printf("%d\n", i + 1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146912/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146912/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [2 x i8] c"0\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:
%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 %b, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 1
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = add nsw i32 %1, -1
%smax = call i32 @llvm.smax.i32(i32 %1, i32 %0)
%2 = icmp slt i32 %1, %0
%umin = zext i1 %2 to i32
%3 = add i32 %1, %umin
%4 = sub i32 %smax, %3
%umax = call i32 @llvm.umax.i32(i32 %sub, i32 1)
%5 = udiv i32 %4, %umax
%6 = add i32 %5, %umin
%add3 = add nuw nsw i32 %6, 1
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add3)
br label %cleanup
if.then: ; preds = %entry
%call1 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %cleanup
cleanup: ; preds = %for.cond.preheader, %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 @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.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
int A, B, result;
int i;
scanf ("%d %d", &A, &B);
result = (B-1)/(A-1) + (((B-1)%(A-1))?1:0);
printf("%d", result);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_146956/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_146956/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%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 %B, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%1 = load i32, ptr %A, align 4, !tbaa !5
%sub1 = add nsw i32 %1, -1
%div = sdiv i32 %sub, %sub1
%rem = srem i32 %sub, %sub1
%tobool.not = icmp ne i32 %rem, 0
%cond = zext i1 %tobool.not to i32
%add = add nsw i32 %div, %cond
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
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>
#include<math.h>
#include<string.h>
int main()
{
int a,b,c;
while(scanf("%d %d %d",&a,&b,&c)==3)
{
int n[10];
int max;
int i;
n[0]=a+b*c;
n[1]=a*(b+c);
n[2]=a*b*c;
n[3]=(a+b)*c;
n[4]=a+b+c;
n[5]=a*b+c;
for(i=0,max=n[0];i<6;i++)
{
if(n[i]>max)
max=n[i];
}
memset(n,0,sizeof(n));
printf("%d\n",max);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%cmp30 = icmp eq i32 %call29, 3
br i1 %cmp30, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%2 = load i32, ptr %c, align 4, !tbaa !5
%mul = mul nsw i32 %2, %1
%add = add nsw i32 %mul, %0
%add1 = add nsw i32 %2, %1
%mul2 = mul nsw i32 %add1, %0
%mul4 = mul nsw i32 %1, %0
%mul5 = mul nsw i32 %mul4, %2
%add7 = add nsw i32 %1, %0
%mul8 = mul nsw i32 %add7, %2
%add11 = add nsw i32 %add7, %2
%add14 = add nsw i32 %mul4, %2
%spec.select.1 = call i32 @llvm.smax.i32(i32 %mul2, i32 %add)
%spec.select.2 = call i32 @llvm.smax.i32(i32 %mul5, i32 %spec.select.1)
%spec.select.3 = call i32 @llvm.smax.i32(i32 %mul8, i32 %spec.select.2)
%spec.select.4 = call i32 @llvm.smax.i32(i32 %add11, i32 %spec.select.3)
%spec.select.5 = call i32 @llvm.smax.i32(i32 %add14, i32 %spec.select.4)
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select.5)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%cmp = icmp eq i32 %call, 3
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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"}
|
#include <stdio.h>
#include <string.h>
#define MIN(A,B) (A)<(B)?(A):(B)
#define MAX(A,B) (A)>(B)?(A):(B)
#define N 5
int main(){
int n, a, b, c=0, i;
char S[N], T[N];
scanf("%d %d", &a, &b);
c=(b-1)/(a-1);
if ((b-1)%(a-1)) c++;
printf("%d\n", c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147041/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147041/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %b, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub1 = add nsw i32 %1, -1
%div = sdiv i32 %sub, %sub1
%rem = srem i32 %sub, %sub1
%tobool.not = icmp ne i32 %rem, 0
%inc = zext i1 %tobool.not to i32
%spec.select = add nsw i32 %div, %inc
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select)
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 n;
scanf("%d" , &n) ;
getchar() ;
if(n>0 && n <=1000)
{
char bus[n][5] ;
int rows=0 ;
int cols =0 ;
char temp ;
///scan array
while(rows<n)
{
while(cols<5 )
{
scanf("%c" ,&bus[rows][cols]) ;
cols++;
}
getchar() ;
rows++;
cols=0;
}
int flag = 0 ;
for(rows = 0 ; rows<n ; rows++)
{
if(bus[rows][0] == 'O'&& bus[rows][1] == 'O' ){
bus[rows][0] = '+' ;
bus[rows][1] = '+' ;
flag =1 ;
break ;
}
else if(bus[rows][3] == 'O' && bus[rows][4] == 'O' ){
bus[rows][3] = '+' ;
bus[rows][4] = '+' ;
flag =1 ;
break ;
}
}
///print array
if(flag)
{
printf("YES\n") ;
for(rows=0 ; rows<n ; rows++)
{
for(cols=0 ; cols <5 ; cols++)
{
printf("%c" , bus[rows][cols]);
}
printf("\n") ;
}
}
else printf("NO");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1471/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1471/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%c\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@str = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca 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 ptr, ptr @stdin, align 8, !tbaa !5
%call.i = call i32 @getc(ptr noundef %0)
%1 = load i32, ptr %n, align 4
%2 = add i32 %1, -1
%or.cond = icmp ult i32 %2, 1000
br i1 %or.cond, label %if.then, label %if.end81
if.then: ; preds = %entry
%3 = zext i32 %1 to i64
%4 = call ptr @llvm.stacksave.p0()
%vla = alloca [5 x i8], i64 %3, align 16
%5 = load i32, ptr %n, align 4, !tbaa !9
%cmp3106 = icmp sgt i32 %5, 0
br i1 %cmp3106, label %while.cond4.preheader, label %if.else78
while.cond4.preheader: ; preds = %if.then, %while.cond4.preheader
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond4.preheader ], [ 0, %if.then ]
%arrayidx8 = getelementptr inbounds [5 x i8], ptr %vla, i64 %indvars.iv, i64 0
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx8)
%arrayidx8.1 = getelementptr inbounds [5 x i8], ptr %vla, i64 %indvars.iv, i64 1
%call9.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx8.1)
%arrayidx8.2 = getelementptr inbounds [5 x i8], ptr %vla, i64 %indvars.iv, i64 2
%call9.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx8.2)
%arrayidx8.3 = getelementptr inbounds [5 x i8], ptr %vla, i64 %indvars.iv, i64 3
%call9.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx8.3)
%arrayidx8.4 = getelementptr inbounds [5 x i8], ptr %vla, i64 %indvars.iv, i64 4
%call9.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx8.4)
%6 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i103 = call i32 @getc(ptr noundef %6)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %n, align 4, !tbaa !9
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp3, label %while.cond4.preheader, label %for.cond.preheader, !llvm.loop !11
for.cond.preheader: ; preds = %while.cond4.preheader
%cmp13.not108 = icmp sgt i32 %7, 0
br i1 %cmp13.not108, label %for.body.preheader, label %if.else78
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %7 to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv119 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next120, %for.inc ]
%arrayidx15 = getelementptr inbounds [5 x i8], ptr %vla, i64 %indvars.iv119
%9 = load i8, ptr %arrayidx15, align 1, !tbaa !13
%cmp17 = icmp eq i8 %9, 79
br i1 %cmp17, label %land.lhs.true19, label %if.else
land.lhs.true19: ; preds = %for.body
%arrayidx22 = getelementptr inbounds [5 x i8], ptr %vla, i64 %indvars.iv119, i64 1
%10 = load i8, ptr %arrayidx22, align 1, !tbaa !13
%cmp24 = icmp eq i8 %10, 79
br i1 %cmp24, label %if.then55, label %if.else
if.else: ; preds = %land.lhs.true19, %for.body
%arrayidx35 = getelementptr inbounds [5 x i8], ptr %vla, i64 %indvars.iv119, i64 3
%11 = load i8, ptr %arrayidx35, align 1, !tbaa !13
%cmp37 = icmp eq i8 %11, 79
br i1 %cmp37, label %land.lhs.true39, label %for.inc
land.lhs.true39: ; preds = %if.else
%arrayidx42 = getelementptr inbounds [5 x i8], ptr %vla, i64 %indvars.iv119, i64 4
%12 = load i8, ptr %arrayidx42, align 1, !tbaa !13
%cmp44 = icmp eq i8 %12, 79
br i1 %cmp44, label %if.then55, label %for.inc
for.inc: ; preds = %land.lhs.true39, %if.else
%indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
%exitcond.not = icmp eq i64 %indvars.iv.next120, %wide.trip.count
br i1 %exitcond.not, label %if.else78, label %for.body, !llvm.loop !14
if.then55: ; preds = %land.lhs.true39, %land.lhs.true19
%arrayidx15.lcssa.sink = phi ptr [ %arrayidx15, %land.lhs.true19 ], [ %arrayidx35, %land.lhs.true39 ]
%arrayidx22.lcssa.sink = phi ptr [ %arrayidx22, %land.lhs.true19 ], [ %arrayidx42, %land.lhs.true39 ]
store i8 43, ptr %arrayidx15.lcssa.sink, align 1, !tbaa !13
store i8 43, ptr %arrayidx22.lcssa.sink, align 1, !tbaa !13
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
%13 = load i32, ptr %n, align 4, !tbaa !9
%cmp58111 = icmp sgt i32 %13, 0
br i1 %cmp58111, label %for.cond61.preheader, label %if.end80
for.cond61.preheader: ; preds = %if.then55, %for.cond61.preheader
%indvars.iv126 = phi i64 [ %indvars.iv.next127, %for.cond61.preheader ], [ 0, %if.then55 ]
%arrayidx68 = getelementptr inbounds [5 x i8], ptr %vla, i64 %indvars.iv126, i64 0
%14 = load i8, ptr %arrayidx68, align 1, !tbaa !13
%conv69 = sext i8 %14 to i32
%putchar102 = call i32 @putchar(i32 %conv69)
%arrayidx68.1 = getelementptr inbounds [5 x i8], ptr %vla, i64 %indvars.iv126, i64 1
%15 = load i8, ptr %arrayidx68.1, align 1, !tbaa !13
%conv69.1 = sext i8 %15 to i32
%putchar102.1 = call i32 @putchar(i32 %conv69.1)
%arrayidx68.2 = getelementptr inbounds [5 x i8], ptr %vla, i64 %indvars.iv126, i64 2
%16 = load i8, ptr %arrayidx68.2, align 1, !tbaa !13
%conv69.2 = sext i8 %16 to i32
%putchar102.2 = call i32 @putchar(i32 %conv69.2)
%arrayidx68.3 = getelementptr inbounds [5 x i8], ptr %vla, i64 %indvars.iv126, i64 3
%17 = load i8, ptr %arrayidx68.3, align 1, !tbaa !13
%conv69.3 = sext i8 %17 to i32
%putchar102.3 = call i32 @putchar(i32 %conv69.3)
%arrayidx68.4 = getelementptr inbounds [5 x i8], ptr %vla, i64 %indvars.iv126, i64 4
%18 = load i8, ptr %arrayidx68.4, align 1, !tbaa !13
%conv69.4 = sext i8 %18 to i32
%putchar102.4 = call i32 @putchar(i32 %conv69.4)
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
%19 = load i32, ptr %n, align 4, !tbaa !9
%20 = sext i32 %19 to i64
%cmp58 = icmp slt i64 %indvars.iv.next127, %20
br i1 %cmp58, label %for.cond61.preheader, label %if.end80, !llvm.loop !15
if.else78: ; preds = %for.inc, %if.then, %for.cond.preheader
%call79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
br label %if.end80
if.end80: ; preds = %for.cond61.preheader, %if.then55, %if.else78
call void @llvm.stackrestore.p0(ptr %4)
br label %if.end81
if.end81: ; preds = %if.end80, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn 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 @getc(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
|
#include <stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int a,b,c,m;
scanf("%d%d%d%d",&a,&b,&c,&m);
if(a+b+c-3<m)
{
printf("NO\n");
continue;
}
if(a>b&&a>c)
{
if(m<a-b-c-1)
{
printf("NO\n");
continue;
}
}
if(b>a&&b>c)
{
if(m<b-a-c-1)
{
printf("NO\n");
continue;
}
}
if(c>a&&c>b)
{
if(m<c-a-b-1)
{
printf("NO\n");
continue;
}
}
printf("YES\n");
}
// getchar();
// getchar();
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14715/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14715/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d%d%d%d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@str.7 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec59 = add nsw i32 %0, -1
store i32 %dec59, ptr %t, align 4, !tbaa !5
%tobool.not60 = icmp eq i32 %0, 0
br i1 %tobool.not60, label %while.end, label %while.body
while.body: ; preds = %entry, %cleanup
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 %m) #4
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %m)
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%3 = load i32, ptr %c, align 4, !tbaa !5
%add2 = add i32 %3, -3
%sub = add i32 %add2, %add
%4 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %sub, %4
br i1 %cmp, label %cleanup, label %if.end, !llvm.loop !9
if.end: ; preds = %while.body
%cmp4 = icmp sgt i32 %1, %2
%cmp5 = icmp sgt i32 %1, %3
%or.cond = and i1 %cmp4, %cmp5
br i1 %or.cond, label %if.then6, label %if.end14
if.then6: ; preds = %if.end
%5 = add i32 %3, %2
%6 = xor i32 %5, -1
%sub9 = add i32 %1, %6
%cmp10 = icmp slt i32 %4, %sub9
br i1 %cmp10, label %cleanup, label %if.end14, !llvm.loop !9
if.end14: ; preds = %if.then6, %if.end
%cmp15 = icmp sgt i32 %2, %1
%cmp17 = icmp sgt i32 %2, %3
%or.cond57 = and i1 %cmp15, %cmp17
br i1 %or.cond57, label %if.then18, label %if.end26
if.then18: ; preds = %if.end14
%7 = add i32 %3, %1
%8 = xor i32 %7, -1
%sub21 = add i32 %2, %8
%cmp22 = icmp slt i32 %4, %sub21
br i1 %cmp22, label %cleanup, label %if.end26, !llvm.loop !9
if.end26: ; preds = %if.then18, %if.end14
%cmp27 = icmp sgt i32 %3, %1
%cmp29 = icmp sgt i32 %3, %2
%or.cond58 = and i1 %cmp27, %cmp29
br i1 %or.cond58, label %if.then30, label %if.end38
if.then30: ; preds = %if.end26
%9 = xor i32 %add, -1
%sub33 = add i32 %3, %9
%cmp34 = icmp slt i32 %4, %sub33
br i1 %cmp34, label %cleanup, label %if.end38, !llvm.loop !9
if.end38: ; preds = %if.then30, %if.end26
br label %cleanup
cleanup: ; preds = %if.then30, %if.then18, %if.then6, %while.body, %if.end38
%str.sink = phi ptr [ @str, %if.end38 ], [ @str.7, %while.body ], [ @str.7, %if.then6 ], [ @str.7, %if.then18 ], [ @str.7, %if.then30 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #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
%10 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %10, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %10, 0
br i1 %tobool.not, label %while.end, label %while.body
while.end: ; preds = %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 t, n, i, j;
int main() {
scanf("%d", &t);
while (t--) {
scanf("%d", &n);
for (i = 1; i <= n; i++) {
for (j = 0; j < i; j++)
printf("(");
for (j = 0; j < i; j++)
printf(")");
for (j = 0; j < n - i; j++)
printf("(");
for (j = 0; j < n - i; j++)
printf(")");
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14720/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14720/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@t = dso_local global i32 0, align 4
@n = dso_local global i32 0, align 4
@i = dso_local local_unnamed_addr global i32 0, align 4
@j = dso_local local_unnamed_addr global i32 0, align 4
; 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 @t)
%0 = load i32, ptr @t, align 4, !tbaa !5
%dec47 = add nsw i32 %0, -1
store i32 %dec47, ptr @t, align 4, !tbaa !5
%tobool.not48 = icmp eq i32 %0, 0
br i1 %tobool.not48, label %while.end, label %while.body
while.cond.loopexit: ; preds = %for.end27, %while.body
%1 = load i32, ptr @t, align 4, !tbaa !5
%dec = add nsw i32 %1, -1
store i32 %dec, ptr @t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %1, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.body: ; preds = %entry, %while.cond.loopexit
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
store i32 1, ptr @i, align 4, !tbaa !5
%2 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not46 = icmp slt i32 %2, 1
br i1 %cmp.not46, label %while.cond.loopexit, label %for.cond2.preheader
for.cond2.preheader: ; preds = %while.body, %for.end27
%3 = phi i32 [ %inc30, %for.end27 ], [ 1, %while.body ]
store i32 0, ptr @j, align 4, !tbaa !5
%cmp340 = icmp sgt i32 %3, 0
br i1 %cmp340, label %for.body4, label %for.cond13.preheader
for.cond6.preheader: ; preds = %for.body4
store i32 0, ptr @j, align 4, !tbaa !5
%cmp741 = icmp sgt i32 %5, 0
br i1 %cmp741, label %for.body8, label %for.cond13.preheader
for.body4: ; preds = %for.cond2.preheader, %for.body4
%putchar39 = tail call i32 @putchar(i32 40)
%4 = load i32, ptr @j, align 4, !tbaa !5
%inc = add nsw i32 %4, 1
store i32 %inc, ptr @j, align 4, !tbaa !5
%5 = load i32, ptr @i, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc, %5
br i1 %cmp3, label %for.body4, label %for.cond6.preheader, !llvm.loop !11
for.cond13.preheader: ; preds = %for.body8, %for.cond2.preheader, %for.cond6.preheader
%6 = phi i32 [ %5, %for.cond6.preheader ], [ %3, %for.cond2.preheader ], [ %9, %for.body8 ]
store i32 0, ptr @j, align 4, !tbaa !5
%7 = load i32, ptr @n, align 4, !tbaa !5
%cmp1443 = icmp sgt i32 %7, %6
br i1 %cmp1443, label %for.body15, label %for.cond20.preheader
for.body8: ; preds = %for.cond6.preheader, %for.body8
%putchar38 = tail call i32 @putchar(i32 41)
%8 = load i32, ptr @j, align 4, !tbaa !5
%inc11 = add nsw i32 %8, 1
store i32 %inc11, ptr @j, align 4, !tbaa !5
%9 = load i32, ptr @i, align 4, !tbaa !5
%cmp7 = icmp slt i32 %inc11, %9
br i1 %cmp7, label %for.body8, label %for.cond13.preheader, !llvm.loop !12
for.cond20.preheader: ; preds = %for.body15, %for.cond13.preheader
%10 = phi i32 [ %6, %for.cond13.preheader ], [ %14, %for.body15 ]
%11 = phi i32 [ %7, %for.cond13.preheader ], [ %13, %for.body15 ]
store i32 0, ptr @j, align 4, !tbaa !5
%cmp2245 = icmp sgt i32 %11, %10
br i1 %cmp2245, label %for.body23, label %for.end27
for.body15: ; preds = %for.cond13.preheader, %for.body15
%putchar37 = tail call i32 @putchar(i32 40)
%12 = load i32, ptr @j, align 4, !tbaa !5
%inc18 = add nsw i32 %12, 1
store i32 %inc18, ptr @j, align 4, !tbaa !5
%13 = load i32, ptr @n, align 4, !tbaa !5
%14 = load i32, ptr @i, align 4, !tbaa !5
%sub = sub nsw i32 %13, %14
%cmp14 = icmp slt i32 %inc18, %sub
br i1 %cmp14, label %for.body15, label %for.cond20.preheader, !llvm.loop !13
for.body23: ; preds = %for.cond20.preheader, %for.body23
%putchar36 = tail call i32 @putchar(i32 41)
%15 = load i32, ptr @j, align 4, !tbaa !5
%inc26 = add nsw i32 %15, 1
store i32 %inc26, ptr @j, align 4, !tbaa !5
%16 = load i32, ptr @n, align 4, !tbaa !5
%17 = load i32, ptr @i, align 4, !tbaa !5
%sub21 = sub nsw i32 %16, %17
%cmp22 = icmp slt i32 %inc26, %sub21
br i1 %cmp22, label %for.body23, label %for.end27, !llvm.loop !14
for.end27: ; preds = %for.body23, %for.cond20.preheader
%putchar = tail call i32 @putchar(i32 10)
%18 = load i32, ptr @i, align 4, !tbaa !5
%inc30 = add nsw i32 %18, 1
store i32 %inc30, ptr @i, align 4, !tbaa !5
%19 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %18, %19
br i1 %cmp.not.not, label %for.cond2.preheader, label %while.cond.loopexit, !llvm.loop !15
while.end: ; preds = %while.cond.loopexit, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 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 = { nofree nounwind "no-trapping-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 }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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}
|
#include<stdio.h>
#include<string.h>
int main(){
char s[111111];
scanf("%s",s);
int i,ans=0;
for(i=1;i<strlen(s);i++){
if(s[i]!=s[i-1]) ans++;
}
printf("%d",ans);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147243/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147243/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [111111 x i8], align 16
call void @llvm.lifetime.start.p0(i64 111111, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%cmp16 = icmp ugt i64 %call2, 1
br i1 %cmp16, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%.pre = load i8, ptr %s, align 16, !tbaa !5
%0 = add i64 %call2, -1
%min.iters.check = icmp ult i64 %call2, 9
br i1 %min.iters.check, label %for.body.preheader24, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %0, -8
%ind.end = or i64 %n.vec, 1
%vector.recur.init = insertelement <4 x i8> poison, i8 %.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 i8> [ %vector.recur.init, %vector.ph ], [ %wide.load23, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%vec.phi22 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%offset.idx = or i64 %index, 1
%1 = getelementptr inbounds [111111 x i8], ptr %s, i64 0, i64 %offset.idx
%wide.load = load <4 x i8>, ptr %1, align 1, !tbaa !5
%2 = getelementptr inbounds i8, ptr %1, i64 4
%wide.load23 = load <4 x i8>, ptr %2, align 1, !tbaa !5
%3 = shufflevector <4 x i8> %vector.recur, <4 x i8> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%4 = shufflevector <4 x i8> %wide.load, <4 x i8> %wide.load23, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%5 = icmp ne <4 x i8> %wide.load, %3
%6 = icmp ne <4 x i8> %wide.load23, %4
%7 = zext <4 x i1> %5 to <4 x i32>
%8 = zext <4 x i1> %6 to <4 x i32>
%9 = add <4 x i32> %vec.phi, %7
%10 = add <4 x i32> %vec.phi22, %8
%index.next = add nuw i64 %index, 8
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %10, %9
%12 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %0, %n.vec
%vector.recur.extract = extractelement <4 x i8> %wide.load23, i64 3
br i1 %cmp.n, label %for.end, label %for.body.preheader24
for.body.preheader24: ; preds = %for.body.preheader, %middle.block
%scalar.recur.ph = phi i8 [ %vector.recur.extract, %middle.block ], [ %.pre, %for.body.preheader ]
%indvars.iv.ph = phi i64 [ %ind.end, %middle.block ], [ 1, %for.body.preheader ]
%ans.018.ph = phi i32 [ %12, %middle.block ], [ 0, %for.body.preheader ]
br label %for.body
for.body: ; preds = %for.body.preheader24, %for.body
%scalar.recur = phi i8 [ %13, %for.body ], [ %scalar.recur.ph, %for.body.preheader24 ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader24 ]
%ans.018 = phi i32 [ %spec.select, %for.body ], [ %ans.018.ph, %for.body.preheader24 ]
%arrayidx = getelementptr inbounds [111111 x i8], ptr %s, i64 0, i64 %indvars.iv
%13 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp8.not = icmp ne i8 %13, %scalar.recur
%inc = zext i1 %cmp8.not to i32
%spec.select = add nuw nsw i32 %ans.018, %inc
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %call2
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body, %middle.block, %entry
%ans.0.lcssa = phi i32 [ 0, %entry ], [ %12, %middle.block ], [ %spec.select, %for.body ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 111111, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
|
#include <stdio.h>
int main()
{
char S[100001]; int i = 0 , Slen = 0, count = 0;
scanf("%s", S);
while (S[i] != 0) {
Slen++;
i++;
}
for (i = 1; i < Slen; i++) {
if (S[i] != S[i - 1])count++;
}
printf("%d", count);
scanf("%d", &count);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147287/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147287/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [100001 x i8], align 16
%count = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 100001, ptr nonnull %S) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %count) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%0 = load i8, ptr %S, align 16, !tbaa !5
%cmp.not23 = icmp eq i8 %0, 0
br i1 %cmp.not23, label %for.end, label %while.body
for.cond.preheader: ; preds = %while.body
%1 = and i64 %indvars.iv.next, 4294967294
%cmp328.not = icmp eq i64 %1, 0
br i1 %cmp328.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = and i64 %indvars.iv.next, 4294967295
%2 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i64 %2, 8
br i1 %min.iters.check, label %for.body.preheader44, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %2, -8
%ind.end = or i64 %n.vec, 1
%vector.recur.init = insertelement <4 x i8> poison, i8 %0, 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 i8> [ %vector.recur.init, %vector.ph ], [ %wide.load43, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%vec.phi42 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%offset.idx = or i64 %index, 1
%3 = getelementptr inbounds [100001 x i8], ptr %S, i64 0, i64 %offset.idx
%wide.load = load <4 x i8>, ptr %3, align 1, !tbaa !5
%4 = getelementptr inbounds i8, ptr %3, i64 4
%wide.load43 = load <4 x i8>, ptr %4, align 1, !tbaa !5
%5 = shufflevector <4 x i8> %vector.recur, <4 x i8> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%6 = shufflevector <4 x i8> %wide.load, <4 x i8> %wide.load43, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%7 = icmp ne <4 x i8> %wide.load, %5
%8 = icmp ne <4 x i8> %wide.load43, %6
%9 = zext <4 x i1> %7 to <4 x i32>
%10 = zext <4 x i1> %8 to <4 x i32>
%11 = add <4 x i32> %vec.phi, %9
%12 = add <4 x i32> %vec.phi42, %10
%index.next = add nuw i64 %index, 8
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %12, %11
%14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %2, %n.vec
%vector.recur.extract = extractelement <4 x i8> %wide.load43, i64 3
br i1 %cmp.n, label %for.end, label %for.body.preheader44
for.body.preheader44: ; preds = %for.body.preheader, %middle.block
%scalar.recur.ph = phi i8 [ %vector.recur.extract, %middle.block ], [ %0, %for.body.preheader ]
%indvars.iv35.ph = phi i64 [ %ind.end, %middle.block ], [ 1, %for.body.preheader ]
%inc132729.ph = phi i32 [ %14, %middle.block ], [ 0, %for.body.preheader ]
br label %for.body
while.body: ; preds = %entry, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [100001 x i8], ptr %S, i64 0, i64 %indvars.iv.next
%15 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %15, 0
br i1 %cmp.not, label %for.cond.preheader, label %while.body, !llvm.loop !12
for.body: ; preds = %for.body.preheader44, %for.body
%scalar.recur = phi i8 [ %16, %for.body ], [ %scalar.recur.ph, %for.body.preheader44 ]
%indvars.iv35 = phi i64 [ %indvars.iv.next36, %for.body ], [ %indvars.iv35.ph, %for.body.preheader44 ]
%inc132729 = phi i32 [ %spec.select, %for.body ], [ %inc132729.ph, %for.body.preheader44 ]
%arrayidx6 = getelementptr inbounds [100001 x i8], ptr %S, i64 0, i64 %indvars.iv35
%16 = load i8, ptr %arrayidx6, align 1, !tbaa !5
%cmp11.not = icmp ne i8 %16, %scalar.recur
%inc13 = zext i1 %cmp11.not to i32
%spec.select = add nuw nsw i32 %inc132729, %inc13
%indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
%exitcond.not = icmp eq i64 %indvars.iv.next36, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry, %for.cond.preheader
%inc1327.lcssa = phi i32 [ 0, %for.cond.preheader ], [ 0, %entry ], [ %14, %middle.block ], [ %spec.select, %for.body ]
store i32 %inc1327.lcssa, ptr %count, align 4, !tbaa !14
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %inc1327.lcssa)
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %count)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %count) #4
call void @llvm.lifetime.end.p0(i64 100001, ptr nonnull %S) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9}
!13 = distinct !{!13, !9, !11, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !6, i64 0}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 300000
#define A 300000
#define L_ 20 /* L_ = ceil(log2(max(N, A) + 1) + 1 */
#define N_ (1 << L_)
#define MD 998244353
int vv[L_ + 1], *wu[L_ + 1], *wv[L_ + 1];
long long power(long long a, int k) {
long long p = 1;
while (k) {
if (k & 1)
p = p * a % MD;
a = a * a % MD;
k >>= 1;
}
return p;
}
void init() {
int l, u, v;
u = power(3, MD - 1 >> L_), v = power(u, MD - 2);
for (l = L_; l > 0; l--) {
int n = 1 << l, m = n >> 1, i;
vv[l] = power(n, MD - 2);
wu[l] = (int *) malloc(m * sizeof *wu[l]);
wv[l] = (int *) malloc(m * sizeof *wv[l]);
wu[l][0] = wv[l][0] = 1;
for (i = 1; i < m; i++) {
wu[l][i] = (long long) wu[l][i - 1] * u % MD;
wv[l][i] = (long long) wv[l][i - 1] * v % MD;
}
u = (long long) u * u % MD, v = (long long) v * v % MD;
}
}
void ntt_(int *aa, int l, int inverse) {
if (l > 0) {
int n = 1 << l, m = n >> 1, *ww = inverse ? wv[l] : wu[l], i, j;
ntt_(aa, l - 1, inverse), ntt_(aa + m, l - 1, inverse);
for (i = 0; (j = i + m) < n; i++) {
int a = aa[i], b = (long long) aa[j] * ww[i] % MD;
if ((aa[i] = a + b) >= MD)
aa[i] -= MD;
if ((aa[j] = a - b) < 0)
aa[j] += MD;
}
}
}
void ntt(int *aa, int l, int inverse) {
int n = 1 << l, i, j;
for (i = 0, j = 1; j < n; j++) {
int b = n >> 1, tmp;
while ((i ^= b) < b)
b >>= 1;
if (i < j)
tmp = aa[i], aa[i] = aa[j], aa[j] = tmp;
}
ntt_(aa, l, inverse);
}
void mult(int *aa, int *bb, int *cc, int l) {
static int aa_[N_], bb_[N_];
int n = 1 << l, i;
for (i = 0; i < n * 2; i++)
aa_[i] = i < n ? aa[i] : 0, bb_[i] = i < n ? bb[i] : 0;
ntt(aa_, l + 1, 0), ntt(bb_, l + 1, 0);
for (i = 0; i < n * 2; i++)
aa_[i] = (long long) aa_[i] * bb_[i] % MD;
ntt(aa_, l + 1, 1);
for (i = 0; i < n; i++)
cc[i] = (long long) aa_[i] * vv[l + 1] % MD;
}
void inv(int *aa, int *bb, int l_) {
static int cc[N_];
int l, i;
memset(bb, 0, (1 << l_ + 1) * sizeof *bb), bb[0] = 1;
for (l = 0; l < l_; l++) {
mult(aa, bb, cc, l + 1);
for (i = 0; i < 1 << l + 1; i++)
if ((cc[i] = -cc[i]) < 0)
cc[i] += MD;
cc[0] = (cc[0] + 2) % MD;
mult(bb, cc, bb, l + 1);
}
}
int main() {
static int pp[A], qq[A], aa[N_], bb[N_];
static char bad[A];
int n, n_, m, a_, a, b, k, l_, i;
init();
scanf("%d%d%d", &m, &n, &a_);
memset(pp, -1, a_ * sizeof *pp), memset(qq, -1, a_ * sizeof *qq);
while (m--) {
int l, p;
scanf("%d", &l);
p = -1;
while (l--) {
scanf("%d", &a), a--;
if (p != -1) {
if (pp[a] != -1 && pp[a] != p)
bad[a] = 1;
else
pp[a] = p;
if (qq[p] != -1 && qq[p] != a)
bad[p] = 1;
else
qq[p] = a;
}
p = a;
}
}
aa[0] = 1;
for (a = 0; a < a_; a++)
if (pp[a] == -1) {
k = 0;
b = a;
for (b = a; b != -1 && !bad[b]; b = qq[b])
pp[b] = -2, k++;
if (b == -1)
aa[k]--;
}
l_ = 0;
while (1 << l_ <= n || 1 << l_ <= a_)
l_++;
n_ = 1 << l_;
for (i = 0; i < n_; i++)
if (aa[i] < 0)
aa[i] += MD;
inv(aa, bb, l_);
printf("%d\n", bb[n]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14733/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14733/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@vv = dso_local local_unnamed_addr global [21 x i32] zeroinitializer, align 16
@wu = dso_local local_unnamed_addr global [21 x ptr] zeroinitializer, align 16
@wv = dso_local local_unnamed_addr global [21 x ptr] zeroinitializer, align 16
@mult.aa_ = internal global [1048576 x i32] zeroinitializer, align 16
@mult.bb_ = internal global [1048576 x i32] zeroinitializer, align 16
@inv.cc = internal global [1048576 x i32] zeroinitializer, align 16
@main.pp = internal unnamed_addr global [300000 x i32] zeroinitializer, align 16
@main.qq = internal unnamed_addr global [300000 x i32] zeroinitializer, align 16
@main.aa = internal global [1048576 x i32] zeroinitializer, align 16
@main.bb = internal global [1048576 x i32] zeroinitializer, align 16
@main.bad = internal unnamed_addr global [300000 x i8] zeroinitializer, align 16
@.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
@.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 i64 @power(i64 noundef %a, i32 noundef %k) local_unnamed_addr #0 {
entry:
%tobool.not9 = icmp eq i32 %k, 0
br i1 %tobool.not9, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%p.012 = phi i64 [ %p.1, %if.end ], [ 1, %entry ]
%k.addr.011 = phi i32 [ %shr, %if.end ], [ %k, %entry ]
%a.addr.010 = phi i64 [ %rem3, %if.end ], [ %a, %entry ]
%and = and i32 %k.addr.011, 1
%tobool1.not = icmp eq i32 %and, 0
br i1 %tobool1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul nsw i64 %p.012, %a.addr.010
%rem = srem i64 %mul, 998244353
br label %if.end
if.end: ; preds = %if.then, %while.body
%p.1 = phi i64 [ %rem, %if.then ], [ %p.012, %while.body ]
%mul2 = mul nsw i64 %a.addr.010, %a.addr.010
%rem3 = urem i64 %mul2, 998244353
%shr = ashr i32 %k.addr.011, 1
%tobool.not = icmp ult i32 %k.addr.011, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %if.end, %entry
%p.0.lcssa = phi i64 [ 1, %entry ], [ %p.1, %if.end ]
ret i64 %p.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 memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local void @init() local_unnamed_addr #2 {
if.end.i.9:
br label %while.body.i93
while.body.i93: ; preds = %if.end.i102, %if.end.i.9
%p.012.i94 = phi i64 [ %p.1.i103, %if.end.i102 ], [ 1, %if.end.i.9 ]
%k.addr.011.i95 = phi i32 [ %shr.i106, %if.end.i102 ], [ 998244351, %if.end.i.9 ]
%a.addr.010.i96 = phi i64 [ %rem3.i105, %if.end.i102 ], [ 565042129, %if.end.i.9 ]
%and.i97 = and i32 %k.addr.011.i95, 1
%tobool1.not.i98 = icmp eq i32 %and.i97, 0
br i1 %tobool1.not.i98, label %if.end.i102, label %if.then.i99
if.then.i99: ; preds = %while.body.i93
%mul.i100 = mul nuw nsw i64 %a.addr.010.i96, %p.012.i94
%rem.i101 = urem i64 %mul.i100, 998244353
br label %if.end.i102
if.end.i102: ; preds = %if.then.i99, %while.body.i93
%p.1.i103 = phi i64 [ %rem.i101, %if.then.i99 ], [ %p.012.i94, %while.body.i93 ]
%mul2.i104 = mul nuw nsw i64 %a.addr.010.i96, %a.addr.010.i96
%rem3.i105 = urem i64 %mul2.i104, 998244353
%shr.i106 = lshr i32 %k.addr.011.i95, 1
%tobool.not.i107 = icmp ult i32 %k.addr.011.i95, 2
br i1 %tobool.not.i107, label %for.body, label %while.body.i93, !llvm.loop !5
for.body: ; preds = %if.end.i102, %for.end
%indvars.iv132 = phi i64 [ %indvars.iv.next133, %for.end ], [ 20, %if.end.i102 ]
%u.0.in128 = phi i64 [ %rem56, %for.end ], [ 565042129, %if.end.i102 ]
%v.0.in127 = phi i64 [ %rem61, %for.end ], [ %p.1.i103, %if.end.i102 ]
%0 = trunc i64 %indvars.iv132 to i32
%shl = shl nuw i32 1, %0
%conv5 = sext i32 %shl to i64
br label %while.body.i109
while.body.i109: ; preds = %if.end.i118, %for.body
%p.012.i110 = phi i64 [ %p.1.i119, %if.end.i118 ], [ 1, %for.body ]
%k.addr.011.i111 = phi i32 [ %shr.i122, %if.end.i118 ], [ 998244351, %for.body ]
%a.addr.010.i112 = phi i64 [ %rem3.i121, %if.end.i118 ], [ %conv5, %for.body ]
%and.i113 = and i32 %k.addr.011.i111, 1
%tobool1.not.i114 = icmp eq i32 %and.i113, 0
br i1 %tobool1.not.i114, label %if.end.i118, label %if.then.i115
if.then.i115: ; preds = %while.body.i109
%mul.i116 = mul nsw i64 %a.addr.010.i112, %p.012.i110
%rem.i117 = srem i64 %mul.i116, 998244353
br label %if.end.i118
if.end.i118: ; preds = %if.then.i115, %while.body.i109
%p.1.i119 = phi i64 [ %rem.i117, %if.then.i115 ], [ %p.012.i110, %while.body.i109 ]
%mul2.i120 = mul nsw i64 %a.addr.010.i112, %a.addr.010.i112
%rem3.i121 = urem i64 %mul2.i120, 998244353
%shr.i122 = lshr i32 %k.addr.011.i111, 1
%tobool.not.i123 = icmp ult i32 %k.addr.011.i111, 2
br i1 %tobool.not.i123, label %power.exit124, label %while.body.i109, !llvm.loop !5
power.exit124: ; preds = %if.end.i118
%shr = ashr exact i32 %shl, 1
%conv7 = trunc i64 %p.1.i119 to i32
%arrayidx = getelementptr inbounds [21 x i32], ptr @vv, i64 0, i64 %indvars.iv132
store i32 %conv7, ptr %arrayidx, align 4, !tbaa !7
%conv8 = sext i32 %shr to i64
%mul = shl nsw i64 %conv8, 2
%call9 = tail call noalias ptr @malloc(i64 noundef %mul) #10
%arrayidx11 = getelementptr inbounds [21 x ptr], ptr @wu, i64 0, i64 %indvars.iv132
store ptr %call9, ptr %arrayidx11, align 8, !tbaa !11
%call14 = tail call noalias ptr @malloc(i64 noundef %mul) #10
%arrayidx16 = getelementptr inbounds [21 x ptr], ptr @wv, i64 0, i64 %indvars.iv132
store ptr %call14, ptr %arrayidx16, align 8, !tbaa !11
store i32 1, ptr %call14, align 4, !tbaa !7
store i32 1, ptr %call9, align 4, !tbaa !7
%cmp24125 = icmp sgt i32 %shl, 3
br i1 %cmp24125, label %for.body26.lr.ph, label %for.end
for.body26.lr.ph: ; preds = %power.exit124
%smax = tail call i32 @llvm.smax.i32(i32 %shr, i32 2)
%wide.trip.count = zext i32 %smax to i64
br label %for.body26
for.body26: ; preds = %for.body26.lr.ph, %for.body26
%conv44 = phi i64 [ 1, %for.body26.lr.ph ], [ %rem47, %for.body26 ]
%conv31 = phi i64 [ 1, %for.body26.lr.ph ], [ %rem, %for.body26 ]
%indvars.iv = phi i64 [ 1, %for.body26.lr.ph ], [ %indvars.iv.next, %for.body26 ]
%mul33 = mul nuw nsw i64 %u.0.in128, %conv31
%rem = urem i64 %mul33, 998244353
%conv34 = trunc i64 %rem to i32
%arrayidx38 = getelementptr inbounds i32, ptr %call9, i64 %indvars.iv
store i32 %conv34, ptr %arrayidx38, align 4, !tbaa !7
%mul46 = mul nsw i64 %v.0.in127, %conv44
%rem47 = urem i64 %mul46, 998244353
%conv48 = trunc i64 %rem47 to i32
%arrayidx52 = getelementptr inbounds i32, ptr %call14, i64 %indvars.iv
store i32 %conv48, ptr %arrayidx52, align 4, !tbaa !7
%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.body26, !llvm.loop !13
for.end: ; preds = %for.body26, %power.exit124
%mul55 = mul nuw nsw i64 %u.0.in128, %u.0.in128
%rem56 = urem i64 %mul55, 998244353
%mul60 = mul nuw nsw i64 %v.0.in127, %v.0.in127
%rem61 = urem i64 %mul60, 998244353
%indvars.iv.next133 = add nsw i64 %indvars.iv132, -1
%cmp = icmp ugt i64 %indvars.iv132, 1
br i1 %cmp, label %for.body, label %for.end64, !llvm.loop !14
for.end64: ; preds = %for.end
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 nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @ntt_(ptr noundef %aa, i32 noundef %l, i32 noundef %inverse) local_unnamed_addr #4 {
entry:
%cmp = icmp sgt i32 %l, 0
br i1 %cmp, label %if.then, label %if.end32
if.then: ; preds = %entry
%shl = shl nuw i32 1, %l
%shr = ashr i32 %shl, 1
%tobool.not = icmp eq i32 %inverse, 0
%idxprom1 = zext i32 %l to i64
%sub59 = add nsw i32 %l, -1
%idx.ext62 = sext i32 %shr to i64
%add.ptr63 = getelementptr inbounds i32, ptr %aa, i64 %idx.ext62
%wu.wv = select i1 %tobool.not, ptr @wu, ptr @wv
%arrayidx2 = getelementptr inbounds [21 x ptr], ptr %wu.wv, i64 0, i64 %idxprom1
%0 = load ptr, ptr %arrayidx2, align 8, !tbaa !11
tail call void @ntt_(ptr noundef %aa, i32 noundef %sub59, i32 noundef %inverse)
tail call void @ntt_(ptr noundef %add.ptr63, i32 noundef %sub59, i32 noundef %inverse)
%cmp465 = icmp slt i32 %shr, %shl
br i1 %cmp465, label %for.body.preheader, label %if.end32
for.body.preheader: ; preds = %if.then
%1 = sext i32 %shr to i64
%2 = sub i32 %shl, %shr
%wide.trip.count = zext i32 %2 to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv68 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next69, %for.body ]
%indvars.iv = phi i64 [ %1, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx6 = getelementptr inbounds i32, ptr %aa, i64 %indvars.iv68
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !7
%arrayidx8 = getelementptr inbounds i32, ptr %aa, i64 %indvars.iv
%4 = load i32, ptr %arrayidx8, align 4, !tbaa !7
%conv = sext i32 %4 to i64
%arrayidx10 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv68
%5 = load i32, ptr %arrayidx10, align 4, !tbaa !7
%conv11 = sext i32 %5 to i64
%mul = mul nsw i64 %conv11, %conv
%rem = srem i64 %mul, 998244353
%conv12 = trunc i64 %rem to i32
%add13 = add nsw i32 %3, %conv12
%cmp16 = icmp sgt i32 %add13, 998244352
%sub21 = add nsw i32 %add13, -998244353
%spec.select = select i1 %cmp16, i32 %sub21, i32 %add13
store i32 %spec.select, ptr %arrayidx6, align 4, !tbaa !7
%sub22 = sub nsw i32 %3, %conv12
%cmp25 = icmp slt i32 %sub22, 0
%add30 = add nsw i32 %sub22, 998244353
%storemerge64 = select i1 %cmp25, i32 %add30, i32 %sub22
store i32 %storemerge64, ptr %arrayidx8, align 4, !tbaa !7
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count
br i1 %exitcond.not, label %if.end32, label %for.body, !llvm.loop !15
if.end32: ; preds = %for.body, %if.then, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @ntt(ptr noundef %aa, i32 noundef %l, i32 noundef %inverse) local_unnamed_addr #4 {
entry:
%shl = shl nuw i32 1, %l
%cmp25 = icmp sgt i32 %shl, 1
br i1 %cmp25, label %while.cond.preheader.preheader, label %for.end
while.cond.preheader.preheader: ; preds = %entry
%wide.trip.count = zext i32 %shl to i64
br label %while.cond.preheader
while.cond.preheader: ; preds = %while.cond.preheader.preheader, %if.end
%indvars.iv = phi i64 [ 1, %while.cond.preheader.preheader ], [ %indvars.iv.next, %if.end ]
%i.027 = phi i32 [ 0, %while.cond.preheader.preheader ], [ %xor, %if.end ]
br label %while.cond
while.cond: ; preds = %while.cond.preheader, %while.cond
%b.0.in = phi i32 [ %b.0, %while.cond ], [ %shl, %while.cond.preheader ]
%i.1 = phi i32 [ %xor, %while.cond ], [ %i.027, %while.cond.preheader ]
%b.0 = ashr i32 %b.0.in, 1
%xor = xor i32 %i.1, %b.0
%cmp1 = icmp slt i32 %xor, %b.0
br i1 %cmp1, label %while.cond, label %while.end, !llvm.loop !16
while.end: ; preds = %while.cond
%0 = sext i32 %xor to i64
%cmp3 = icmp sgt i64 %indvars.iv, %0
br i1 %cmp3, label %if.then, label %if.end
if.then: ; preds = %while.end
%arrayidx = getelementptr inbounds i32, ptr %aa, i64 %0
%1 = load i32, ptr %arrayidx, align 4, !tbaa !7
%arrayidx5 = getelementptr inbounds i32, ptr %aa, i64 %indvars.iv
%2 = load i32, ptr %arrayidx5, align 4, !tbaa !7
store i32 %2, ptr %arrayidx, align 4, !tbaa !7
store i32 %1, ptr %arrayidx5, align 4, !tbaa !7
br label %if.end
if.end: ; preds = %if.then, %while.end
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %while.cond.preheader, !llvm.loop !17
for.end: ; preds = %if.end, %entry
tail call void @ntt_(ptr noundef %aa, i32 noundef %l, i32 noundef %inverse)
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mult(ptr nocapture noundef readonly %aa, ptr nocapture noundef readonly %bb, ptr nocapture noundef writeonly %cc, i32 noundef %l) local_unnamed_addr #5 {
entry:
%shl = shl nuw i32 1, %l
%mul = shl i32 2, %l
%cmp123 = icmp sgt i32 %mul, 0
br i1 %cmp123, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%0 = sext i32 %shl to i64
%wide.trip.count = zext i32 %mul to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %cond.end9
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %cond.end9 ]
%cmp1 = icmp slt i64 %indvars.iv, %0
br i1 %cmp1, label %cond.true5, label %cond.end
cond.end: ; preds = %for.body
%arrayidx3 = getelementptr inbounds [1048576 x i32], ptr @mult.aa_, i64 0, i64 %indvars.iv
store i32 0, ptr %arrayidx3, align 4, !tbaa !7
br label %cond.end9
cond.true5: ; preds = %for.body
%arrayidx = getelementptr inbounds i32, ptr %aa, i64 %indvars.iv
%1 = load i32, ptr %arrayidx, align 4, !tbaa !7
%arrayidx3120 = getelementptr inbounds [1048576 x i32], ptr @mult.aa_, i64 0, i64 %indvars.iv
store i32 %1, ptr %arrayidx3120, align 4, !tbaa !7
%arrayidx7 = getelementptr inbounds i32, ptr %bb, i64 %indvars.iv
%2 = load i32, ptr %arrayidx7, align 4, !tbaa !7
br label %cond.end9
cond.end9: ; preds = %cond.end, %cond.true5
%cond10 = phi i32 [ %2, %cond.true5 ], [ 0, %cond.end ]
%arrayidx12 = getelementptr inbounds [1048576 x i32], ptr @mult.bb_, i64 0, i64 %indvars.iv
store i32 %cond10, ptr %arrayidx12, align 4, !tbaa !7
%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 !18
for.end: ; preds = %cond.end9, %entry
%add = add nsw i32 %l, 1
%shl.i = shl nuw i32 1, %add
%cmp25.i = icmp sgt i32 %shl.i, 1
br i1 %cmp25.i, label %while.cond.preheader.preheader.i, label %ntt.exit.thread
ntt.exit.thread: ; preds = %for.end
tail call void @ntt_(ptr noundef nonnull @mult.aa_, i32 noundef %add, i32 noundef 0)
br label %ntt.exit95
while.cond.preheader.preheader.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %shl.i to i64
br label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.end.i, %while.cond.preheader.preheader.i
%indvars.iv.i = phi i64 [ 1, %while.cond.preheader.preheader.i ], [ %indvars.iv.next.i, %if.end.i ]
%i.027.i = phi i32 [ 0, %while.cond.preheader.preheader.i ], [ %xor.i, %if.end.i ]
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %while.cond.preheader.i
%b.0.in.i = phi i32 [ %b.0.i, %while.cond.i ], [ %shl.i, %while.cond.preheader.i ]
%i.1.i = phi i32 [ %xor.i, %while.cond.i ], [ %i.027.i, %while.cond.preheader.i ]
%b.0.i = ashr i32 %b.0.in.i, 1
%xor.i = xor i32 %i.1.i, %b.0.i
%cmp1.i = icmp slt i32 %xor.i, %b.0.i
br i1 %cmp1.i, label %while.cond.i, label %while.end.i, !llvm.loop !16
while.end.i: ; preds = %while.cond.i
%3 = sext i32 %xor.i to i64
%cmp3.i = icmp sgt i64 %indvars.iv.i, %3
br i1 %cmp3.i, label %if.then.i, label %if.end.i
if.then.i: ; preds = %while.end.i
%arrayidx.i = getelementptr inbounds i32, ptr @mult.aa_, i64 %3
%4 = load i32, ptr %arrayidx.i, align 4, !tbaa !7
%arrayidx5.i = getelementptr inbounds i32, ptr @mult.aa_, i64 %indvars.iv.i
%5 = load i32, ptr %arrayidx5.i, align 4, !tbaa !7
store i32 %5, ptr %arrayidx.i, align 4, !tbaa !7
store i32 %4, ptr %arrayidx5.i, align 4, !tbaa !7
br label %if.end.i
if.end.i: ; preds = %if.then.i, %while.end.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %ntt.exit, label %while.cond.preheader.i, !llvm.loop !17
ntt.exit: ; preds = %if.end.i
tail call void @ntt_(ptr noundef nonnull @mult.aa_, i32 noundef %add, i32 noundef 0)
br label %while.cond.preheader.i78
while.cond.preheader.i78: ; preds = %if.end.i89, %ntt.exit
%indvars.iv.i79 = phi i64 [ 1, %ntt.exit ], [ %indvars.iv.next.i90, %if.end.i89 ]
%i.027.i80 = phi i32 [ 0, %ntt.exit ], [ %xor.i85, %if.end.i89 ]
br label %while.cond.i81
while.cond.i81: ; preds = %while.cond.i81, %while.cond.preheader.i78
%b.0.in.i82 = phi i32 [ %b.0.i84, %while.cond.i81 ], [ %shl.i, %while.cond.preheader.i78 ]
%i.1.i83 = phi i32 [ %xor.i85, %while.cond.i81 ], [ %i.027.i80, %while.cond.preheader.i78 ]
%b.0.i84 = ashr i32 %b.0.in.i82, 1
%xor.i85 = xor i32 %i.1.i83, %b.0.i84
%cmp1.i86 = icmp slt i32 %xor.i85, %b.0.i84
br i1 %cmp1.i86, label %while.cond.i81, label %while.end.i87, !llvm.loop !16
while.end.i87: ; preds = %while.cond.i81
%6 = sext i32 %xor.i85 to i64
%cmp3.i88 = icmp sgt i64 %indvars.iv.i79, %6
br i1 %cmp3.i88, label %if.then.i92, label %if.end.i89
if.then.i92: ; preds = %while.end.i87
%arrayidx.i93 = getelementptr inbounds i32, ptr @mult.bb_, i64 %6
%7 = load i32, ptr %arrayidx.i93, align 4, !tbaa !7
%arrayidx5.i94 = getelementptr inbounds i32, ptr @mult.bb_, i64 %indvars.iv.i79
%8 = load i32, ptr %arrayidx5.i94, align 4, !tbaa !7
store i32 %8, ptr %arrayidx.i93, align 4, !tbaa !7
store i32 %7, ptr %arrayidx5.i94, align 4, !tbaa !7
br label %if.end.i89
if.end.i89: ; preds = %if.then.i92, %while.end.i87
%indvars.iv.next.i90 = add nuw nsw i64 %indvars.iv.i79, 1
%exitcond.not.i91 = icmp eq i64 %indvars.iv.next.i90, %wide.trip.count.i
br i1 %exitcond.not.i91, label %ntt.exit95, label %while.cond.preheader.i78, !llvm.loop !17
ntt.exit95: ; preds = %if.end.i89, %ntt.exit.thread
tail call void @ntt_(ptr noundef nonnull @mult.bb_, i32 noundef %add, i32 noundef 0)
br i1 %cmp123, label %for.body17.preheader.new, label %for.end29
for.body17.preheader.new: ; preds = %ntt.exit95
%wide.trip.count133 = zext i32 %mul to i64
br label %for.body17
for.body17: ; preds = %for.body17, %for.body17.preheader.new
%indvars.iv130 = phi i64 [ 0, %for.body17.preheader.new ], [ %indvars.iv.next131.1, %for.body17 ]
%niter = phi i64 [ 0, %for.body17.preheader.new ], [ %niter.next.1, %for.body17 ]
%arrayidx19 = getelementptr inbounds [1048576 x i32], ptr @mult.aa_, i64 0, i64 %indvars.iv130
%9 = load i32, ptr %arrayidx19, align 8, !tbaa !7
%conv = sext i32 %9 to i64
%arrayidx21 = getelementptr inbounds [1048576 x i32], ptr @mult.bb_, i64 0, i64 %indvars.iv130
%10 = load i32, ptr %arrayidx21, align 8, !tbaa !7
%conv22 = sext i32 %10 to i64
%mul23 = mul nsw i64 %conv22, %conv
%rem = srem i64 %mul23, 998244353
%conv24 = trunc i64 %rem to i32
store i32 %conv24, ptr %arrayidx19, align 8, !tbaa !7
%indvars.iv.next131 = or i64 %indvars.iv130, 1
%arrayidx19.1 = getelementptr inbounds [1048576 x i32], ptr @mult.aa_, i64 0, i64 %indvars.iv.next131
%11 = load i32, ptr %arrayidx19.1, align 4, !tbaa !7
%conv.1 = sext i32 %11 to i64
%arrayidx21.1 = getelementptr inbounds [1048576 x i32], ptr @mult.bb_, i64 0, i64 %indvars.iv.next131
%12 = load i32, ptr %arrayidx21.1, align 4, !tbaa !7
%conv22.1 = sext i32 %12 to i64
%mul23.1 = mul nsw i64 %conv22.1, %conv.1
%rem.1 = srem i64 %mul23.1, 998244353
%conv24.1 = trunc i64 %rem.1 to i32
store i32 %conv24.1, ptr %arrayidx19.1, align 4, !tbaa !7
%indvars.iv.next131.1 = add nuw nsw i64 %indvars.iv130, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %wide.trip.count133
br i1 %niter.ncmp.1, label %for.end29, label %for.body17, !llvm.loop !19
for.end29: ; preds = %for.body17, %ntt.exit95
br i1 %cmp25.i, label %while.cond.preheader.preheader.i98, label %ntt.exit117
while.cond.preheader.preheader.i98: ; preds = %for.end29
%wide.trip.count.i99 = zext i32 %shl.i to i64
br label %while.cond.preheader.i100
while.cond.preheader.i100: ; preds = %if.end.i111, %while.cond.preheader.preheader.i98
%indvars.iv.i101 = phi i64 [ 1, %while.cond.preheader.preheader.i98 ], [ %indvars.iv.next.i112, %if.end.i111 ]
%i.027.i102 = phi i32 [ 0, %while.cond.preheader.preheader.i98 ], [ %xor.i107, %if.end.i111 ]
br label %while.cond.i103
while.cond.i103: ; preds = %while.cond.i103, %while.cond.preheader.i100
%b.0.in.i104 = phi i32 [ %b.0.i106, %while.cond.i103 ], [ %shl.i, %while.cond.preheader.i100 ]
%i.1.i105 = phi i32 [ %xor.i107, %while.cond.i103 ], [ %i.027.i102, %while.cond.preheader.i100 ]
%b.0.i106 = ashr i32 %b.0.in.i104, 1
%xor.i107 = xor i32 %i.1.i105, %b.0.i106
%cmp1.i108 = icmp slt i32 %xor.i107, %b.0.i106
br i1 %cmp1.i108, label %while.cond.i103, label %while.end.i109, !llvm.loop !16
while.end.i109: ; preds = %while.cond.i103
%13 = sext i32 %xor.i107 to i64
%cmp3.i110 = icmp sgt i64 %indvars.iv.i101, %13
br i1 %cmp3.i110, label %if.then.i114, label %if.end.i111
if.then.i114: ; preds = %while.end.i109
%arrayidx.i115 = getelementptr inbounds i32, ptr @mult.aa_, i64 %13
%14 = load i32, ptr %arrayidx.i115, align 4, !tbaa !7
%arrayidx5.i116 = getelementptr inbounds i32, ptr @mult.aa_, i64 %indvars.iv.i101
%15 = load i32, ptr %arrayidx5.i116, align 4, !tbaa !7
store i32 %15, ptr %arrayidx.i115, align 4, !tbaa !7
store i32 %14, ptr %arrayidx5.i116, align 4, !tbaa !7
br label %if.end.i111
if.end.i111: ; preds = %if.then.i114, %while.end.i109
%indvars.iv.next.i112 = add nuw nsw i64 %indvars.iv.i101, 1
%exitcond.not.i113 = icmp eq i64 %indvars.iv.next.i112, %wide.trip.count.i99
br i1 %exitcond.not.i113, label %ntt.exit117, label %while.cond.preheader.i100, !llvm.loop !17
ntt.exit117: ; preds = %if.end.i111, %for.end29
tail call void @ntt_(ptr noundef nonnull @mult.aa_, i32 noundef %add, i32 noundef 1)
%cmp32127.not = icmp eq i32 %l, 31
br i1 %cmp32127.not, label %for.end49, label %for.body34.lr.ph
for.body34.lr.ph: ; preds = %ntt.exit117
%idxprom39 = sext i32 %add to i64
%arrayidx40 = getelementptr inbounds [21 x i32], ptr @vv, i64 0, i64 %idxprom39
%smax = tail call i32 @llvm.smax.i32(i32 %shl, i32 1)
%wide.trip.count138 = zext i32 %smax to i64
%xtraiter140 = and i64 %wide.trip.count138, 1
%16 = icmp slt i32 %shl, 2
br i1 %16, label %for.end49.loopexit.unr-lcssa, label %for.body34.lr.ph.new
for.body34.lr.ph.new: ; preds = %for.body34.lr.ph
%unroll_iter142 = and i64 %wide.trip.count138, 2147483646
br label %for.body34
for.body34: ; preds = %for.body34, %for.body34.lr.ph.new
%indvars.iv135 = phi i64 [ 0, %for.body34.lr.ph.new ], [ %indvars.iv.next136.1, %for.body34 ]
%niter143 = phi i64 [ 0, %for.body34.lr.ph.new ], [ %niter143.next.1, %for.body34 ]
%arrayidx36 = getelementptr inbounds [1048576 x i32], ptr @mult.aa_, i64 0, i64 %indvars.iv135
%17 = load i32, ptr %arrayidx36, align 8, !tbaa !7
%conv37 = sext i32 %17 to i64
%18 = load i32, ptr %arrayidx40, align 4, !tbaa !7
%conv41 = sext i32 %18 to i64
%mul42 = mul nsw i64 %conv41, %conv37
%rem43 = srem i64 %mul42, 998244353
%conv44 = trunc i64 %rem43 to i32
%arrayidx46 = getelementptr inbounds i32, ptr %cc, i64 %indvars.iv135
store i32 %conv44, ptr %arrayidx46, align 4, !tbaa !7
%indvars.iv.next136 = or i64 %indvars.iv135, 1
%arrayidx36.1 = getelementptr inbounds [1048576 x i32], ptr @mult.aa_, i64 0, i64 %indvars.iv.next136
%19 = load i32, ptr %arrayidx36.1, align 4, !tbaa !7
%conv37.1 = sext i32 %19 to i64
%20 = load i32, ptr %arrayidx40, align 4, !tbaa !7
%conv41.1 = sext i32 %20 to i64
%mul42.1 = mul nsw i64 %conv41.1, %conv37.1
%rem43.1 = srem i64 %mul42.1, 998244353
%conv44.1 = trunc i64 %rem43.1 to i32
%arrayidx46.1 = getelementptr inbounds i32, ptr %cc, i64 %indvars.iv.next136
store i32 %conv44.1, ptr %arrayidx46.1, align 4, !tbaa !7
%indvars.iv.next136.1 = add nuw nsw i64 %indvars.iv135, 2
%niter143.next.1 = add i64 %niter143, 2
%niter143.ncmp.1 = icmp eq i64 %niter143.next.1, %unroll_iter142
br i1 %niter143.ncmp.1, label %for.end49.loopexit.unr-lcssa, label %for.body34, !llvm.loop !20
for.end49.loopexit.unr-lcssa: ; preds = %for.body34, %for.body34.lr.ph
%indvars.iv135.unr = phi i64 [ 0, %for.body34.lr.ph ], [ %indvars.iv.next136.1, %for.body34 ]
%lcmp.mod141.not = icmp eq i64 %xtraiter140, 0
br i1 %lcmp.mod141.not, label %for.end49, label %for.body34.epil
for.body34.epil: ; preds = %for.end49.loopexit.unr-lcssa
%arrayidx36.epil = getelementptr inbounds [1048576 x i32], ptr @mult.aa_, i64 0, i64 %indvars.iv135.unr
%21 = load i32, ptr %arrayidx36.epil, align 4, !tbaa !7
%conv37.epil = sext i32 %21 to i64
%22 = load i32, ptr %arrayidx40, align 4, !tbaa !7
%conv41.epil = sext i32 %22 to i64
%mul42.epil = mul nsw i64 %conv41.epil, %conv37.epil
%rem43.epil = srem i64 %mul42.epil, 998244353
%conv44.epil = trunc i64 %rem43.epil to i32
%arrayidx46.epil = getelementptr inbounds i32, ptr %cc, i64 %indvars.iv135.unr
store i32 %conv44.epil, ptr %arrayidx46.epil, align 4, !tbaa !7
br label %for.end49
for.end49: ; preds = %for.body34.epil, %for.end49.loopexit.unr-lcssa, %ntt.exit117
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @inv(ptr nocapture noundef readonly %aa, ptr nocapture noundef %bb, i32 noundef %l_) local_unnamed_addr #5 {
entry:
%add = add nsw i32 %l_, 1
%shl = shl nuw i32 1, %add
%conv = sext i32 %shl to i64
%mul = shl nsw i64 %conv, 2
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %bb, i8 0, i64 %mul, i1 false)
store i32 1, ptr %bb, align 4, !tbaa !7
%cmp37 = icmp sgt i32 %l_, 0
br i1 %cmp37, label %for.body, label %for.end21
for.body: ; preds = %entry, %for.end
%l.038 = phi i32 [ %add2, %for.end ], [ 0, %entry ]
%add2 = add nuw nsw i32 %l.038, 1
tail call void @mult(ptr noundef %aa, ptr noundef nonnull %bb, ptr noundef nonnull @inv.cc, i32 noundef %add2)
%shl5 = shl i32 2, %l.038
%cmp635 = icmp sgt i32 %shl5, 0
br i1 %cmp635, label %for.body8.preheader, label %for.end
for.body8.preheader: ; preds = %for.body
%wide.trip.count = zext i32 %shl5 to i64
%min.iters.check = icmp ult i32 %shl5, 8
br i1 %min.iters.check, label %for.body8.preheader42, label %vector.ph
vector.ph: ; preds = %for.body8.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 ]
%0 = getelementptr inbounds [1048576 x i32], ptr @inv.cc, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %0, align 16, !tbaa !7
%1 = getelementptr inbounds i32, ptr %0, i64 4
%wide.load41 = load <4 x i32>, ptr %1, align 16, !tbaa !7
%2 = icmp sgt <4 x i32> %wide.load, zeroinitializer
%3 = icmp sgt <4 x i32> %wide.load41, zeroinitializer
%4 = select <4 x i1> %2, <4 x i32> <i32 998244353, i32 998244353, i32 998244353, i32 998244353>, <4 x i32> zeroinitializer
%5 = select <4 x i1> %3, <4 x i32> <i32 998244353, i32 998244353, i32 998244353, i32 998244353>, <4 x i32> zeroinitializer
%6 = sub <4 x i32> %4, %wide.load
%7 = sub <4 x i32> %5, %wide.load41
store <4 x i32> %6, ptr %0, align 16, !tbaa !7
store <4 x i32> %7, ptr %1, align 16, !tbaa !7
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !21
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body8.preheader42
for.body8.preheader42: ; preds = %for.body8.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body8.preheader ], [ %n.vec, %middle.block ]
br label %for.body8
for.body8: ; preds = %for.body8.preheader42, %for.body8
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body8 ], [ %indvars.iv.ph, %for.body8.preheader42 ]
%arrayidx9 = getelementptr inbounds [1048576 x i32], ptr @inv.cc, i64 0, i64 %indvars.iv
%9 = load i32, ptr %arrayidx9, align 4, !tbaa !7
%cmp12 = icmp sgt i32 %9, 0
%spec.select = select i1 %cmp12, i32 998244353, i32 0
%storemerge = sub i32 %spec.select, %9
store i32 %storemerge, ptr %arrayidx9, align 4, !tbaa !7
%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.body8, !llvm.loop !24
for.end: ; preds = %for.body8, %middle.block, %for.body
%10 = load i32, ptr @inv.cc, align 16, !tbaa !7
%add17 = add nsw i32 %10, 2
%rem = srem i32 %add17, 998244353
store i32 %rem, ptr @inv.cc, align 16, !tbaa !7
tail call void @mult(ptr noundef nonnull %bb, ptr noundef nonnull @inv.cc, ptr noundef nonnull %bb, i32 noundef %add2)
%exitcond40.not = icmp eq i32 %add2, %l_
br i1 %exitcond40.not, label %for.end21, label %for.body, !llvm.loop !25
for.end21: ; preds = %for.end, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a_ = alloca i32, align 4
%a = alloca i32, align 4
%l = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #11
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a_) #11
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #11
tail call void @init()
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m, ptr noundef nonnull %n, ptr noundef nonnull %a_)
%0 = load i32, ptr %a_, align 4
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @main.pp, i8 -1, i64 %mul, i1 false)
call void @llvm.memset.p0.i64(ptr nonnull align 16 @main.qq, i8 -1, i64 %mul, i1 false)
%1 = load i32, ptr %m, align 4, !tbaa !7
%dec123 = add nsw i32 %1, -1
store i32 %dec123, ptr %m, align 4, !tbaa !7
%tobool.not124 = icmp eq i32 %1, 0
br i1 %tobool.not124, label %while.end39, label %while.body
while.body: ; preds = %entry, %while.end
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #11
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %l)
%2 = load i32, ptr %l, align 4, !tbaa !7
%dec5120 = add nsw i32 %2, -1
store i32 %dec5120, ptr %l, align 4, !tbaa !7
%tobool6.not121 = icmp eq i32 %2, 0
br i1 %tobool6.not121, label %while.end, label %while.body7
while.body7: ; preds = %while.body, %if.end38
%p.0122 = phi i32 [ %dec9, %if.end38 ], [ -1, %while.body ]
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%3 = load i32, ptr %a, align 4, !tbaa !7
%dec9 = add nsw i32 %3, -1
store i32 %dec9, ptr %a, align 4, !tbaa !7
%cmp.not = icmp eq i32 %p.0122, -1
br i1 %cmp.not, label %if.end38, label %if.then
if.then: ; preds = %while.body7
%idxprom = sext i32 %dec9 to i64
%arrayidx = getelementptr inbounds [300000 x i32], ptr @main.pp, i64 0, i64 %idxprom
%4 = load i32, ptr %arrayidx, align 4, !tbaa !7
%cmp11.not = icmp eq i32 %4, -1
%cmp15.not = icmp eq i32 %4, %p.0122
%or.cond = select i1 %cmp11.not, i1 true, i1 %cmp15.not
br i1 %or.cond, label %if.else, label %if.then17
if.then17: ; preds = %if.then
%arrayidx19 = getelementptr inbounds [300000 x i8], ptr @main.bad, i64 0, i64 %idxprom
store i8 1, ptr %arrayidx19, align 1, !tbaa !26
br label %if.end
if.else: ; preds = %if.then
store i32 %p.0122, ptr %arrayidx, align 4, !tbaa !7
br label %if.end
if.end: ; preds = %if.else, %if.then17
%idxprom22 = sext i32 %p.0122 to i64
%arrayidx23 = getelementptr inbounds [300000 x i32], ptr @main.qq, i64 0, i64 %idxprom22
%5 = load i32, ptr %arrayidx23, align 4, !tbaa !7
%cmp24.not = icmp eq i32 %5, -1
%cmp29.not = icmp eq i32 %5, %dec9
%or.cond118 = select i1 %cmp24.not, i1 true, i1 %cmp29.not
br i1 %or.cond118, label %if.else34, label %if.then31
if.then31: ; preds = %if.end
%arrayidx33 = getelementptr inbounds [300000 x i8], ptr @main.bad, i64 0, i64 %idxprom22
store i8 1, ptr %arrayidx33, align 1, !tbaa !26
br label %if.end38
if.else34: ; preds = %if.end
store i32 %dec9, ptr %arrayidx23, align 4, !tbaa !7
br label %if.end38
if.end38: ; preds = %if.then31, %if.else34, %while.body7
%6 = load i32, ptr %l, align 4, !tbaa !7
%dec5 = add nsw i32 %6, -1
store i32 %dec5, ptr %l, align 4, !tbaa !7
%tobool6.not = icmp eq i32 %6, 0
br i1 %tobool6.not, label %while.end, label %while.body7, !llvm.loop !27
while.end: ; preds = %if.end38, %while.body
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #11
%7 = load i32, ptr %m, align 4, !tbaa !7
%dec = add nsw i32 %7, -1
store i32 %dec, ptr %m, align 4, !tbaa !7
%tobool.not = icmp eq i32 %7, 0
br i1 %tobool.not, label %while.end39.loopexit, label %while.body, !llvm.loop !28
while.end39.loopexit: ; preds = %while.end
%.pre = load i32, ptr %a_, align 4
br label %while.end39
while.end39: ; preds = %while.end39.loopexit, %entry
%8 = phi i32 [ %.pre, %while.end39.loopexit ], [ %0, %entry ]
store i32 1, ptr @main.aa, align 16, !tbaa !7
%cmp40127 = icmp sgt i32 %8, 0
br i1 %cmp40127, label %for.body.preheader, label %while.cond69.preheader
for.body.preheader: ; preds = %while.end39
%wide.trip.count = zext i32 %8 to i64
br label %for.body
while.cond69.preheader: ; preds = %for.inc66, %while.end39
%storemerge.lcssa = phi i32 [ 0, %while.end39 ], [ %8, %for.inc66 ]
store i32 %storemerge.lcssa, ptr %a, align 4, !tbaa !7
%9 = load i32, ptr %n, align 4, !tbaa !7
%invariant.smax = call i32 @llvm.smax.i32(i32 %9, i32 %8)
br label %while.cond69
for.body: ; preds = %for.body.preheader, %for.inc66
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc66 ]
%arrayidx43 = getelementptr inbounds [300000 x i32], ptr @main.pp, i64 0, i64 %indvars.iv
%10 = load i32, ptr %arrayidx43, align 4, !tbaa !7
%cmp44 = icmp eq i32 %10, -1
br i1 %cmp44, label %land.rhs.preheader, label %for.inc66
land.rhs.preheader: ; preds = %for.body
%11 = trunc i64 %indvars.iv to i32
br label %land.rhs
land.rhs: ; preds = %land.rhs.preheader, %for.body53
%k.0126 = phi i32 [ %inc, %for.body53 ], [ 0, %land.rhs.preheader ]
%b.0125 = phi i32 [ %13, %for.body53 ], [ %11, %land.rhs.preheader ]
%idxprom50 = sext i32 %b.0125 to i64
%arrayidx51 = getelementptr inbounds [300000 x i8], ptr @main.bad, i64 0, i64 %idxprom50
%12 = load i8, ptr %arrayidx51, align 1, !tbaa !26
%tobool52.not = icmp eq i8 %12, 0
br i1 %tobool52.not, label %for.body53, label %for.inc66
for.body53: ; preds = %land.rhs
%arrayidx55 = getelementptr inbounds [300000 x i32], ptr @main.pp, i64 0, i64 %idxprom50
store i32 -2, ptr %arrayidx55, align 4, !tbaa !7
%inc = add nuw nsw i32 %k.0126, 1
%arrayidx57 = getelementptr inbounds [300000 x i32], ptr @main.qq, i64 0, i64 %idxprom50
%13 = load i32, ptr %arrayidx57, align 4, !tbaa !7
%cond = icmp eq i32 %13, -1
br i1 %cond, label %if.then60, label %land.rhs, !llvm.loop !29
if.then60: ; preds = %for.body53
%idxprom61 = zext i32 %inc to i64
%arrayidx62 = getelementptr inbounds [1048576 x i32], ptr @main.aa, i64 0, i64 %idxprom61
%14 = load i32, ptr %arrayidx62, align 4, !tbaa !7
%dec63 = add nsw i32 %14, -1
store i32 %dec63, ptr %arrayidx62, align 4, !tbaa !7
br label %for.inc66
for.inc66: ; preds = %land.rhs, %for.body, %if.then60
%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 %while.cond69.preheader, label %for.body, !llvm.loop !30
while.cond69: ; preds = %while.cond69, %while.cond69.preheader
%l_.0 = phi i32 [ %inc76, %while.cond69 ], [ 0, %while.cond69.preheader ]
%shl = shl nuw i32 1, %l_.0
%.not = icmp sgt i32 %shl, %invariant.smax
%inc76 = add nuw nsw i32 %l_.0, 1
br i1 %.not, label %for.cond79.preheader, label %while.cond69, !llvm.loop !31
for.cond79.preheader: ; preds = %while.cond69
%cmp80130.not = icmp eq i32 %l_.0, 31
br i1 %cmp80130.not, label %for.end93, label %for.body82.preheader
for.body82.preheader: ; preds = %for.cond79.preheader
%smax = call i32 @llvm.smax.i32(i32 %shl, i32 1)
%wide.trip.count136 = zext i32 %smax to i64
%min.iters.check = icmp ult i32 %smax, 8
br i1 %min.iters.check, label %for.body82.preheader167, label %vector.ph
vector.ph: ; preds = %for.body82.preheader
%n.vec = and i64 %wide.trip.count136, 2147483640
br label %vector.body
vector.body: ; preds = %pred.store.continue153, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue153 ]
%15 = or i64 %index, 4
%16 = getelementptr inbounds [1048576 x i32], ptr @main.aa, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %16, align 16, !tbaa !7
%17 = getelementptr inbounds i32, ptr %16, i64 4
%wide.load139 = load <4 x i32>, ptr %17, align 16, !tbaa !7
%18 = icmp slt <4 x i32> %wide.load, zeroinitializer
%19 = icmp slt <4 x i32> %wide.load139, zeroinitializer
%20 = extractelement <4 x i1> %18, i64 0
br i1 %20, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body
%21 = getelementptr inbounds [1048576 x i32], ptr @main.aa, i64 0, i64 %index
%22 = extractelement <4 x i32> %wide.load, i64 0
%23 = add nsw i32 %22, 998244353
store i32 %23, ptr %21, align 16, !tbaa !7
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body
%24 = extractelement <4 x i1> %18, i64 1
br i1 %24, label %pred.store.if140, label %pred.store.continue141
pred.store.if140: ; preds = %pred.store.continue
%25 = or i64 %index, 1
%26 = getelementptr inbounds [1048576 x i32], ptr @main.aa, i64 0, i64 %25
%27 = extractelement <4 x i32> %wide.load, i64 1
%28 = add nsw i32 %27, 998244353
store i32 %28, ptr %26, align 4, !tbaa !7
br label %pred.store.continue141
pred.store.continue141: ; preds = %pred.store.if140, %pred.store.continue
%29 = extractelement <4 x i1> %18, i64 2
br i1 %29, label %pred.store.if142, label %pred.store.continue143
pred.store.if142: ; preds = %pred.store.continue141
%30 = or i64 %index, 2
%31 = getelementptr inbounds [1048576 x i32], ptr @main.aa, i64 0, i64 %30
%32 = extractelement <4 x i32> %wide.load, i64 2
%33 = add nsw i32 %32, 998244353
store i32 %33, ptr %31, align 8, !tbaa !7
br label %pred.store.continue143
pred.store.continue143: ; preds = %pred.store.if142, %pred.store.continue141
%34 = extractelement <4 x i1> %18, i64 3
br i1 %34, label %pred.store.if144, label %pred.store.continue145
pred.store.if144: ; preds = %pred.store.continue143
%35 = or i64 %index, 3
%36 = getelementptr inbounds [1048576 x i32], ptr @main.aa, i64 0, i64 %35
%37 = extractelement <4 x i32> %wide.load, i64 3
%38 = add nsw i32 %37, 998244353
store i32 %38, ptr %36, align 4, !tbaa !7
br label %pred.store.continue145
pred.store.continue145: ; preds = %pred.store.if144, %pred.store.continue143
%39 = extractelement <4 x i1> %19, i64 0
br i1 %39, label %pred.store.if146, label %pred.store.continue147
pred.store.if146: ; preds = %pred.store.continue145
%40 = getelementptr inbounds [1048576 x i32], ptr @main.aa, i64 0, i64 %15
%41 = extractelement <4 x i32> %wide.load139, i64 0
%42 = add nsw i32 %41, 998244353
store i32 %42, ptr %40, align 16, !tbaa !7
br label %pred.store.continue147
pred.store.continue147: ; preds = %pred.store.if146, %pred.store.continue145
%43 = extractelement <4 x i1> %19, i64 1
br i1 %43, label %pred.store.if148, label %pred.store.continue149
pred.store.if148: ; preds = %pred.store.continue147
%44 = or i64 %index, 5
%45 = getelementptr inbounds [1048576 x i32], ptr @main.aa, i64 0, i64 %44
%46 = extractelement <4 x i32> %wide.load139, i64 1
%47 = add nsw i32 %46, 998244353
store i32 %47, ptr %45, align 4, !tbaa !7
br label %pred.store.continue149
pred.store.continue149: ; preds = %pred.store.if148, %pred.store.continue147
%48 = extractelement <4 x i1> %19, i64 2
br i1 %48, label %pred.store.if150, label %pred.store.continue151
pred.store.if150: ; preds = %pred.store.continue149
%49 = or i64 %index, 6
%50 = getelementptr inbounds [1048576 x i32], ptr @main.aa, i64 0, i64 %49
%51 = extractelement <4 x i32> %wide.load139, i64 2
%52 = add nsw i32 %51, 998244353
store i32 %52, ptr %50, align 8, !tbaa !7
br label %pred.store.continue151
pred.store.continue151: ; preds = %pred.store.if150, %pred.store.continue149
%53 = extractelement <4 x i1> %19, i64 3
br i1 %53, label %pred.store.if152, label %pred.store.continue153
pred.store.if152: ; preds = %pred.store.continue151
%54 = or i64 %index, 7
%55 = getelementptr inbounds [1048576 x i32], ptr @main.aa, i64 0, i64 %54
%56 = extractelement <4 x i32> %wide.load139, i64 3
%57 = add nsw i32 %56, 998244353
store i32 %57, ptr %55, align 4, !tbaa !7
br label %pred.store.continue153
pred.store.continue153: ; preds = %pred.store.if152, %pred.store.continue151
%index.next = add nuw i64 %index, 8
%58 = icmp eq i64 %index.next, %n.vec
br i1 %58, label %middle.block, label %vector.body, !llvm.loop !32
middle.block: ; preds = %pred.store.continue153
%cmp.n.not = icmp eq i64 %n.vec, 0
br i1 %cmp.n.not, label %for.body82.preheader167, label %for.end93
for.body82.preheader167: ; preds = %for.body82.preheader, %middle.block
%indvars.iv133.ph = phi i64 [ 0, %for.body82.preheader ], [ %n.vec, %middle.block ]
br label %for.body82
for.body82: ; preds = %for.body82.preheader167, %for.inc91
%indvars.iv133 = phi i64 [ %indvars.iv.next134, %for.inc91 ], [ %indvars.iv133.ph, %for.body82.preheader167 ]
%arrayidx84 = getelementptr inbounds [1048576 x i32], ptr @main.aa, i64 0, i64 %indvars.iv133
%59 = load i32, ptr %arrayidx84, align 4, !tbaa !7
%cmp85 = icmp slt i32 %59, 0
br i1 %cmp85, label %if.then87, label %for.inc91
if.then87: ; preds = %for.body82
%add = add nsw i32 %59, 998244353
store i32 %add, ptr %arrayidx84, align 4, !tbaa !7
br label %for.inc91
for.inc91: ; preds = %for.body82, %if.then87
%indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
%exitcond137.not = icmp eq i64 %indvars.iv.next134, %wide.trip.count136
br i1 %exitcond137.not, label %for.end93, label %for.body82, !llvm.loop !33
for.end93: ; preds = %for.inc91, %middle.block, %for.cond79.preheader
%shl.i = shl i32 2, %l_.0
%conv.i = sext i32 %shl.i to i64
%mul.i = shl nsw i64 %conv.i, 2
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @main.bb, i8 0, i64 %mul.i, i1 false)
store i32 1, ptr @main.bb, align 16, !tbaa !7
%cmp37.i.not = icmp eq i32 %l_.0, 0
br i1 %cmp37.i.not, label %inv.exit, label %for.body.i
for.body.i: ; preds = %for.end93, %for.end.i
%l.038.i = phi i32 [ %add2.i, %for.end.i ], [ 0, %for.end93 ]
%add2.i = add nuw nsw i32 %l.038.i, 1
call void @mult(ptr noundef nonnull @main.aa, ptr noundef nonnull @main.bb, ptr noundef nonnull @inv.cc, i32 noundef %add2.i)
%shl5.i = shl i32 2, %l.038.i
%cmp635.i = icmp sgt i32 %shl5.i, 0
br i1 %cmp635.i, label %for.body8.preheader.i, label %for.end.i
for.body8.preheader.i: ; preds = %for.body.i
%wide.trip.count.i = zext i32 %shl5.i to i64
%min.iters.check156 = icmp ult i32 %shl5.i, 8
br i1 %min.iters.check156, label %for.body8.i.preheader, label %vector.ph157
vector.ph157: ; preds = %for.body8.preheader.i
%n.vec159 = and i64 %wide.trip.count.i, 4294967288
br label %vector.body162
vector.body162: ; preds = %vector.body162, %vector.ph157
%index163 = phi i64 [ 0, %vector.ph157 ], [ %index.next166, %vector.body162 ]
%60 = getelementptr inbounds [1048576 x i32], ptr @inv.cc, i64 0, i64 %index163
%wide.load164 = load <4 x i32>, ptr %60, align 16, !tbaa !7
%61 = getelementptr inbounds i32, ptr %60, i64 4
%wide.load165 = load <4 x i32>, ptr %61, align 16, !tbaa !7
%62 = icmp sgt <4 x i32> %wide.load164, zeroinitializer
%63 = icmp sgt <4 x i32> %wide.load165, zeroinitializer
%64 = select <4 x i1> %62, <4 x i32> <i32 998244353, i32 998244353, i32 998244353, i32 998244353>, <4 x i32> zeroinitializer
%65 = select <4 x i1> %63, <4 x i32> <i32 998244353, i32 998244353, i32 998244353, i32 998244353>, <4 x i32> zeroinitializer
%66 = sub <4 x i32> %64, %wide.load164
%67 = sub <4 x i32> %65, %wide.load165
store <4 x i32> %66, ptr %60, align 16, !tbaa !7
store <4 x i32> %67, ptr %61, align 16, !tbaa !7
%index.next166 = add nuw i64 %index163, 8
%68 = icmp eq i64 %index.next166, %n.vec159
br i1 %68, label %middle.block154, label %vector.body162, !llvm.loop !34
middle.block154: ; preds = %vector.body162
%cmp.n161 = icmp eq i64 %n.vec159, %wide.trip.count.i
br i1 %cmp.n161, label %for.end.i, label %for.body8.i.preheader
for.body8.i.preheader: ; preds = %for.body8.preheader.i, %middle.block154
%indvars.iv.i.ph = phi i64 [ 0, %for.body8.preheader.i ], [ %n.vec159, %middle.block154 ]
br label %for.body8.i
for.body8.i: ; preds = %for.body8.i.preheader, %for.body8.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body8.i ], [ %indvars.iv.i.ph, %for.body8.i.preheader ]
%arrayidx9.i = getelementptr inbounds [1048576 x i32], ptr @inv.cc, i64 0, i64 %indvars.iv.i
%69 = load i32, ptr %arrayidx9.i, align 4, !tbaa !7
%cmp12.i = icmp sgt i32 %69, 0
%spec.select.i = select i1 %cmp12.i, i32 998244353, i32 0
%storemerge.i = sub i32 %spec.select.i, %69
store i32 %storemerge.i, ptr %arrayidx9.i, align 4, !tbaa !7
%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 %for.end.i, label %for.body8.i, !llvm.loop !35
for.end.i: ; preds = %for.body8.i, %middle.block154, %for.body.i
%70 = load i32, ptr @inv.cc, align 16, !tbaa !7
%add17.i = add nsw i32 %70, 2
%rem.i = srem i32 %add17.i, 998244353
store i32 %rem.i, ptr @inv.cc, align 16, !tbaa !7
call void @mult(ptr noundef nonnull @main.bb, ptr noundef nonnull @inv.cc, ptr noundef nonnull @main.bb, i32 noundef %add2.i)
%exitcond40.not.i = icmp eq i32 %add2.i, %l_.0
br i1 %exitcond40.not.i, label %inv.exit.loopexit, label %for.body.i, !llvm.loop !25
inv.exit.loopexit: ; preds = %for.end.i
%.pre138 = load i32, ptr %n, align 4, !tbaa !7
br label %inv.exit
inv.exit: ; preds = %inv.exit.loopexit, %for.end93
%71 = phi i32 [ %.pre138, %inv.exit.loopexit ], [ %9, %for.end93 ]
%idxprom94 = sext i32 %71 to i64
%arrayidx95 = getelementptr inbounds [1048576 x i32], ptr @main.bb, i64 0, i64 %idxprom94
%72 = load i32, ptr %arrayidx95, align 4, !tbaa !7
%call96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %72)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a_) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #11
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #9
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 memory(write, argmem: none, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 nosync nounwind memory(read, 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 #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { nofree nounwind "no-trapping-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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !6}
!20 = distinct !{!20, !6}
!21 = distinct !{!21, !6, !22, !23}
!22 = !{!"llvm.loop.isvectorized", i32 1}
!23 = !{!"llvm.loop.unroll.runtime.disable"}
!24 = distinct !{!24, !6, !23, !22}
!25 = distinct !{!25, !6}
!26 = !{!9, !9, i64 0}
!27 = distinct !{!27, !6}
!28 = distinct !{!28, !6}
!29 = distinct !{!29, !6}
!30 = distinct !{!30, !6}
!31 = distinct !{!31, !6}
!32 = distinct !{!32, !6, !22, !23}
!33 = distinct !{!33, !6, !23, !22}
!34 = distinct !{!34, !6, !22, !23}
!35 = distinct !{!35, !6, !23, !22}
|
#include<stdio.h>
#include<stdlib.h>
#define size 100001
int N,M;
int*dist[size];
int city[size];
int qu[size];
int dist_s[size];
void set(){
int a,b;
for(int i=0;i<N;i++){
city[i]=-1;
dist_s[i]=0;
};
city[0]=0;
for(int i=0;i<M;i++){
scanf("%d %d",&a,&b);
a--;b--;
dist[a]=realloc(dist[a],sizeof(int)*(dist_s[a]+1));
dist[a][dist_s[a]]=b;//得出由a城到b城的所有可能路径
dist_s[a]++;
dist[b]=realloc(dist[b],sizeof(int)*(dist_s[b]+1));
dist[b][dist_s[b]]=a;
dist_s[b]++;
};
};
void sys(){
int tar=0,nm=0,ji=0;
while(1){
for(int i=0;i<dist_s[tar];i++){//到目标城市的所有可能
if(city[dist[tar][i]]!=-1)continue;
city[dist[tar][i]]=tar+1;//目标城市深度
qu[nm]=dist[tar][i];//到达深度的各城市队列
nm++;
};
if(nm==ji)break;
tar=qu[ji];//计算队列中第一个城市
ji++;
};
};
int main(void){
scanf("%d%d",&N,&M);
set();
sys();
printf("Yes\n");
for(int i=1;i<N;i++){
printf("%d\n",city[i]);
};
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147373/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147373/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@N = dso_local global i32 0, align 4
@city = dso_local local_unnamed_addr global [100001 x i32] zeroinitializer, align 16
@dist_s = dso_local local_unnamed_addr global [100001 x i32] zeroinitializer, align 16
@M = dso_local global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@dist = dso_local local_unnamed_addr global [100001 x ptr] zeroinitializer, align 16
@qu = dso_local local_unnamed_addr global [100001 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nounwind uwtable
define dso_local void @set() 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) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #7
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp51 = icmp sgt i32 %0, 0
br i1 %cmp51, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @city, i8 -1, i64 %2, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @dist_s, i8 0, i64 %2, i1 false), !tbaa !5
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body.preheader, %entry
store i32 0, ptr @city, align 16, !tbaa !5
%3 = load i32, ptr @M, align 4, !tbaa !5
%cmp553 = icmp sgt i32 %3, 0
br i1 %cmp553, label %for.body7, label %for.cond.cleanup6
for.cond.cleanup6: ; preds = %for.body7, %for.cond.cleanup
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #7
ret void
for.body7: ; preds = %for.cond.cleanup, %for.body7
%i3.054 = phi i32 [ %inc45, %for.body7 ], [ 0, %for.cond.cleanup ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%4 = load i32, ptr %a, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %a, align 4, !tbaa !5
%5 = load i32, ptr %b, align 4, !tbaa !5
%dec8 = add nsw i32 %5, -1
store i32 %dec8, ptr %b, align 4, !tbaa !5
%idxprom9 = sext i32 %dec to i64
%arrayidx10 = getelementptr inbounds [100001 x ptr], ptr @dist, i64 0, i64 %idxprom9
%6 = load ptr, ptr %arrayidx10, align 8, !tbaa !9
%arrayidx12 = getelementptr inbounds [100001 x i32], ptr @dist_s, i64 0, i64 %idxprom9
%7 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%add = add nsw i32 %7, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 2
%call13 = call ptr @realloc(ptr noundef %6, i64 noundef %mul) #8
%8 = load i32, ptr %a, align 4, !tbaa !5
%idxprom14 = sext i32 %8 to i64
%arrayidx15 = getelementptr inbounds [100001 x ptr], ptr @dist, i64 0, i64 %idxprom14
store ptr %call13, ptr %arrayidx15, align 8, !tbaa !9
%9 = load i32, ptr %b, align 4, !tbaa !5
%arrayidx19 = getelementptr inbounds [100001 x i32], ptr @dist_s, i64 0, i64 %idxprom14
%10 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%idxprom20 = sext i32 %10 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %call13, i64 %idxprom20
store i32 %9, ptr %arrayidx21, align 4, !tbaa !5
%inc24 = add nsw i32 %10, 1
store i32 %inc24, ptr %arrayidx19, align 4, !tbaa !5
%idxprom25 = sext i32 %9 to i64
%arrayidx26 = getelementptr inbounds [100001 x ptr], ptr @dist, i64 0, i64 %idxprom25
%11 = load ptr, ptr %arrayidx26, align 8, !tbaa !9
%arrayidx28 = getelementptr inbounds [100001 x i32], ptr @dist_s, i64 0, i64 %idxprom25
%12 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%add29 = add nsw i32 %12, 1
%conv30 = sext i32 %add29 to i64
%mul31 = shl nsw i64 %conv30, 2
%call32 = call ptr @realloc(ptr noundef %11, i64 noundef %mul31) #8
%13 = load i32, ptr %b, align 4, !tbaa !5
%idxprom33 = sext i32 %13 to i64
%arrayidx34 = getelementptr inbounds [100001 x ptr], ptr @dist, i64 0, i64 %idxprom33
store ptr %call32, ptr %arrayidx34, align 8, !tbaa !9
%14 = load i32, ptr %a, align 4, !tbaa !5
%arrayidx38 = getelementptr inbounds [100001 x i32], ptr @dist_s, i64 0, i64 %idxprom33
%15 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%idxprom39 = sext i32 %15 to i64
%arrayidx40 = getelementptr inbounds i32, ptr %call32, i64 %idxprom39
store i32 %14, ptr %arrayidx40, align 4, !tbaa !5
%inc43 = add nsw i32 %15, 1
store i32 %inc43, ptr %arrayidx38, align 4, !tbaa !5
%inc45 = add nuw nsw i32 %i3.054, 1
%16 = load i32, ptr @M, align 4, !tbaa !5
%cmp5 = icmp slt i32 %inc45, %16
br i1 %cmp5, label %for.body7, label %for.cond.cleanup6, !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: 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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local void @sys() local_unnamed_addr #4 {
entry:
br label %while.cond
while.cond: ; preds = %if.end23, %entry
%indvars.iv43 = phi i64 [ %indvars.iv.next44, %if.end23 ], [ 0, %entry ]
%tar.0 = phi i32 [ %6, %if.end23 ], [ 0, %entry ]
%nm.0 = phi i32 [ %nm.1.lcssa, %if.end23 ], [ 0, %entry ]
%idxprom = sext i32 %tar.0 to i64
%arrayidx = getelementptr inbounds [100001 x i32], ptr @dist_s, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.body.lr.ph, label %for.cond.cleanup
for.body.lr.ph: ; preds = %while.cond
%arrayidx2 = getelementptr inbounds [100001 x ptr], ptr @dist, i64 0, i64 %idxprom
%1 = load ptr, ptr %arrayidx2, align 8, !tbaa !9
%add = add nsw i32 %tar.0, 1
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.cond.cleanup: ; preds = %for.inc, %while.cond
%nm.1.lcssa = phi i32 [ %nm.0, %while.cond ], [ %nm.2, %for.inc ]
%2 = zext i32 %nm.1.lcssa to i64
%cmp21 = icmp eq i64 %indvars.iv43, %2
br i1 %cmp21, label %while.end, label %if.end23
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%nm.140 = phi i32 [ %nm.0, %for.body.lr.ph ], [ %nm.2, %for.inc ]
%arrayidx4 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv
%3 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%idxprom5 = sext i32 %3 to i64
%arrayidx6 = getelementptr inbounds [100001 x i32], ptr @city, i64 0, i64 %idxprom5
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7.not = icmp eq i32 %4, -1
br i1 %cmp7.not, label %if.end, label %for.inc
if.end: ; preds = %for.body
store i32 %add, ptr %arrayidx6, align 4, !tbaa !5
%5 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%idxprom18 = sext i32 %nm.140 to i64
%arrayidx19 = getelementptr inbounds [100001 x i32], ptr @qu, i64 0, i64 %idxprom18
store i32 %5, ptr %arrayidx19, align 4, !tbaa !5
%inc = add nsw i32 %nm.140, 1
br label %for.inc
for.inc: ; preds = %for.body, %if.end
%nm.2 = phi i32 [ %nm.140, %for.body ], [ %inc, %if.end ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !13
if.end23: ; preds = %for.cond.cleanup
%arrayidx25 = getelementptr inbounds [100001 x i32], ptr @qu, i64 0, i64 %indvars.iv43
%6 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%indvars.iv.next44 = add nuw i64 %indvars.iv43, 1
br label %while.cond
while.end: ; preds = %for.cond.cleanup
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @N, ptr noundef nonnull @M)
tail call void @set()
br label %while.cond.i
while.cond.i: ; preds = %if.end23.i, %entry
%indvars.iv43.i = phi i64 [ %indvars.iv.next44.i, %if.end23.i ], [ 0, %entry ]
%tar.0.i = phi i32 [ %6, %if.end23.i ], [ 0, %entry ]
%nm.0.i = phi i32 [ %nm.1.lcssa.i, %if.end23.i ], [ 0, %entry ]
%idxprom.i = sext i32 %tar.0.i to i64
%arrayidx.i = getelementptr inbounds [100001 x i32], ptr @dist_s, i64 0, i64 %idxprom.i
%0 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp39.i = icmp sgt i32 %0, 0
br i1 %cmp39.i, label %for.body.lr.ph.i, label %for.cond.cleanup.i
for.body.lr.ph.i: ; preds = %while.cond.i
%arrayidx2.i = getelementptr inbounds [100001 x ptr], ptr @dist, i64 0, i64 %idxprom.i
%1 = load ptr, ptr %arrayidx2.i, align 8, !tbaa !9
%add.i = add nsw i32 %tar.0.i, 1
%wide.trip.count.i = zext i32 %0 to i64
br label %for.body.i
for.cond.cleanup.i: ; preds = %for.inc.i, %while.cond.i
%nm.1.lcssa.i = phi i32 [ %nm.0.i, %while.cond.i ], [ %nm.2.i, %for.inc.i ]
%2 = zext i32 %nm.1.lcssa.i to i64
%cmp21.i = icmp eq i64 %indvars.iv43.i, %2
br i1 %cmp21.i, label %sys.exit, label %if.end23.i
for.body.i: ; preds = %for.inc.i, %for.body.lr.ph.i
%indvars.iv.i = phi i64 [ 0, %for.body.lr.ph.i ], [ %indvars.iv.next.i, %for.inc.i ]
%nm.140.i = phi i32 [ %nm.0.i, %for.body.lr.ph.i ], [ %nm.2.i, %for.inc.i ]
%arrayidx4.i = getelementptr inbounds i32, ptr %1, i64 %indvars.iv.i
%3 = load i32, ptr %arrayidx4.i, align 4, !tbaa !5
%idxprom5.i = sext i32 %3 to i64
%arrayidx6.i = getelementptr inbounds [100001 x i32], ptr @city, i64 0, i64 %idxprom5.i
%4 = load i32, ptr %arrayidx6.i, align 4, !tbaa !5
%cmp7.not.i = icmp eq i32 %4, -1
br i1 %cmp7.not.i, label %if.end.i, label %for.inc.i
if.end.i: ; preds = %for.body.i
store i32 %add.i, ptr %arrayidx6.i, align 4, !tbaa !5
%5 = load i32, ptr %arrayidx4.i, align 4, !tbaa !5
%idxprom18.i = sext i32 %nm.140.i to i64
%arrayidx19.i = getelementptr inbounds [100001 x i32], ptr @qu, i64 0, i64 %idxprom18.i
store i32 %5, ptr %arrayidx19.i, align 4, !tbaa !5
%inc.i = add nsw i32 %nm.140.i, 1
br label %for.inc.i
for.inc.i: ; preds = %if.end.i, %for.body.i
%nm.2.i = phi i32 [ %nm.140.i, %for.body.i ], [ %inc.i, %if.end.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %for.cond.cleanup.i, label %for.body.i, !llvm.loop !13
if.end23.i: ; preds = %for.cond.cleanup.i
%arrayidx25.i = getelementptr inbounds [100001 x i32], ptr @qu, i64 0, i64 %indvars.iv43.i
%6 = load i32, ptr %arrayidx25.i, align 4, !tbaa !5
%indvars.iv.next44.i = add nuw i64 %indvars.iv43.i, 1
br label %while.cond.i
sys.exit: ; preds = %for.cond.cleanup.i
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
%7 = load i32, ptr @N, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %7, 1
br i1 %cmp5, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %sys.exit
ret i32 0
for.body: ; preds = %sys.exit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %sys.exit ]
%arrayidx = getelementptr inbounds [100001 x i32], ptr @city, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %8)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = load i32, ptr @N, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp = icmp slt i64 %indvars.iv.next, %10
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !14
}
; 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 #5
; 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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 nounwind willreturn allockind("realloc") allocsize(1) 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 #4 = { nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(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, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
|
#include<stdio.h>
#include<stdlib.h>
#define S 1000000000
#define N 500000
int count =0;
void merge(int A[], int left, int mid, int right)
{
int n1,n2,i,j,k,*L,*R;
n1 = mid - left;
n2 = right - mid;
L = (int *)malloc(sizeof(int)*(n1+1));
R = (int *)malloc(sizeof(int)*(n2+1));
for(i = 0; i<=n1-1; i++){
L[i] = A[left + i];
}
for(i = 0; i<=n2-1; i++){
R[i] = A[mid + i];
}
L[n1] = S;
R[n2] = S;
i = 0;
j = 0;
for(k = left; k<=right-1; k++){
if (L[i] <= R[j]){
A[k] = L[i];
i = i + 1;
count++;
}
else{
A[k] = R[j];
j = j + 1;
count++;
}
}
free(L);
free(R);
}
void mergeSort(int A[], int left, int right)
{
int i,mid;
if (left+1 < right){
mid = (left + right)/2;
mergeSort(A, left, mid);
mergeSort(A, mid, right);
merge(A, left, mid, right);
}
}
int main()
{
int i,n,A[N];
scanf("%d",&n);
for(i=0; i<n; i++){
scanf("%d",&A[i]);
}
mergeSort(A,0,n);
for(i=0; i<n-1; i++){
printf("%d ",A[i]);
}
printf("%d\n",A[n-1]);
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147416/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147416/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \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 void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 2
%call = tail call noalias ptr @malloc(i64 noundef %mul) #7
%add2 = add nsw i32 %sub1, 1
%conv3 = sext i32 %add2 to i64
%mul4 = shl nsw i64 %conv3, 2
%call5 = tail call noalias ptr @malloc(i64 noundef %mul4) #7
%cmp.not.not90 = icmp sgt i32 %sub, 0
br i1 %cmp.not.not90, label %for.body.preheader, label %for.cond11.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond11.preheader
for.cond11.preheader: ; preds = %for.body.preheader, %entry
%cmp13.not.not92 = icmp sgt i32 %sub1, 0
br i1 %cmp13.not.not92, label %for.body15.preheader, label %for.end23
for.body15.preheader: ; preds = %for.cond11.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep100 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call5, ptr noundef nonnull align 4 dereferenceable(1) %scevgep100, i64 %13, i1 false), !tbaa !5
br label %for.end23
for.end23: ; preds = %for.body15.preheader, %for.cond11.preheader
%idxprom24 = sext i32 %sub to i64
%arrayidx25 = getelementptr inbounds i32, ptr %call, i64 %idxprom24
store i32 1000000000, ptr %arrayidx25, align 4, !tbaa !5
%idxprom26 = sext i32 %sub1 to i64
%arrayidx27 = getelementptr inbounds i32, ptr %call5, i64 %idxprom26
store i32 1000000000, ptr %arrayidx27, align 4, !tbaa !5
%cmp30.not.not94 = icmp slt i32 %left, %right
br i1 %cmp30.not.not94, label %for.body32.preheader, label %for.end53
for.body32.preheader: ; preds = %for.end23
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body32
for.body32: ; preds = %for.body32.preheader, %for.body32
%indvars.iv = phi i64 [ %14, %for.body32.preheader ], [ %indvars.iv.next, %for.body32 ]
%i.297 = phi i32 [ 0, %for.body32.preheader ], [ %i.3, %for.body32 ]
%j.096 = phi i32 [ 0, %for.body32.preheader ], [ %j.1, %for.body32 ]
%idxprom33 = zext i32 %i.297 to i64
%arrayidx34 = getelementptr inbounds i32, ptr %call, i64 %idxprom33
%15 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%idxprom35 = zext i32 %j.096 to i64
%arrayidx36 = getelementptr inbounds i32, ptr %call5, i64 %idxprom35
%16 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%cmp37.not = icmp sgt i32 %15, %16
%.sink = tail call i32 @llvm.smin.i32(i32 %15, i32 %16)
%add49 = zext i1 %cmp37.not to i32
%j.1 = add nuw nsw i32 %j.096, %add49
%not.cmp37.not = xor i1 %cmp37.not, true
%add43 = zext i1 %not.cmp37.not to i32
%i.3 = add nuw nsw i32 %i.297, %add43
%17 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %17, align 4
%storemerge.in = load i32, ptr @count, align 4, !tbaa !5
%storemerge = add nsw i32 %storemerge.in, 1
store i32 %storemerge, ptr @count, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end53, label %for.body32, !llvm.loop !9
for.end53: ; preds = %for.body32, %for.end23
tail call void @free(ptr noundef nonnull %call) #8
tail call void @free(ptr noundef nonnull %call5) #8
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 allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) 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 #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: nounwind uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%A = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp324 = icmp sgt i32 %3, 1
br i1 %cmp324, label %for.body4, label %for.end.for.end10_crit_edge
for.end.for.end10_crit_edge: ; preds = %for.end
%sub23 = add nsw i32 %3, -1
%.pre = sext i32 %sub23 to i64
br label %for.end10
for.body4: ; preds = %for.end, %for.body4
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.body4 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv30
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next31, %6
br i1 %cmp3, label %for.body4, label %for.end10, !llvm.loop !12
for.end10: ; preds = %for.body4, %for.end.for.end10_crit_edge
%idxprom12.pre-phi = phi i64 [ %.pre, %for.end.for.end10_crit_edge ], [ %6, %for.body4 ]
%arrayidx13 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %idxprom12.pre-phi
%7 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%8 = load i32, ptr @count, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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>
void OUT(int n) {
if (n == 1) {
printf("()");
return;
} else {
OUT(n - 1);
printf("(");
printf(")\n");
printf("(");
OUT(n - 1);
printf(")\n");
printf("(");
printf(")");
OUT(n - 1);
printf("\n");
}
return;
}
int main() {
int t;
int n;
int x;
int i, j, k, ii;
scanf("%d", &t);
for (i = 0; i < t; i++) {
scanf("%d", &n);
for (x = 1; x <= n; x++) {//���n��
for(j = n; j >= x + 1; j--) {
printf("(");
}
for (ii = 1; ii <= x; ii++) {
printf("()");
}
for(k = n; k >= x + 1; k--) {
printf(")");
}
printf("\n");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14746/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14746/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"()\00", align 1
@.str.5 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str.6 = private unnamed_addr constant [2 x i8] c")\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @OUT(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %n, 1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
br label %common.ret18
common.ret18: ; preds = %if.else, %if.then
ret void
if.else: ; preds = %entry
%sub = add nsw i32 %n, -1
tail call void @OUT(i32 noundef %sub)
%putchar = tail call i32 @putchar(i32 40)
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%putchar13 = tail call i32 @putchar(i32 40)
tail call void @OUT(i32 noundef %sub)
%puts14 = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%putchar15 = tail call i32 @putchar(i32 40)
%putchar16 = tail call i32 @putchar(i32 41)
tail call void @OUT(i32 noundef %sub)
%putchar17 = tail call i32 @putchar(i32 10)
br label %common.ret18
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp47 = icmp sgt i32 %0, 0
br i1 %cmp47, label %for.body, label %for.end29
for.body: ; preds = %entry, %for.inc27
%i.048 = phi i32 [ %inc28, %for.inc27 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.not45 = icmp slt i32 %1, 1
br i1 %cmp3.not45, label %for.inc27, label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.body, %for.end22
%indvars.iv = phi i32 [ %indvars.iv.next, %for.end22 ], [ 2, %for.body ]
%2 = phi i32 [ %4, %for.end22 ], [ %1, %for.body ]
%x.046 = phi i32 [ %add.le, %for.end22 ], [ 1, %for.body ]
%cmp6.not.not40 = icmp sgt i32 %2, %x.046
br i1 %cmp6.not.not40, label %for.body7, label %for.body11.preheader
for.body7: ; preds = %for.cond5.preheader, %for.body7
%j.041 = phi i32 [ %dec, %for.body7 ], [ %2, %for.cond5.preheader ]
%putchar39 = call i32 @putchar(i32 40)
%dec = add nsw i32 %j.041, -1
%cmp6.not.not = icmp sgt i32 %dec, %x.046
br i1 %cmp6.not.not, label %for.body7, label %for.body11.preheader, !llvm.loop !9
for.body11.preheader: ; preds = %for.body7, %for.cond5.preheader
br label %for.body11
for.body11: ; preds = %for.body11.preheader, %for.body11
%ii.042 = phi i32 [ %inc, %for.body11 ], [ 1, %for.body11.preheader ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
%inc = add nuw i32 %ii.042, 1
%exitcond.not = icmp eq i32 %inc, %indvars.iv
br i1 %exitcond.not, label %for.end14, label %for.body11, !llvm.loop !11
for.end14: ; preds = %for.body11
%add.le = add nuw nsw i32 %x.046, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp17.not.not43 = icmp sgt i32 %3, %x.046
br i1 %cmp17.not.not43, label %for.body18, label %for.end22
for.body18: ; preds = %for.end14, %for.body18
%k.044 = phi i32 [ %dec21, %for.body18 ], [ %3, %for.end14 ]
%putchar38 = call i32 @putchar(i32 41)
%dec21 = add nsw i32 %k.044, -1
%cmp17.not.not = icmp sgt i32 %dec21, %x.046
br i1 %cmp17.not.not, label %for.body18, label %for.end22, !llvm.loop !12
for.end22: ; preds = %for.body18, %for.end14
%putchar = call i32 @putchar(i32 10)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.not.not = icmp slt i32 %x.046, %4
%indvars.iv.next = add nuw i32 %indvars.iv, 1
br i1 %cmp3.not.not, label %for.cond5.preheader, label %for.inc27, !llvm.loop !13
for.inc27: ; preds = %for.end22, %for.body
%inc28 = add nuw nsw i32 %i.048, 1
%5 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc28, %5
br i1 %cmp, label %for.body, label %for.end29, !llvm.loop !14
for.end29: ; preds = %for.inc27, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; 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.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#define MAX 500000
#define BIG 1000000000
void merge(int *,int,int,int);
void mergeSort(int *,int,int);
int count=0;
int main(){
int n,i;
int A[MAX];
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&A[i]);
mergeSort(A,0,n);
for(i=0;i<n-1;i++) printf("%d ",A[i]);
printf("%d\n",A[n-1]);
printf("%d\n",count);
return 0;
}
void merge(int *A,int left,int mid,int right){
int n1,n2,i,j,k;
n1=mid-left;
n2=right-mid;
int L[n1+1];
int R[n2+1];
for(i=0;i<=n1-1;i++){
L[i]=A[left+i];
}
for(j=0;j<=n2-1;j++){
R[j]=A[mid+j];
}
L[n1]=BIG;
R[n2]=BIG;
i=0;
j=0;
for(k=left;k<=right-1;k++){
if(L[i]<=R[j]){
A[k]=L[i];
i++;
count++;
}
else{
A[k]=R[j];
j++;
count++;
}
}
}
void mergeSort(int *A,int left,int right){
int mid;
if(left+1<right){
mid=(left+right)/2;
mergeSort(A,left,mid);
mergeSort(A,mid,right);
merge(A,left,mid,right);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147502/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147502/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \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
%A = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp324 = icmp sgt i32 %3, 1
br i1 %cmp324, label %for.body4, label %for.end.for.end10_crit_edge
for.end.for.end10_crit_edge: ; preds = %for.end
%sub23 = add nsw i32 %3, -1
%.pre = sext i32 %sub23 to i64
br label %for.end10
for.body4: ; preds = %for.end, %for.body4
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.body4 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv30
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next31, %6
br i1 %cmp3, label %for.body4, label %for.end10, !llvm.loop !11
for.end10: ; preds = %for.body4, %for.end.for.end10_crit_edge
%idxprom12.pre-phi = phi i64 [ %.pre, %for.end.for.end10_crit_edge ], [ %6, %for.body4 ]
%arrayidx13 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %idxprom12.pre-phi
%7 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%8 = load i32, ptr @count, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #3 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; 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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #3 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%0 = zext i32 %add to i64
%vla = alloca i32, i64 %0, align 16
%add2 = add nsw i32 %sub1, 1
%1 = zext i32 %add2 to i64
%vla3 = alloca i32, i64 %1, align 16
%cmp.not.not76 = icmp sgt i32 %sub, 0
br i1 %cmp.not.not76, label %for.body.preheader, label %for.cond8.preheader
for.body.preheader: ; preds = %entry
%2 = sext i32 %left to i64
%3 = shl nsw i64 %2, 2
%scevgep = getelementptr i8, ptr %A, i64 %3
%4 = xor i32 %left, -1
%5 = add i32 %4, %mid
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
%8 = add nuw nsw i64 %7, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %8, i1 false), !tbaa !5
br label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.body.preheader, %entry
%cmp10.not.not78 = icmp sgt i32 %sub1, 0
br i1 %cmp10.not.not78, label %for.body11.preheader, label %for.end19
for.body11.preheader: ; preds = %for.cond8.preheader
%9 = sext i32 %mid to i64
%10 = shl nsw i64 %9, 2
%scevgep86 = getelementptr i8, ptr %A, i64 %10
%11 = xor i32 %mid, -1
%12 = add i32 %11, %right
%13 = zext i32 %12 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nuw nsw i64 %14, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla3, ptr noundef nonnull align 4 dereferenceable(1) %scevgep86, i64 %15, i1 false), !tbaa !5
br label %for.end19
for.end19: ; preds = %for.body11.preheader, %for.cond8.preheader
%idxprom20 = sext i32 %sub to i64
%arrayidx21 = getelementptr inbounds i32, ptr %vla, i64 %idxprom20
store i32 1000000000, ptr %arrayidx21, align 4, !tbaa !5
%idxprom22 = sext i32 %sub1 to i64
%arrayidx23 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom22
store i32 1000000000, ptr %arrayidx23, align 4, !tbaa !5
%cmp26.not.not80 = icmp slt i32 %left, %right
br i1 %cmp26.not.not80, label %for.body27.preheader, label %for.end47
for.body27.preheader: ; preds = %for.end19
%16 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body27
for.body27: ; preds = %for.body27.preheader, %for.body27
%indvars.iv = phi i64 [ %16, %for.body27.preheader ], [ %indvars.iv.next, %for.body27 ]
%i.183 = phi i32 [ 0, %for.body27.preheader ], [ %i.2, %for.body27 ]
%j.182 = phi i32 [ 0, %for.body27.preheader ], [ %j.2, %for.body27 ]
%idxprom28 = zext i32 %i.183 to i64
%arrayidx29 = getelementptr inbounds i32, ptr %vla, i64 %idxprom28
%17 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%idxprom30 = zext i32 %j.182 to i64
%arrayidx31 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom30
%18 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%cmp32.not = icmp sgt i32 %17, %18
%.sink = tail call i32 @llvm.smin.i32(i32 %17, i32 %18)
%inc43 = zext i1 %cmp32.not to i32
%j.2 = add nuw nsw i32 %j.182, %inc43
%not.cmp32.not = xor i1 %cmp32.not, true
%inc37 = zext i1 %not.cmp32.not to i32
%i.2 = add nuw nsw i32 %i.183, %inc37
%19 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %19, align 4
%storemerge.in = load i32, ptr @count, align 4, !tbaa !5
%storemerge = add nsw i32 %storemerge.in, 1
store i32 %storemerge, ptr @count, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end47, label %for.body27, !llvm.loop !12
for.end47: ; preds = %for.body27, %for.end19
ret void
}
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
; 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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <stdlib.h>
#define MAX 500000
#define INFITY 1000000001
void merge(int [],int,int,int);
void mergeSort(int [] ,int ,int);
int counter=0;
int main(){
int A[MAX],n, j;
scanf("%d",&n);
for(j=0;j<n;j++){
scanf("%d",&A[j]);
}
mergeSort(A,0,n);
for(j=0;j<n;j++){
printf("%d",A[j]);
if(j<n-1) printf(" ");
}
printf("\n%d\n",counter);
return 0;
}
void merge(int A[],int left,int mid,int right)
{
int n1,n2,i,j,k,*L,*R;
n1 = mid - left;
n2 = right - mid;
L=malloc((n1+1)*sizeof(int));
R=malloc((n2+1)*sizeof(int));
for(i=0;i<=n1-1;i++){
L[i] = A[left + i];
}
for(i=0;i<=n2-1;i++){
R[i] = A[mid + i];
}
L[n1]=INFITY;
R[n2] = INFITY;
i=j=0;
for(k=left;k<right;k++){
if(L[i] <= R[j]){
A[k] = L[i];
i = i + 1;
counter++;
}
else{
A[k] = R[j];
j = j + 1;
counter++;
}
}
free(L);
free(R);
}
void mergeSort(int A[],int left, int right){
if(left+1 < right){
int mid = (left + right)/2;
mergeSort(A, left, mid);
mergeSort(A, mid, right);
merge(A, left, mid, right);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147546/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147546/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@counter = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [500000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp322 = icmp sgt i32 %3, 0
br i1 %cmp322, label %for.body4, label %for.end12
for.body4: ; preds = %for.end, %for.inc10
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %for.inc10 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv26
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp8 = icmp slt i64 %indvars.iv26, %6
br i1 %cmp8, label %if.then, label %for.inc10
if.then: ; preds = %for.body4
%putchar = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%7 = phi i32 [ %5, %for.body4 ], [ %.pre, %if.then ]
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next27, %8
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.inc10, %for.end
%9 = load i32, ptr @counter, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nounwind uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; 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: nounwind uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 2
%call = tail call noalias ptr @malloc(i64 noundef %mul) #9
%add2 = add nsw i32 %sub1, 1
%conv3 = sext i32 %add2 to i64
%mul4 = shl nsw i64 %conv3, 2
%call5 = tail call noalias ptr @malloc(i64 noundef %mul4) #9
%cmp.not.not89 = icmp sgt i32 %sub, 0
br i1 %cmp.not.not89, label %for.body.preheader, label %for.cond11.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond11.preheader
for.cond11.preheader: ; preds = %for.body.preheader, %entry
%cmp13.not.not91 = icmp sgt i32 %sub1, 0
br i1 %cmp13.not.not91, label %for.body15.preheader, label %for.end23
for.body15.preheader: ; preds = %for.cond11.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep99 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call5, ptr noundef nonnull align 4 dereferenceable(1) %scevgep99, i64 %13, i1 false), !tbaa !5
br label %for.end23
for.end23: ; preds = %for.body15.preheader, %for.cond11.preheader
%idxprom24 = sext i32 %sub to i64
%arrayidx25 = getelementptr inbounds i32, ptr %call, i64 %idxprom24
store i32 1000000001, ptr %arrayidx25, align 4, !tbaa !5
%idxprom26 = sext i32 %sub1 to i64
%arrayidx27 = getelementptr inbounds i32, ptr %call5, i64 %idxprom26
store i32 1000000001, ptr %arrayidx27, align 4, !tbaa !5
%cmp2993 = icmp slt i32 %left, %right
br i1 %cmp2993, label %for.body31.preheader, label %for.end52
for.body31.preheader: ; preds = %for.end23
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body31
for.body31: ; preds = %for.body31.preheader, %for.body31
%indvars.iv = phi i64 [ %14, %for.body31.preheader ], [ %indvars.iv.next, %for.body31 ]
%i.296 = phi i32 [ 0, %for.body31.preheader ], [ %i.3, %for.body31 ]
%j.095 = phi i32 [ 0, %for.body31.preheader ], [ %j.1, %for.body31 ]
%idxprom32 = zext i32 %i.296 to i64
%arrayidx33 = getelementptr inbounds i32, ptr %call, i64 %idxprom32
%15 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%idxprom34 = zext i32 %j.095 to i64
%arrayidx35 = getelementptr inbounds i32, ptr %call5, i64 %idxprom34
%16 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%cmp36.not = icmp sgt i32 %15, %16
%.sink = tail call i32 @llvm.smin.i32(i32 %15, i32 %16)
%add48 = zext i1 %cmp36.not to i32
%j.1 = add nuw nsw i32 %j.095, %add48
%not.cmp36.not = xor i1 %cmp36.not, true
%add42 = zext i1 %not.cmp36.not to i32
%i.3 = add nuw nsw i32 %i.296, %add42
%17 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %17, align 4
%storemerge.in = load i32, ptr @counter, align 4, !tbaa !5
%storemerge = add nsw i32 %storemerge.in, 1
store i32 %storemerge, ptr @counter, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end52, label %for.body31, !llvm.loop !12
for.end52: ; preds = %for.body31, %for.end23
tail call void @free(ptr noundef nonnull %call) #8
tail call void @free(ptr noundef nonnull %call5) #8
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: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
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 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main()
{
int n,t,i,j,k;
scanf("%d",&t);
for(k=0; k<t; k++)
{
scanf("%d",&n);
for(i=1;i<=n;i++)
{
int x=n;
int y=n;
while(x>0)
{
for(j=1; j<=i && x>0; j++)
{
printf("(");
x--;
}
printf(")");
y--;
}
for(j=1; j<=y; j++)
{
printf(")");
}
printf("\n");
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14759/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14759/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%t = 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 %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp48 = icmp sgt i32 %0, 0
br i1 %cmp48, label %for.body, label %for.end26
for.body: ; preds = %entry, %for.inc24
%k.049 = phi i32 [ %inc25, %for.inc24 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.not46 = icmp slt i32 %1, 1
br i1 %cmp3.not46, label %for.inc24, label %while.cond.preheader
while.cond.preheader: ; preds = %for.body, %for.end19
%2 = phi i32 [ %4, %for.end19 ], [ %1, %for.body ]
%i.047 = phi i32 [ %inc22, %for.end19 ], [ 1, %for.body ]
%cmp541 = icmp sgt i32 %2, 0
br i1 %cmp541, label %for.cond6.preheader, label %for.end19
for.cond13.preheader: ; preds = %for.end
%cmp14.not44 = icmp slt i32 %y.043, 2
br i1 %cmp14.not44, label %for.end19, label %for.body15
for.cond6.preheader: ; preds = %while.cond.preheader, %for.end
%y.043 = phi i32 [ %dec12, %for.end ], [ %2, %while.cond.preheader ]
%x.042 = phi i32 [ %dec, %for.end ], [ %2, %while.cond.preheader ]
br label %for.body9
for.body9: ; preds = %for.cond6.preheader, %for.body9
%x.140 = phi i32 [ %x.042, %for.cond6.preheader ], [ %dec, %for.body9 ]
%j.039 = phi i32 [ 1, %for.cond6.preheader ], [ %inc, %for.body9 ]
%putchar38 = call i32 @putchar(i32 40)
%dec = add nsw i32 %x.140, -1
%inc = add nuw nsw i32 %j.039, 1
%cmp7 = icmp ult i32 %j.039, %i.047
%cmp8 = icmp ne i32 %dec, 0
%3 = select i1 %cmp7, i1 %cmp8, i1 false
br i1 %3, label %for.body9, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body9
%putchar37 = call i32 @putchar(i32 41)
%dec12 = add nsw i32 %y.043, -1
%cmp5 = icmp sgt i32 %x.140, 1
br i1 %cmp5, label %for.cond6.preheader, label %for.cond13.preheader, !llvm.loop !11
for.body15: ; preds = %for.cond13.preheader, %for.body15
%j.145 = phi i32 [ %inc18, %for.body15 ], [ 1, %for.cond13.preheader ]
%putchar36 = call i32 @putchar(i32 41)
%inc18 = add nuw i32 %j.145, 1
%exitcond.not = icmp eq i32 %j.145, %dec12
br i1 %exitcond.not, label %for.end19, label %for.body15, !llvm.loop !12
for.end19: ; preds = %for.body15, %while.cond.preheader, %for.cond13.preheader
%putchar = call i32 @putchar(i32 10)
%inc22 = add nuw nsw i32 %i.047, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.not.not = icmp slt i32 %i.047, %4
br i1 %cmp3.not.not, label %while.cond.preheader, label %for.inc24, !llvm.loop !13
for.inc24: ; preds = %for.end19, %for.body
%inc25 = add nuw nsw i32 %k.049, 1
%5 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc25, %5
br i1 %cmp, label %for.body, label %for.end26, !llvm.loop !14
for.end26: ; preds = %for.inc24, %entry
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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#define N 500000
#define S 1000000000
void Merge(int, int, int);
void Sort(int, int);
int A[N], cnt = 0;
int main(void){
int n, i;
scanf("%d", &n);
for(i=0; i < n; i++) scanf("%d", &A[i]);
Sort(0, n);
for(i = 0; i < n; i++){
printf("%d", A[i]);
if(i < n - 1)printf(" ");
}
printf("\n%d\n", cnt);
return 0;
}
void Merge(int left, int mid, int right){
int i, k, j;
int n1 = mid - left, n2 = right - mid;
int l[n1], r[n2];
for(i = 0; i < n1; i++) l[i] = A[left + i];
for(i = 0; i < n2; i++) r[i] = A[mid + i];
l[n1] = S;
r[n2] = S;
i = 0;
j = 0;
for(k = left; k < right; k++){
if(l[i] <= r[j]){
A[k] = l[i];
i++;
}
else{
A[k] = r[j];
j++;
}
cnt++;
}
}
void Sort(int left, int right){
int mid;
if(left + 1 < right){
mid = (left + right) / 2;
Sort(left, mid);
Sort(mid, right);
Merge(left, mid, right);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147647/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147647/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@A = dso_local global [500000 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%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) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @Sort(i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp322 = icmp sgt i32 %3, 0
br i1 %cmp322, label %for.body4, label %for.end12
for.body4: ; preds = %for.end, %for.inc10
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %for.inc10 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv26
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp8 = icmp slt i64 %indvars.iv26, %6
br i1 %cmp8, label %if.then, label %for.inc10
if.then: ; preds = %for.body4
%putchar = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%7 = phi i32 [ %5, %for.body4 ], [ %.pre, %if.then ]
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next27, %8
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.inc10, %for.end
%9 = load i32, ptr @cnt, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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(readwrite, inaccessiblemem: none) uwtable
define dso_local void @Sort(i32 noundef %left, i32 noundef %right) local_unnamed_addr #3 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret10
common.ret10: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @Sort(i32 noundef %left, i32 noundef %div)
tail call void @Sort(i32 noundef %div, i32 noundef %right)
tail call void @Merge(i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret10
}
; 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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @Merge(i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #4 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%0 = zext i32 %sub to i64
%vla = alloca i32, i64 %0, align 16
%1 = zext i32 %sub1 to i64
%vla2 = alloca i32, i64 %1, align 16
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond5.preheader
for.body.preheader: ; preds = %entry
%2 = sext i32 %left to i64
%3 = shl nsw i64 %2, 2
%scevgep = getelementptr i8, ptr @A, i64 %3
%4 = xor i32 %left, -1
%5 = add i32 %4, %mid
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
%8 = add nuw nsw i64 %7, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %8, i1 false), !tbaa !5
br label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.body.preheader, %entry
%cmp669 = icmp sgt i32 %sub1, 0
br i1 %cmp669, label %for.body7.preheader, label %for.end15
for.body7.preheader: ; preds = %for.cond5.preheader
%9 = sext i32 %mid to i64
%10 = shl nsw i64 %9, 2
%scevgep79 = getelementptr i8, ptr @A, i64 %10
%11 = xor i32 %mid, -1
%12 = add i32 %11, %right
%13 = zext i32 %12 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nuw nsw i64 %14, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla2, ptr noundef nonnull align 4 dereferenceable(1) %scevgep79, i64 %15, i1 false), !tbaa !5
br label %for.end15
for.end15: ; preds = %for.body7.preheader, %for.cond5.preheader
%idxprom16 = sext i32 %sub to i64
%arrayidx17 = getelementptr inbounds i32, ptr %vla, i64 %idxprom16
store i32 1000000000, ptr %arrayidx17, align 4, !tbaa !5
%idxprom18 = sext i32 %sub1 to i64
%arrayidx19 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom18
store i32 1000000000, ptr %arrayidx19, align 4, !tbaa !5
%cmp2172 = icmp slt i32 %left, %right
br i1 %cmp2172, label %for.body22.preheader, label %for.end41
for.body22.preheader: ; preds = %for.end15
%cnt.promoted = load i32, ptr @cnt, align 4, !tbaa !5
%16 = sext i32 %left to i64
%17 = add i32 %cnt.promoted, %right
%wide.trip.count = sext i32 %right to i64
br label %for.body22
for.body22: ; preds = %for.body22.preheader, %for.body22
%indvars.iv = phi i64 [ %16, %for.body22.preheader ], [ %indvars.iv.next, %for.body22 ]
%i.276 = phi i32 [ 0, %for.body22.preheader ], [ %i.3, %for.body22 ]
%j.074 = phi i32 [ 0, %for.body22.preheader ], [ %j.1, %for.body22 ]
%idxprom23 = zext i32 %i.276 to i64
%arrayidx24 = getelementptr inbounds i32, ptr %vla, i64 %idxprom23
%18 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.074 to i64
%arrayidx26 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom25
%19 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sgt i32 %18, %19
%.sink = tail call i32 @llvm.smin.i32(i32 %18, i32 %19)
%inc37 = zext i1 %cmp27.not to i32
%j.1 = add nuw nsw i32 %j.074, %inc37
%not.cmp27.not = xor i1 %cmp27.not, true
%inc32 = zext i1 %not.cmp27.not to i32
%i.3 = add nuw nsw i32 %i.276, %inc32
%20 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv
store i32 %.sink, ptr %20, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond20.for.end41_crit_edge, label %for.body22, !llvm.loop !12
for.cond20.for.end41_crit_edge: ; preds = %for.body22
%21 = sub i32 %17, %left
store i32 %21, ptr @cnt, align 4, !tbaa !5
br label %for.end41
for.end41: ; preds = %for.cond20.for.end41_crit_edge, %for.end15
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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, 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 = { 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 #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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>
void merge(int [],int,int,int);
void mergeSort(int [],int,int);
int cnt;
int main(){
int S[500000],i,n;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&S[i]);
}
mergeSort(S,0,n);
for(i=0;i<n;i++){
if(i==0) printf("%d",S[i]);
else if(i==n-1) printf(" %d\n",S[i]);
else printf(" %d",S[i]);
}
printf("%d\n",cnt);
return 0;
}
void merge(int A[],int left,int mid,int right){
int n1,n2,i,j,k;
double *L,*R;
n1=mid-left;
n2=right-mid;
L=(double*)malloc((sizeof(double))*(n1+1));
R=(double*)malloc((sizeof(double))*(n2+1));
for(i=0;i<n1;i++){
L[i]=A[left+i];
}
for(i=0;i<n2;i++){
R[i]=A[mid+i];
}
L[n1]=1.0/0.0;
R[n2]=1.0/0.0;
i=0;
j=0;
for(k=left;k<right;k++){
cnt++;
if(L[i]<=R[j]){
A[k]=L[i];
i++;
}
else {
A[k]=R[j];
j++;
}
}
free(L);
free(R);
}
void mergeSort(int A[],int left,int right){
int mid;
if(left+1<right){ mid=(left+right)/2;
mergeSort(A,left,mid);
mergeSort(A,mid,right);
merge(A,left,mid,right);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147704/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147704/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@cnt = dso_local local_unnamed_addr global i32 0, align 4
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [500000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %S) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp33 = icmp sgt i32 %0, 0
br i1 %cmp33, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %S, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp335 = icmp sgt i32 %3, 0
br i1 %cmp335, label %for.inc19.peel, label %for.end21
for.inc19.peel: ; preds = %for.end
%4 = load i32, ptr %S, align 16, !tbaa !5
%call8.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%.pre = load i32, ptr %n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %.pre, 1
br i1 %cmp3.peel, label %if.else, label %for.end21
if.else: ; preds = %for.inc19.peel, %if.else
%indvars.iv39 = phi i64 [ %indvars.iv.next40, %if.else ], [ 1, %for.inc19.peel ]
%5 = phi i32 [ %8, %if.else ], [ %.pre, %for.inc19.peel ]
%sub = add nsw i32 %5, -1
%6 = zext i32 %sub to i64
%cmp9 = icmp eq i64 %indvars.iv39, %6
%arrayidx12 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv39
%7 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%.str.1..str.2 = select i1 %cmp9, ptr @.str.1, ptr @.str.2
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2, i32 noundef %7)
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp3 = icmp slt i64 %indvars.iv.next40, %9
br i1 %cmp3, label %if.else, label %for.end21, !llvm.loop !11
for.end21: ; preds = %if.else, %for.inc19.peel, %for.end
%10 = load i32, ptr @cnt, align 4, !tbaa !5
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %S) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nounwind uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; 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: nounwind uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 3
%call = tail call noalias ptr @malloc(i64 noundef %mul) #6
%add2 = add nsw i32 %sub1, 1
%conv3 = sext i32 %add2 to i64
%mul4 = shl nsw i64 %conv3, 3
%call5 = tail call noalias ptr @malloc(i64 noundef %mul4) #6
%cmp90 = icmp sgt i32 %sub, 0
br i1 %cmp90, label %for.body.preheader, label %for.cond11.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub, 4
br i1 %min.iters.check, label %for.body.preheader128, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%1 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <2 x i32>, ptr %1, align 4, !tbaa !5
%2 = getelementptr i32, ptr %1, i64 2
%wide.load113 = load <2 x i32>, ptr %2, align 4, !tbaa !5
%3 = sitofp <2 x i32> %wide.load to <2 x double>
%4 = sitofp <2 x i32> %wide.load113 to <2 x double>
%5 = getelementptr inbounds double, ptr %call, i64 %index
store <2 x double> %3, ptr %5, align 8, !tbaa !13
%6 = getelementptr inbounds double, ptr %5, i64 2
store <2 x double> %4, ptr %6, align 8, !tbaa !13
%index.next = add nuw i64 %index, 4
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond11.preheader, label %for.body.preheader128
for.body.preheader128: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond11.preheader: ; preds = %for.body, %middle.block, %entry
%cmp1292 = icmp sgt i32 %sub1, 0
br i1 %cmp1292, label %for.body14.preheader, label %for.end23
for.body14.preheader: ; preds = %for.cond11.preheader
%8 = sext i32 %mid to i64
%wide.trip.count104 = zext i32 %sub1 to i64
%invariant.gep111 = getelementptr i32, ptr %A, i64 %8
%min.iters.check116 = icmp ult i32 %sub1, 4
br i1 %min.iters.check116, label %for.body14.preheader127, label %vector.ph117
vector.ph117: ; preds = %for.body14.preheader
%n.vec119 = and i64 %wide.trip.count104, 4294967292
br label %vector.body122
vector.body122: ; preds = %vector.body122, %vector.ph117
%index123 = phi i64 [ 0, %vector.ph117 ], [ %index.next126, %vector.body122 ]
%9 = getelementptr i32, ptr %invariant.gep111, i64 %index123
%wide.load124 = load <2 x i32>, ptr %9, align 4, !tbaa !5
%10 = getelementptr i32, ptr %9, i64 2
%wide.load125 = load <2 x i32>, ptr %10, align 4, !tbaa !5
%11 = sitofp <2 x i32> %wide.load124 to <2 x double>
%12 = sitofp <2 x i32> %wide.load125 to <2 x double>
%13 = getelementptr inbounds double, ptr %call5, i64 %index123
store <2 x double> %11, ptr %13, align 8, !tbaa !13
%14 = getelementptr inbounds double, ptr %13, i64 2
store <2 x double> %12, ptr %14, align 8, !tbaa !13
%index.next126 = add nuw i64 %index123, 4
%15 = icmp eq i64 %index.next126, %n.vec119
br i1 %15, label %middle.block114, label %vector.body122, !llvm.loop !18
middle.block114: ; preds = %vector.body122
%cmp.n121 = icmp eq i64 %n.vec119, %wide.trip.count104
br i1 %cmp.n121, label %for.end23, label %for.body14.preheader127
for.body14.preheader127: ; preds = %for.body14.preheader, %middle.block114
%indvars.iv100.ph = phi i64 [ 0, %for.body14.preheader ], [ %n.vec119, %middle.block114 ]
br label %for.body14
for.body: ; preds = %for.body.preheader128, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader128 ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%16 = load i32, ptr %gep, align 4, !tbaa !5
%conv8 = sitofp i32 %16 to double
%arrayidx10 = getelementptr inbounds double, ptr %call, i64 %indvars.iv
store double %conv8, ptr %arrayidx10, align 8, !tbaa !13
%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.cond11.preheader, label %for.body, !llvm.loop !19
for.body14: ; preds = %for.body14.preheader127, %for.body14
%indvars.iv100 = phi i64 [ %indvars.iv.next101, %for.body14 ], [ %indvars.iv100.ph, %for.body14.preheader127 ]
%gep112 = getelementptr i32, ptr %invariant.gep111, i64 %indvars.iv100
%17 = load i32, ptr %gep112, align 4, !tbaa !5
%conv18 = sitofp i32 %17 to double
%arrayidx20 = getelementptr inbounds double, ptr %call5, i64 %indvars.iv100
store double %conv18, ptr %arrayidx20, align 8, !tbaa !13
%indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
%exitcond105.not = icmp eq i64 %indvars.iv.next101, %wide.trip.count104
br i1 %exitcond105.not, label %for.end23, label %for.body14, !llvm.loop !20
for.end23: ; preds = %for.body14, %middle.block114, %for.cond11.preheader
%idxprom24 = sext i32 %sub to i64
%arrayidx25 = getelementptr inbounds double, ptr %call, i64 %idxprom24
store double 0x7FF0000000000000, ptr %arrayidx25, align 8, !tbaa !13
%idxprom26 = sext i32 %sub1 to i64
%arrayidx27 = getelementptr inbounds double, ptr %call5, i64 %idxprom26
store double 0x7FF0000000000000, ptr %arrayidx27, align 8, !tbaa !13
%cmp2994 = icmp slt i32 %left, %right
br i1 %cmp2994, label %for.body31.preheader, label %for.end53
for.body31.preheader: ; preds = %for.end23
%18 = sext i32 %left to i64
%wide.trip.count109 = sext i32 %right to i64
br label %for.body31
for.body31: ; preds = %for.body31.preheader, %for.body31
%indvars.iv106 = phi i64 [ %18, %for.body31.preheader ], [ %indvars.iv.next107, %for.body31 ]
%i.297 = phi i32 [ 0, %for.body31.preheader ], [ %i.3, %for.body31 ]
%j.096 = phi i32 [ 0, %for.body31.preheader ], [ %j.1, %for.body31 ]
%19 = load i32, ptr @cnt, align 4, !tbaa !5
%inc32 = add nsw i32 %19, 1
store i32 %inc32, ptr @cnt, align 4, !tbaa !5
%idxprom33 = zext i32 %i.297 to i64
%arrayidx34 = getelementptr inbounds double, ptr %call, i64 %idxprom33
%20 = load double, ptr %arrayidx34, align 8, !tbaa !13
%idxprom35 = zext i32 %j.096 to i64
%arrayidx36 = getelementptr inbounds double, ptr %call5, i64 %idxprom35
%21 = load double, ptr %arrayidx36, align 8, !tbaa !13
%cmp37 = fcmp ugt double %20, %21
%conv41.sink.in = select i1 %cmp37, double %21, double %20
%inc50 = zext i1 %cmp37 to i32
%j.1 = add nuw nsw i32 %j.096, %inc50
%not.cmp37 = xor i1 %cmp37, true
%inc44 = zext i1 %not.cmp37 to i32
%i.3 = add nuw nsw i32 %i.297, %inc44
%conv41.sink = fptosi double %conv41.sink.in to i32
%22 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv106
store i32 %conv41.sink, ptr %22, align 4
%indvars.iv.next107 = add nsw i64 %indvars.iv106, 1
%exitcond110.not = icmp eq i64 %indvars.iv.next107, %wide.trip.count109
br i1 %exitcond110.not, label %for.end53, label %for.body31, !llvm.loop !21
for.end53: ; preds = %for.body31, %for.end23
tail call void @free(ptr noundef nonnull %call) #5
tail call void @free(ptr noundef nonnull %call5) #5
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: 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, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = distinct !{!15, !10, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !10, !16, !17}
!19 = distinct !{!19, !10, !17, !16}
!20 = distinct !{!20, !10, !17, !16}
!21 = distinct !{!21, !10}
|
#include<stdio.h>
#include<stdlib.h>
#define MAX 500001
void merge(int *,int,int,int);
void mergeSort(int *,int,int);
int count=0;
int main(){
int n,i;
int S[MAX];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&S[i]);
if(S[i]<0 || S[i]>1000000000){
exit(1);
}
}
mergeSort(S,0,n);
for(i=0;i<n-1;i++){
printf("%d ",S[i]);
}
printf("%d\n",S[n-1]);
printf("%d\n",count);
return 0;
}
void merge(int *A,int l,int m,int r){
int n1=m-l;
int n2=r-m;
int i,j,k;
int *L,*R;
L=(int *)malloc(sizeof(int)*(n1+1));
R=(int *)malloc(sizeof(int)*(n2+1));
for(i=0;i<=n1-1;i++){
L[i]=A[l+i];
}
for(j=0;j<=n2-1;j++){
R[j]=A[m+j];
}
L[n1]=1000000000;
R[n2]=1000000000;
i=0;
j=0;
for(k=l;k<=r-1;k++){
if(L[i]<=R[j]){
A[k]=L[i];
i=i+1;
}else{
A[k]=R[j];
j=j+1;
}
count++;
}
free(L);
free(R);
}
void mergeSort(int *A,int left,int right){
int mid;
if(left+1<right){
mid=(left+right)/2;
mergeSort(A,left,mid);
mergeSort(A,mid,right);
merge(A,left,mid,right);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147748/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147748/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \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
%S = alloca [500001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 2000004, ptr nonnull %S) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body, label %for.end
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.body: ; preds = %entry, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500001 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%or.cond = icmp ugt i32 %3, 1000000000
br i1 %or.cond, label %if.then, label %for.cond
if.then: ; preds = %for.body
call void @exit(i32 noundef 1) #9
unreachable
for.end: ; preds = %for.cond, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.cond ]
call void @mergeSort(ptr noundef nonnull %S, i32 noundef 0, i32 noundef %.lcssa)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp934 = icmp sgt i32 %4, 1
br i1 %cmp934, label %for.body10, label %for.end.for.end16_crit_edge
for.end.for.end16_crit_edge: ; preds = %for.end
%sub33 = add nsw i32 %4, -1
%.pre = sext i32 %sub33 to i64
br label %for.end16
for.body10: ; preds = %for.end, %for.body10
%indvars.iv40 = phi i64 [ %indvars.iv.next41, %for.body10 ], [ 0, %for.end ]
%arrayidx12 = getelementptr inbounds [500001 x i32], ptr %S, i64 0, i64 %indvars.iv40
%5 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %6, -1
%7 = sext i32 %sub to i64
%cmp9 = icmp slt i64 %indvars.iv.next41, %7
br i1 %cmp9, label %for.body10, label %for.end16, !llvm.loop !11
for.end16: ; preds = %for.body10, %for.end.for.end16_crit_edge
%idxprom18.pre-phi = phi i64 [ %.pre, %for.end.for.end16_crit_edge ], [ %7, %for.body10 ]
%arrayidx19 = getelementptr inbounds [500001 x i32], ptr %S, i64 0, i64 %idxprom18.pre-phi
%8 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%9 = load i32, ptr @count, align 4, !tbaa !5
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 2000004, ptr nonnull %S) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3
; Function Attrs: nounwind uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; 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: nounwind uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %l, i32 noundef %m, i32 noundef %r) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %m, %l
%sub1 = sub nsw i32 %r, %m
%add = add nsw i32 %sub, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 2
%call = tail call noalias ptr @malloc(i64 noundef %mul) #10
%add2 = add nsw i32 %sub1, 1
%conv3 = sext i32 %add2 to i64
%mul4 = shl nsw i64 %conv3, 2
%call5 = tail call noalias ptr @malloc(i64 noundef %mul4) #10
%cmp.not.not89 = icmp sgt i32 %sub, 0
br i1 %cmp.not.not89, label %for.body.preheader, label %for.cond11.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %l to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %l, -1
%3 = add i32 %2, %m
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond11.preheader
for.cond11.preheader: ; preds = %for.body.preheader, %entry
%cmp13.not.not91 = icmp sgt i32 %sub1, 0
br i1 %cmp13.not.not91, label %for.body15.preheader, label %for.end23
for.body15.preheader: ; preds = %for.cond11.preheader
%7 = sext i32 %m to i64
%8 = shl nsw i64 %7, 2
%scevgep99 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %m, -1
%10 = add i32 %9, %r
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call5, ptr noundef nonnull align 4 dereferenceable(1) %scevgep99, i64 %13, i1 false), !tbaa !5
br label %for.end23
for.end23: ; preds = %for.body15.preheader, %for.cond11.preheader
%idxprom24 = sext i32 %sub to i64
%arrayidx25 = getelementptr inbounds i32, ptr %call, i64 %idxprom24
store i32 1000000000, ptr %arrayidx25, align 4, !tbaa !5
%idxprom26 = sext i32 %sub1 to i64
%arrayidx27 = getelementptr inbounds i32, ptr %call5, i64 %idxprom26
store i32 1000000000, ptr %arrayidx27, align 4, !tbaa !5
%cmp30.not.not93 = icmp slt i32 %l, %r
br i1 %cmp30.not.not93, label %for.body32.preheader, label %for.end52
for.body32.preheader: ; preds = %for.end23
%14 = sext i32 %l to i64
%wide.trip.count = sext i32 %r to i64
br label %for.body32
for.body32: ; preds = %for.body32.preheader, %for.body32
%indvars.iv = phi i64 [ %14, %for.body32.preheader ], [ %indvars.iv.next, %for.body32 ]
%i.196 = phi i32 [ 0, %for.body32.preheader ], [ %i.2, %for.body32 ]
%j.195 = phi i32 [ 0, %for.body32.preheader ], [ %j.2, %for.body32 ]
%idxprom33 = zext i32 %i.196 to i64
%arrayidx34 = getelementptr inbounds i32, ptr %call, i64 %idxprom33
%15 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%idxprom35 = zext i32 %j.195 to i64
%arrayidx36 = getelementptr inbounds i32, ptr %call5, i64 %idxprom35
%16 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%cmp37.not = icmp sgt i32 %15, %16
%.sink = tail call i32 @llvm.smin.i32(i32 %15, i32 %16)
%add48 = zext i1 %cmp37.not to i32
%j.2 = add nuw nsw i32 %j.195, %add48
%not.cmp37.not = xor i1 %cmp37.not, true
%add43 = zext i1 %not.cmp37.not to i32
%i.2 = add nuw nsw i32 %i.196, %add43
%17 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %17, align 4
%18 = load i32, ptr @count, align 4, !tbaa !5
%inc49 = add nsw i32 %18, 1
store i32 %inc49, ptr @count, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end52, label %for.body32, !llvm.loop !12
for.end52: ; preds = %for.body32, %for.end23
tail call void @free(ptr noundef nonnull %call) #8
tail call void @free(ptr noundef nonnull %call5) #8
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 #4
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
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 = { 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 #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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#define INFTY 2000000000
void merge(int*, int, int, int);
void mergeSort(int*, int, int);
int L[250002],R[250002];
int count;
int main(){
int A[500000],n;
int i;
scanf("%d",&n);
for(i = 0; i < n; i++){
scanf("%d",&A[i]);
}
mergeSort(A,0,n);
for(i = 0; i < n-1; i++){
printf("%d ",A[i]);
}
printf("%d\n%d\n",A[i],count);
return 0;
}
void merge(int* A, int left,int mid, int right){
int n1,n2;
int i,j,k;
n1 = mid - left;
n2 = right - mid;
for(i = 0; i < n1; i++){
L[i] = A[left + i];
}
for(i = 0; i < n2; i++){
R[i] = A[mid + i];
}
L[n1] = INFTY;
R[n2] = INFTY;
i = 0;
j = 0;
for(k = left; k < right; k++){
count++;
if(L[i] <= R[j]){
A[k] = L[i];
i = i + 1;
}
else{
A[k] = R[j];
j = j + 1;
}
}
}
void mergeSort(int* A, int left, int right){
int mid;
if(left + 1 < right){
mid = (left + right)/2;
mergeSort(A, left, mid);
mergeSort(A, mid, right);
merge(A, left, mid, right);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147791/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147791/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"%d\0A%d\0A\00", align 1
@count = dso_local local_unnamed_addr global i32 0, align 4
@L = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [500000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp323 = icmp sgt i32 %3, 1
br i1 %cmp323, label %for.body4, label %for.end10
for.body4: ; preds = %for.end, %for.body4
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.body4 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv28
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next29, %6
br i1 %cmp3, label %for.body4, label %for.end10.loopexit, !llvm.loop !11
for.end10.loopexit: ; preds = %for.body4
%7 = and i64 %indvars.iv.next29, 4294967295
br label %for.end10
for.end10: ; preds = %for.end10.loopexit, %for.end
%i.1.lcssa = phi i64 [ 0, %for.end ], [ %7, %for.end10.loopexit ]
%arrayidx12 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %i.1.lcssa
%8 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%9 = load i32, ptr @count, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #3 {
entry:
%A12 = ptrtoint ptr %A to i64
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub i32 %right, %div
%cmp67.i = icmp sgt i32 %sub.i, 0
br i1 %cmp67.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A12
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load13 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load13, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !15
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp569.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp569.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count81.i = zext i32 %sub1.i to i64
%invariant.gep88.i = getelementptr i32, ptr %A, i64 %13
%min.iters.check18 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check18, label %for.body6.i.preheader, label %vector.memcheck14
vector.memcheck14: ; preds = %for.body6.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A12
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check15 = icmp ult i64 %16, 32
br i1 %diff.check15, label %for.body6.i.preheader, label %vector.ph19
vector.ph19: ; preds = %vector.memcheck14
%n.vec21 = and i64 %wide.trip.count81.i, 4294967288
br label %vector.body24
vector.body24: ; preds = %vector.body24, %vector.ph19
%index25 = phi i64 [ 0, %vector.ph19 ], [ %index.next28, %vector.body24 ]
%17 = getelementptr i32, ptr %invariant.gep88.i, i64 %index25
%wide.load26 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load27 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index25
store <4 x i32> %wide.load26, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load27, ptr %20, align 16, !tbaa !5
%index.next28 = add nuw i64 %index25, 8
%21 = icmp eq i64 %index.next28, %n.vec21
br i1 %21, label %middle.block16, label %vector.body24, !llvm.loop !17
middle.block16: ; preds = %vector.body24
%cmp.n23 = icmp eq i64 %n.vec21, %wide.trip.count81.i
br i1 %cmp.n23, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck14, %for.body6.preheader.i, %middle.block16
%indvars.iv77.i.ph = phi i64 [ 0, %vector.memcheck14 ], [ 0, %for.body6.preheader.i ], [ %n.vec21, %middle.block16 ]
%22 = xor i64 %indvars.iv77.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count81.i
%xtraiter29 = and i64 %wide.trip.count81.i, 3
%lcmp.mod30.not = icmp eq i64 %xtraiter29, 0
br i1 %lcmp.mod30.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv77.i.prol = phi i64 [ %indvars.iv.next78.i.prol, %for.body6.i.prol ], [ %indvars.iv77.i.ph, %for.body6.i.preheader ]
%prol.iter31 = phi i64 [ %prol.iter31.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep89.i.prol = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv77.i.prol
%24 = load i32, ptr %gep89.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv77.i.prol
store i32 %24, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next78.i.prol = add nuw nsw i64 %indvars.iv77.i.prol, 1
%prol.iter31.next = add i64 %prol.iter31, 1
%prol.iter31.cmp.not = icmp eq i64 %prol.iter31.next, %xtraiter29
br i1 %prol.iter31.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !18
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv77.i.unr = phi i64 [ %indvars.iv77.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next78.i.prol, %for.body6.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !19
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv77.i = phi i64 [ %indvars.iv.next78.i.3, %for.body6.i ], [ %indvars.iv77.i.unr, %for.body6.i.prol.loopexit ]
%gep89.i = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv77.i
%30 = load i32, ptr %gep89.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv77.i
store i32 %30, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next78.i = add nuw nsw i64 %indvars.iv77.i, 1
%gep89.i.1 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i
%31 = load i32, ptr %gep89.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i
store i32 %31, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next78.i.1 = add nuw nsw i64 %indvars.iv77.i, 2
%gep89.i.2 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i.1
%32 = load i32, ptr %gep89.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i.1
store i32 %32, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next78.i.2 = add nuw nsw i64 %indvars.iv77.i, 3
%gep89.i.3 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i.2
%33 = load i32, ptr %gep89.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i.2
store i32 %33, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next78.i.3 = add nuw nsw i64 %indvars.iv77.i, 4
%exitcond82.not.i.3 = icmp eq i64 %indvars.iv.next78.i.3, %wide.trip.count81.i
br i1 %exitcond82.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !20
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block16, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub.i to i64
%arrayidx16.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom15.i
store i32 2000000000, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub1.i to i64
%arrayidx18.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom17.i
store i32 2000000000, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %left to i64
%wide.trip.count86.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv83.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next84.i, %for.body21.i ]
%j.073.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.body21.i ]
%i.272.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.body21.i ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22.i = add nsw i32 %35, 1
store i32 %inc22.i, ptr @count, align 4, !tbaa !5
%idxprom23.i = zext i32 %i.272.i to i64
%arrayidx24.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23.i
%36 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = zext i32 %j.073.i to i64
%arrayidx26.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25.i
%37 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%cmp27.not.i = icmp sle i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%add32.i = zext i1 %cmp27.not.i to i32
%i.3.i = add nuw nsw i32 %i.272.i, %add32.i
%not.cmp27.not.i = xor i1 %cmp27.not.i, true
%add37.i = zext i1 %not.cmp27.not.i to i32
%j.1.i = add nuw nsw i32 %j.073.i, %add37.i
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv83.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next84.i = add nsw i64 %indvars.iv83.i, 1
%exitcond87.not.i = icmp eq i64 %indvars.iv.next84.i, %wide.trip.count86.i
br i1 %exitcond87.not.i, label %if.end, label %for.body21.i, !llvm.loop !21
if.end: ; preds = %for.body21.i, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #3 {
entry:
%A90 = ptrtoint ptr %A to i64
%sub = sub nsw i32 %mid, %left
%sub1 = sub i32 %right, %mid
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader108, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A90
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader108, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load91 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load91, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !22
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond4.preheader, label %for.body.preheader108
for.body.preheader108: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader108, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader108 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader108 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !23
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader108
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader108 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp569 = icmp sgt i32 %sub1, 0
br i1 %cmp569, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %mid to i64
%wide.trip.count81 = zext i32 %sub1 to i64
%invariant.gep88 = getelementptr i32, ptr %A, i64 %13
%min.iters.check96 = icmp ult i32 %sub1, 12
br i1 %min.iters.check96, label %for.body6.preheader107, label %vector.memcheck92
vector.memcheck92: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A90
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check93 = icmp ult i64 %16, 32
br i1 %diff.check93, label %for.body6.preheader107, label %vector.ph97
vector.ph97: ; preds = %vector.memcheck92
%n.vec99 = and i64 %wide.trip.count81, 4294967288
br label %vector.body102
vector.body102: ; preds = %vector.body102, %vector.ph97
%index103 = phi i64 [ 0, %vector.ph97 ], [ %index.next106, %vector.body102 ]
%17 = getelementptr i32, ptr %invariant.gep88, i64 %index103
%wide.load104 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load105 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index103
store <4 x i32> %wide.load104, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load105, ptr %20, align 16, !tbaa !5
%index.next106 = add nuw i64 %index103, 8
%21 = icmp eq i64 %index.next106, %n.vec99
br i1 %21, label %middle.block94, label %vector.body102, !llvm.loop !24
middle.block94: ; preds = %vector.body102
%cmp.n101 = icmp eq i64 %n.vec99, %wide.trip.count81
br i1 %cmp.n101, label %for.end14, label %for.body6.preheader107
for.body6.preheader107: ; preds = %vector.memcheck92, %for.body6.preheader, %middle.block94
%indvars.iv77.ph = phi i64 [ 0, %vector.memcheck92 ], [ 0, %for.body6.preheader ], [ %n.vec99, %middle.block94 ]
%22 = xor i64 %indvars.iv77.ph, -1
%23 = add nsw i64 %22, %wide.trip.count81
%xtraiter109 = and i64 %wide.trip.count81, 3
%lcmp.mod110.not = icmp eq i64 %xtraiter109, 0
br i1 %lcmp.mod110.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader107, %for.body6.prol
%indvars.iv77.prol = phi i64 [ %indvars.iv.next78.prol, %for.body6.prol ], [ %indvars.iv77.ph, %for.body6.preheader107 ]
%prol.iter111 = phi i64 [ %prol.iter111.next, %for.body6.prol ], [ 0, %for.body6.preheader107 ]
%gep89.prol = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv77.prol
%24 = load i32, ptr %gep89.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv77.prol
store i32 %24, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next78.prol = add nuw nsw i64 %indvars.iv77.prol, 1
%prol.iter111.next = add i64 %prol.iter111, 1
%prol.iter111.cmp.not = icmp eq i64 %prol.iter111.next, %xtraiter109
br i1 %prol.iter111.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !25
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader107
%indvars.iv77.unr = phi i64 [ %indvars.iv77.ph, %for.body6.preheader107 ], [ %indvars.iv.next78.prol, %for.body6.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !26
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv77 = phi i64 [ %indvars.iv.next78.3, %for.body6 ], [ %indvars.iv77.unr, %for.body6.prol.loopexit ]
%gep89 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv77
%30 = load i32, ptr %gep89, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv77
store i32 %30, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%gep89.1 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78
%31 = load i32, ptr %gep89.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78
store i32 %31, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next78.1 = add nuw nsw i64 %indvars.iv77, 2
%gep89.2 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78.1
%32 = load i32, ptr %gep89.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.1
store i32 %32, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next78.2 = add nuw nsw i64 %indvars.iv77, 3
%gep89.3 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78.2
%33 = load i32, ptr %gep89.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.2
store i32 %33, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next78.3 = add nuw nsw i64 %indvars.iv77, 4
%exitcond82.not.3 = icmp eq i64 %indvars.iv.next78.3, %wide.trip.count81
br i1 %exitcond82.not.3, label %for.end14, label %for.body6, !llvm.loop !27
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block94, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom15
store i32 2000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom17
store i32 2000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2071 = icmp slt i32 %left, %right
br i1 %cmp2071, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %left to i64
%wide.trip.count86 = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv83 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next84, %for.body21 ]
%j.073 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%i.272 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22 = add nsw i32 %35, 1
store i32 %inc22, ptr @count, align 4, !tbaa !5
%idxprom23 = zext i32 %i.272 to i64
%arrayidx24 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23
%36 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.073 to i64
%arrayidx26 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25
%37 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sle i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%add32 = zext i1 %cmp27.not to i32
%i.3 = add nuw nsw i32 %i.272, %add32
%not.cmp27.not = xor i1 %cmp27.not, true
%add37 = zext i1 %not.cmp27.not to i32
%j.1 = add nuw nsw i32 %j.073, %add37
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv83
store i32 %.sink, ptr %38, align 4
%indvars.iv.next84 = add nsw i64 %indvars.iv83, 1
%exitcond87.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count86
br i1 %exitcond87.not, label %for.end40, label %for.body21, !llvm.loop !21
for.end40: ; preds = %for.body21, %for.end14
ret void
}
; 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 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !10, !13, !14}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !10, !13}
!20 = distinct !{!20, !10, !13}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10, !13, !14}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !10, !13, !14}
!25 = distinct !{!25, !16}
!26 = distinct !{!26, !10, !13}
!27 = distinct !{!27, !10, !13}
|
#include<stdio.h>
#include<stdlib.h>
void merge(int *A, int left, int mid, int right);
void mergeSort(int *A, int left, int right);
int count = 0;
int main(){
int i,n,left,right;
int *S;
scanf("%d",&n);
//printf("a\n");
S = (int *)malloc(sizeof(int) * n);
for(i = 0 ; i < n ; i++)
scanf("%d",&S[i]);
left = 0;
right = n;
//printf("a\n");
mergeSort(S, left, right);
//printf("a\n");
for(i = 0 ; i < n ; i++){
printf("%d",S[i]);
if(i < n-1) printf(" ");
}
printf("\n%d\n",count);
return 0;
}
void merge(int *A, int left, int mid, int right){
int n1,n2,i,j,k;
int *L,*R;
n1 = mid - left;
n2 = right - mid;
L = (int *)malloc(sizeof(int) * (n1+1));
R = (int *)malloc(sizeof(int) * (n2+1));
for(i = 0 ; i < n1 ; i++)
L[i] = A[left + i];
for(i = 0 ; i < n2 ; i++)
R[i] = A[mid + i];
L[n1] = 1000000000;
R[n2] = 1000000000;
i = 0;
j = 0;
for(k = left ; k < right ; k++){
if(L[i] <= R[j]){
A[k] = L[i];
i = i + 1;
count++;
}
else{
A[k] = R[j];
j = j + 1;
count++;
}
}
}
void mergeSort(int *A, int left, int right){
int mid;
if(left + 1 < right){
mid = (left + right) / 2;
mergeSort(A,left,mid);
mergeSort(A,mid,right);
merge(A,left,mid,right);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147841/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147841/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%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) #7
%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) #8
%cmp26 = icmp sgt i32 %0, 0
br i1 %cmp26, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef %call1, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp528 = icmp sgt i32 %3, 0
br i1 %cmp528, label %for.body7, label %for.end16
for.body7: ; preds = %for.end, %for.inc14
%indvars.iv32 = phi i64 [ %indvars.iv.next33, %for.inc14 ], [ 0, %for.end ]
%arrayidx9 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv32
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp11 = icmp slt i64 %indvars.iv32, %6
br i1 %cmp11, label %if.then, label %for.inc14
if.then: ; preds = %for.body7
%putchar = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc14
for.inc14: ; preds = %for.body7, %if.then
%7 = phi i32 [ %5, %for.body7 ], [ %.pre, %if.then ]
%indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1
%8 = sext i32 %7 to i64
%cmp5 = icmp slt i64 %indvars.iv.next33, %8
br i1 %cmp5, label %for.body7, label %for.end16, !llvm.loop !11
for.end16: ; preds = %for.inc14, %for.end
%9 = load i32, ptr @count, align 4, !tbaa !5
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 2
%call = tail call noalias ptr @malloc(i64 noundef %mul) #8
%add2 = add nsw i32 %sub1, 1
%conv3 = sext i32 %add2 to i64
%mul4 = shl nsw i64 %conv3, 2
%call5 = tail call noalias ptr @malloc(i64 noundef %mul4) #8
%cmp85 = icmp sgt i32 %sub, 0
br i1 %cmp85, label %for.body.preheader, label %for.cond10.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond10.preheader
for.cond10.preheader: ; preds = %for.body.preheader, %entry
%cmp1187 = icmp sgt i32 %sub1, 0
br i1 %cmp1187, label %for.body13.preheader, label %for.end21
for.body13.preheader: ; preds = %for.cond10.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep95 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call5, ptr noundef nonnull align 4 dereferenceable(1) %scevgep95, i64 %13, i1 false), !tbaa !5
br label %for.end21
for.end21: ; preds = %for.body13.preheader, %for.cond10.preheader
%idxprom22 = sext i32 %sub to i64
%arrayidx23 = getelementptr inbounds i32, ptr %call, i64 %idxprom22
store i32 1000000000, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = sext i32 %sub1 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %call5, i64 %idxprom24
store i32 1000000000, ptr %arrayidx25, align 4, !tbaa !5
%cmp2789 = icmp slt i32 %left, %right
br i1 %cmp2789, label %for.body29.preheader, label %for.end50
for.body29.preheader: ; preds = %for.end21
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body29
for.body29: ; preds = %for.body29.preheader, %for.body29
%indvars.iv = phi i64 [ %14, %for.body29.preheader ], [ %indvars.iv.next, %for.body29 ]
%i.292 = phi i32 [ 0, %for.body29.preheader ], [ %i.3, %for.body29 ]
%j.091 = phi i32 [ 0, %for.body29.preheader ], [ %j.1, %for.body29 ]
%idxprom30 = zext i32 %i.292 to i64
%arrayidx31 = getelementptr inbounds i32, ptr %call, i64 %idxprom30
%15 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%idxprom32 = zext i32 %j.091 to i64
%arrayidx33 = getelementptr inbounds i32, ptr %call5, i64 %idxprom32
%16 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%cmp34.not = icmp sgt i32 %15, %16
%.sink = tail call i32 @llvm.smin.i32(i32 %15, i32 %16)
%add46 = zext i1 %cmp34.not to i32
%j.1 = add nuw nsw i32 %j.091, %add46
%not.cmp34.not = xor i1 %cmp34.not, true
%add40 = zext i1 %not.cmp34.not to i32
%i.3 = add nuw nsw i32 %i.292, %add40
%17 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %17, align 4
%storemerge.in = load i32, ptr @count, align 4, !tbaa !5
%storemerge = add nsw i32 %storemerge.in, 1
store i32 %storemerge, ptr @count, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end50, label %for.body29, !llvm.loop !12
for.end50: ; preds = %for.body29, %for.end21
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; 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) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.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 = { 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 nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <stdlib.h>
void mergeSort(int*,int,int);
void merge(int*,int,int,int);
int count=0;
int main(){
int i,n,*S;
scanf("%d",&n);
S=(int*)malloc(sizeof(int)*n);
for(i=0;i<n;i++)
scanf("%d",&S[i]);
mergeSort(S,0,n);
for(i=0;i<n;i++){
printf("%d",S[i]);
if(i<n-1)
printf(" ");
}
printf("\n%d\n",count);
return 0;
}
void mergeSort(int *A, int left, int right){
int mid,i;
if (left+1<right){
mid = (left + right)/2;
mergeSort(A, left, mid);
mergeSort(A, mid, right);
merge(A, left, mid, right);
}
}
void merge(int *A,int left,int mid,int right){
int n1,n2,*L,*R,i,k,j;
n1=mid-left;
n2=right-mid;
L=(int*)malloc(sizeof(int)*(n1+1));
R=(int*)malloc(sizeof(int)*(n2+1));
for(i=0;i<n1;i++){
L[i]=A[left+i];
}
for(i=0;i<n2;i++){
R[i]=A[mid +i];
}
L[n1]=1073741823;
R[n2]=1073741823;
i=0;
j=0;
for (k=left;k<right;k++){
if(L[i]<=R[j]){
A[k]=L[i];
i=i+1;
}
else{
A[k]=R[j];
j=j+1;
}
count++;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147885/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147885/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%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) #7
%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) #8
%cmp26 = icmp sgt i32 %0, 0
br i1 %cmp26, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef %call1, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp528 = icmp sgt i32 %3, 0
br i1 %cmp528, label %for.body7, label %for.end16
for.body7: ; preds = %for.end, %for.inc14
%indvars.iv32 = phi i64 [ %indvars.iv.next33, %for.inc14 ], [ 0, %for.end ]
%arrayidx9 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv32
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp11 = icmp slt i64 %indvars.iv32, %6
br i1 %cmp11, label %if.then, label %for.inc14
if.then: ; preds = %for.body7
%putchar = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc14
for.inc14: ; preds = %for.body7, %if.then
%7 = phi i32 [ %5, %for.body7 ], [ %.pre, %if.then ]
%indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1
%8 = sext i32 %7 to i64
%cmp5 = icmp slt i64 %indvars.iv.next33, %8
br i1 %cmp5, label %for.body7, label %for.end16, !llvm.loop !11
for.end16: ; preds = %for.inc14, %for.end
%9 = load i32, ptr @count, align 4, !tbaa !5
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 2
%call = tail call noalias ptr @malloc(i64 noundef %mul) #8
%add2 = add nsw i32 %sub1, 1
%conv3 = sext i32 %add2 to i64
%mul4 = shl nsw i64 %conv3, 2
%call5 = tail call noalias ptr @malloc(i64 noundef %mul4) #8
%cmp84 = icmp sgt i32 %sub, 0
br i1 %cmp84, label %for.body.preheader, label %for.cond10.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond10.preheader
for.cond10.preheader: ; preds = %for.body.preheader, %entry
%cmp1186 = icmp sgt i32 %sub1, 0
br i1 %cmp1186, label %for.body13.preheader, label %for.end21
for.body13.preheader: ; preds = %for.cond10.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep94 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call5, ptr noundef nonnull align 4 dereferenceable(1) %scevgep94, i64 %13, i1 false), !tbaa !5
br label %for.end21
for.end21: ; preds = %for.body13.preheader, %for.cond10.preheader
%idxprom22 = sext i32 %sub to i64
%arrayidx23 = getelementptr inbounds i32, ptr %call, i64 %idxprom22
store i32 1073741823, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = sext i32 %sub1 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %call5, i64 %idxprom24
store i32 1073741823, ptr %arrayidx25, align 4, !tbaa !5
%cmp2788 = icmp slt i32 %left, %right
br i1 %cmp2788, label %for.body29.preheader, label %for.end49
for.body29.preheader: ; preds = %for.end21
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body29
for.body29: ; preds = %for.body29.preheader, %for.body29
%indvars.iv = phi i64 [ %14, %for.body29.preheader ], [ %indvars.iv.next, %for.body29 ]
%j.091 = phi i32 [ 0, %for.body29.preheader ], [ %j.1, %for.body29 ]
%i.289 = phi i32 [ 0, %for.body29.preheader ], [ %i.3, %for.body29 ]
%idxprom30 = zext i32 %i.289 to i64
%arrayidx31 = getelementptr inbounds i32, ptr %call, i64 %idxprom30
%15 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%idxprom32 = zext i32 %j.091 to i64
%arrayidx33 = getelementptr inbounds i32, ptr %call5, i64 %idxprom32
%16 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%cmp34.not = icmp sle i32 %15, %16
%.sink = tail call i32 @llvm.smin.i32(i32 %15, i32 %16)
%add40 = zext i1 %cmp34.not to i32
%i.3 = add nuw nsw i32 %i.289, %add40
%not.cmp34.not = xor i1 %cmp34.not, true
%add45 = zext i1 %not.cmp34.not to i32
%j.1 = add nuw nsw i32 %j.091, %add45
%17 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %17, align 4
%18 = load i32, ptr @count, align 4, !tbaa !5
%inc46 = add nsw i32 %18, 1
store i32 %inc46, ptr @count, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end49, label %for.body29, !llvm.loop !12
for.end49: ; preds = %for.body29, %for.end21
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; 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) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.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 = { 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 nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void trace(int A[], int n){
int i;
for ( i = 0; i < n; i++ ){
if ( i > 0 ) printf(" ");
printf("%d", A[i]);
}
printf("\n");
}
int count = 0;
void doMS(int A[], int head, int len)
{
if (len < 2)
return;
int toplen = len / 2;
int botlen = len - toplen;
int tophead = head;
int bothead = tophead + toplen;
doMS(A, tophead, toplen);
doMS(A, bothead, botlen);
// merge top and bottom
int res[len];
int i = tophead;
int j = bothead;
int res_i = 0;
while (i < tophead + toplen || j < bothead + botlen)
{
if (i >= tophead + toplen)
{
memcpy(res + res_i, A + j, sizeof(int) * (bothead + botlen - j));
count += bothead + botlen - j;
break;
}
if (j >= bothead + botlen)
{
memcpy(res + res_i, A + i, sizeof(int) * (tophead + toplen - i));
count += tophead + toplen - i;
break;
}
res[res_i++] = A[i] > A[j] ? A[j++] : A[i++];
count++;
}
memcpy(A + head, res, sizeof(int) * len);
}
void heapify(int *A, int root, int end)
{
int i = root;
int temp = 0;
while(i * 2 + 1 <= end)
{
int c = i * 2 + 1;
if (c + 1 <= end && A[c + 1] > A[c])
c++;
if(A[c] > A[i])
{
temp = A[i];
A[i] = A[c];
A[c] = temp;
}
else
break;
i = c;
}
}
void doHS(int *A, int n)
{
for(int i = n / 2; i >= 0; i--)
{
heapify(A, i, n - 1);
}
for(int i = n - 1; i > 0 ; i--)
{
int temp = A[i];
A[i] = A[0];
A[0] = temp;
heapify(A, 0, i - 1);
}
}
int main(){
int n, i, j, key, temp;
int *A, *B;
//extern count;
scanf("%d", &n);
A = malloc(sizeof(int) * n);
B = malloc(sizeof(int) * n);
for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
memcpy(B, A, sizeof(int) * n);
doMS(A, 0, n);
doHS(B, n);
trace(B, n);
printf("%d\n", count);
return 0;
}
/*
8 5 9 2 6 3 7 1 10 4
*/ | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147942/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147942/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @trace(ptr nocapture noundef readonly %A, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp8 = icmp sgt i32 %n, 0
br i1 %cmp8, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%.pre = load i32, ptr %A, align 4, !tbaa !5
%call2.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %n, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar7 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
%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 %if.end, !llvm.loop !9
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind uwtable
define dso_local void @doMS(ptr noundef %A, i32 noundef %head, i32 noundef %len) local_unnamed_addr #3 {
entry:
%cmp = icmp slt i32 %len, 2
br i1 %cmp, label %return, label %while.body.preheader
while.body.preheader: ; preds = %entry
%div98 = lshr i32 %len, 1
%sub = sub nsw i32 %len, %div98
%add = add nsw i32 %div98, %head
tail call void @doMS(ptr noundef %A, i32 noundef %head, i32 noundef %div98)
tail call void @doMS(ptr noundef %A, i32 noundef %add, i32 noundef %sub)
%0 = zext i32 %len to i64
%1 = tail call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %0, align 16
%add3 = add i32 %len, %head
%cmp4109 = icmp slt i32 %add, %add3
%count.promoted = load i32, ptr @count, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.preheader, %if.end31
%indvars.iv = phi i64 [ 0, %while.body.preheader ], [ %indvars.iv.next, %if.end31 ]
%cmp4116 = phi i1 [ %cmp4109, %while.body.preheader ], [ %cmp4, %if.end31 ]
%cmp2115 = phi i1 [ true, %while.body.preheader ], [ %cmp2, %if.end31 ]
%j.0113 = phi i32 [ %add, %while.body.preheader ], [ %j.1, %if.end31 ]
%i.0112 = phi i32 [ %head, %while.body.preheader ], [ %i.1, %if.end31 ]
%2 = phi i32 [ %count.promoted, %while.body.preheader ], [ %inc44, %if.end31 ]
br i1 %cmp2115, label %if.end15, label %if.then7
if.then7: ; preds = %while.body
%idx.ext = and i64 %indvars.iv, 4294967295
%add.ptr = getelementptr inbounds i32, ptr %vla, i64 %idx.ext
%idx.ext8 = sext i32 %j.0113 to i64
%add.ptr9 = getelementptr inbounds i32, ptr %A, i64 %idx.ext8
%sub11 = sub nsw i32 %add3, %j.0113
%conv = sext i32 %sub11 to i64
%mul = shl nsw i64 %conv, 2
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %add.ptr, ptr align 4 %add.ptr9, i64 %mul, i1 false)
br label %while.end.sink.split
if.end15: ; preds = %while.body
br i1 %cmp4116, label %if.end31, label %if.then19
if.then19: ; preds = %if.end15
%idx.ext20 = and i64 %indvars.iv, 4294967295
%add.ptr21 = getelementptr inbounds i32, ptr %vla, i64 %idx.ext20
%idx.ext22 = sext i32 %i.0112 to i64
%add.ptr23 = getelementptr inbounds i32, ptr %A, i64 %idx.ext22
%sub25 = sub nsw i32 %add, %i.0112
%conv26 = sext i32 %sub25 to i64
%mul27 = shl nsw i64 %conv26, 2
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %add.ptr21, ptr align 4 %add.ptr23, i64 %mul27, i1 false)
br label %while.end.sink.split
if.end31: ; preds = %if.end15
%idxprom = sext i32 %i.0112 to i64
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom32 = sext i32 %j.0113 to i64
%arrayidx33 = getelementptr inbounds i32, ptr %A, i64 %idxprom32
%4 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%cmp34 = icmp sle i32 %3, %4
%inc38 = zext i1 %cmp34 to i32
%i.1 = add nsw i32 %i.0112, %inc38
%not.cmp34 = xor i1 %cmp34, true
%inc = zext i1 %not.cmp34 to i32
%j.1 = add nsw i32 %j.0113, %inc
%cond = tail call i32 @llvm.smin.i32(i32 %3, i32 %4)
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx43 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
store i32 %cond, ptr %arrayidx43, align 4, !tbaa !5
%inc44 = add nsw i32 %2, 1
store i32 %inc44, ptr @count, align 4, !tbaa !5
%cmp2 = icmp slt i32 %i.1, %add
%cmp4 = icmp slt i32 %j.1, %add3
%or.cond = select i1 %cmp2, i1 true, i1 %cmp4
br i1 %or.cond, label %while.body, label %while.end, !llvm.loop !12
while.end.sink.split: ; preds = %if.then7, %if.then19
%sub25.pn = phi i32 [ %sub25, %if.then19 ], [ %sub11, %if.then7 ]
%add30.sink = add nsw i32 %2, %sub25.pn
store i32 %add30.sink, ptr @count, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %if.end31, %while.end.sink.split
%idx.ext45 = sext i32 %head to i64
%add.ptr46 = getelementptr inbounds i32, ptr %A, i64 %idx.ext45
%mul48 = shl nuw nsw i64 %0, 2
call void @llvm.memcpy.p0.p0.i64(ptr align 4 %add.ptr46, ptr nonnull align 16 %vla, i64 %mul48, i1 false)
tail call void @llvm.stackrestore.p0(ptr %1)
br label %return
return: ; preds = %entry, %while.end
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; 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) #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @heapify(ptr nocapture noundef %A, i32 noundef %root, i32 noundef %end) local_unnamed_addr #6 {
entry:
%mul47 = shl nsw i32 %root, 1
%add48 = or i32 %mul47, 1
%cmp.not49 = icmp sgt i32 %add48, %end
br i1 %cmp.not49, label %while.end, label %while.body
while.body: ; preds = %entry, %cleanup
%add52 = phi i32 [ %add, %cleanup ], [ %add48, %entry ]
%mul51 = phi i32 [ %mul, %cleanup ], [ %mul47, %entry ]
%i.050 = phi i32 [ %c.0, %cleanup ], [ %root, %entry ]
%add3 = add i32 %mul51, 2
%cmp4.not = icmp sgt i32 %add3, %end
br i1 %cmp4.not, label %if.end, label %land.lhs.true
land.lhs.true: ; preds = %while.body
%idxprom = sext i32 %add3 to i64
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom6 = sext i32 %add52 to i64
%arrayidx7 = getelementptr inbounds i32, ptr %A, i64 %idxprom6
%1 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8 = icmp sgt i32 %0, %1
%spec.select = select i1 %cmp8, i32 %add3, i32 %add52
br label %if.end
if.end: ; preds = %land.lhs.true, %while.body
%c.0 = phi i32 [ %add52, %while.body ], [ %spec.select, %land.lhs.true ]
%idxprom9 = sext i32 %c.0 to i64
%arrayidx10 = getelementptr inbounds i32, ptr %A, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%idxprom11 = sext i32 %i.050 to i64
%arrayidx12 = getelementptr inbounds i32, ptr %A, i64 %idxprom11
%3 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13 = icmp sgt i32 %2, %3
br i1 %cmp13, label %cleanup, label %while.end
cleanup: ; preds = %if.end
store i32 %2, ptr %arrayidx12, align 4, !tbaa !5
store i32 %3, ptr %arrayidx10, align 4, !tbaa !5
%mul = shl nsw i32 %c.0, 1
%add = or i32 %mul, 1
%cmp.not = icmp sgt i32 %add, %end
br i1 %cmp.not, label %while.end, label %while.body
while.end: ; preds = %cleanup, %if.end, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @doHS(ptr nocapture noundef %A, i32 noundef %n) local_unnamed_addr #6 {
entry:
%cmp54 = icmp sgt i32 %n, -2
br i1 %cmp54, label %for.body.preheader, label %for.cond.cleanup5
for.body.preheader: ; preds = %entry
%div = sdiv i32 %n, 2
br label %for.body
for.cond3.preheader: ; preds = %heapify.exit
%cmp456 = icmp sgt i32 %n, 1
br i1 %cmp456, label %for.body6.preheader, label %for.cond.cleanup5
for.body6.preheader: ; preds = %for.cond3.preheader
%0 = zext i32 %n to i64
br label %for.body6
for.body: ; preds = %for.body.preheader, %heapify.exit
%i.055 = phi i32 [ %dec, %heapify.exit ], [ %div, %for.body.preheader ]
%mul47.i = shl nuw nsw i32 %i.055, 1
%add48.i = or i32 %mul47.i, 1
%cmp.not49.i.not = icmp slt i32 %add48.i, %n
br i1 %cmp.not49.i.not, label %while.body.i, label %heapify.exit
while.body.i: ; preds = %for.body, %cleanup.i
%add52.i = phi i32 [ %add.i, %cleanup.i ], [ %add48.i, %for.body ]
%mul51.i = phi i32 [ %mul.i, %cleanup.i ], [ %mul47.i, %for.body ]
%i.050.i = phi i32 [ %c.0.i, %cleanup.i ], [ %i.055, %for.body ]
%add3.i = add i32 %mul51.i, 2
%cmp4.not.i.not = icmp slt i32 %add3.i, %n
br i1 %cmp4.not.i.not, label %land.lhs.true.i, label %if.end.i
land.lhs.true.i: ; preds = %while.body.i
%idxprom.i = sext i32 %add3.i to i64
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %idxprom.i
%1 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%idxprom6.i = sext i32 %add52.i to i64
%arrayidx7.i = getelementptr inbounds i32, ptr %A, i64 %idxprom6.i
%2 = load i32, ptr %arrayidx7.i, align 4, !tbaa !5
%cmp8.i = icmp sgt i32 %1, %2
%spec.select.i = select i1 %cmp8.i, i32 %add3.i, i32 %add52.i
br label %if.end.i
if.end.i: ; preds = %land.lhs.true.i, %while.body.i
%c.0.i = phi i32 [ %add52.i, %while.body.i ], [ %spec.select.i, %land.lhs.true.i ]
%idxprom9.i = sext i32 %c.0.i to i64
%arrayidx10.i = getelementptr inbounds i32, ptr %A, i64 %idxprom9.i
%3 = load i32, ptr %arrayidx10.i, align 4, !tbaa !5
%idxprom11.i = sext i32 %i.050.i to i64
%arrayidx12.i = getelementptr inbounds i32, ptr %A, i64 %idxprom11.i
%4 = load i32, ptr %arrayidx12.i, align 4, !tbaa !5
%cmp13.i = icmp sgt i32 %3, %4
br i1 %cmp13.i, label %cleanup.i, label %heapify.exit
cleanup.i: ; preds = %if.end.i
store i32 %3, ptr %arrayidx12.i, align 4, !tbaa !5
store i32 %4, ptr %arrayidx10.i, align 4, !tbaa !5
%mul.i = shl nsw i32 %c.0.i, 1
%add.i = or i32 %mul.i, 1
%cmp.not.i.not = icmp slt i32 %add.i, %n
br i1 %cmp.not.i.not, label %while.body.i, label %heapify.exit
heapify.exit: ; preds = %if.end.i, %cleanup.i, %for.body
%dec = add nsw i32 %i.055, -1
%cmp = icmp sgt i32 %i.055, 0
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !13
for.cond.cleanup5: ; preds = %heapify.exit53, %entry, %for.cond3.preheader
ret void
for.body6: ; preds = %for.body6.preheader, %heapify.exit53
%indvars.iv = phi i64 [ %0, %for.body6.preheader ], [ %indvars.iv.next, %heapify.exit53 ]
%indvars58 = trunc i64 %indvars.iv to i32
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%idxprom = and i64 %indvars.iv.next, 4294967295
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%6 = load i32, ptr %A, align 4, !tbaa !5
store i32 %6, ptr %arrayidx, align 4, !tbaa !5
store i32 %5, ptr %A, align 4, !tbaa !5
%sub11 = add nsw i32 %indvars58, -2
%cmp.not49.i28 = icmp eq i32 %sub11, 0
br i1 %cmp.not49.i28, label %heapify.exit53, label %while.body.i29
while.body.i29: ; preds = %for.body6, %cleanup.i49
%add52.i30 = phi i32 [ %add.i51, %cleanup.i49 ], [ 1, %for.body6 ]
%mul51.i31 = phi i32 [ %mul.i50, %cleanup.i49 ], [ 0, %for.body6 ]
%i.050.i32 = phi i32 [ %c.0.i43, %cleanup.i49 ], [ 0, %for.body6 ]
%add3.i33 = add i32 %mul51.i31, 2
%cmp4.not.i34 = icmp sgt i32 %add3.i33, %sub11
br i1 %cmp4.not.i34, label %if.end.i42, label %land.lhs.true.i35
land.lhs.true.i35: ; preds = %while.body.i29
%idxprom.i36 = sext i32 %add3.i33 to i64
%arrayidx.i37 = getelementptr inbounds i32, ptr %A, i64 %idxprom.i36
%7 = load i32, ptr %arrayidx.i37, align 4, !tbaa !5
%idxprom6.i38 = sext i32 %add52.i30 to i64
%arrayidx7.i39 = getelementptr inbounds i32, ptr %A, i64 %idxprom6.i38
%8 = load i32, ptr %arrayidx7.i39, align 4, !tbaa !5
%cmp8.i40 = icmp sgt i32 %7, %8
%spec.select.i41 = select i1 %cmp8.i40, i32 %add3.i33, i32 %add52.i30
br label %if.end.i42
if.end.i42: ; preds = %land.lhs.true.i35, %while.body.i29
%c.0.i43 = phi i32 [ %add52.i30, %while.body.i29 ], [ %spec.select.i41, %land.lhs.true.i35 ]
%idxprom9.i44 = sext i32 %c.0.i43 to i64
%arrayidx10.i45 = getelementptr inbounds i32, ptr %A, i64 %idxprom9.i44
%9 = load i32, ptr %arrayidx10.i45, align 4, !tbaa !5
%cmp13.i48 = icmp sgt i32 %9, %5
br i1 %cmp13.i48, label %cleanup.i49, label %heapify.exit53
cleanup.i49: ; preds = %if.end.i42
%idxprom11.i46 = sext i32 %i.050.i32 to i64
%arrayidx12.i47 = getelementptr inbounds i32, ptr %A, i64 %idxprom11.i46
store i32 %9, ptr %arrayidx12.i47, align 4, !tbaa !5
store i32 %5, ptr %arrayidx10.i45, align 4, !tbaa !5
%mul.i50 = shl nsw i32 %c.0.i43, 1
%add.i51 = or i32 %mul.i50, 1
%cmp.not.i52 = icmp sgt i32 %add.i51, %sub11
br i1 %cmp.not.i52, label %heapify.exit53, label %while.body.i29
heapify.exit53: ; preds = %if.end.i42, %cleanup.i49, %for.body6
%cmp4 = icmp sgt i64 %indvars.iv, 2
br i1 %cmp4, label %for.body6, label %for.cond.cleanup5, !llvm.loop !14
}
; 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) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, 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) #11
%call4 = call noalias ptr @malloc(i64 noundef %mul) #11
%cmp16 = icmp sgt i32 %0, 0
br i1 %cmp16, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !15
for.end.loopexit: ; preds = %for.body
%.pre = shl nsw i64 %2, 2
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%mul8.pre-phi = phi i64 [ %.pre, %for.end.loopexit ], [ %mul, %entry ]
%.lcssa = phi i32 [ %1, %for.end.loopexit ], [ %0, %entry ]
call void @llvm.memcpy.p0.p0.i64(ptr align 4 %call4, ptr align 4 %call1, i64 %mul8.pre-phi, i1 false)
call void @doMS(ptr noundef %call1, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
call void @doHS(ptr noundef %call4, i32 noundef %3)
%cmp8.i = icmp sgt i32 %3, 0
br i1 %cmp8.i, label %if.end.peel.i, label %trace.exit
if.end.peel.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %3 to i64
%.pre.i = load i32, ptr %call4, align 4, !tbaa !5
%call2.peel.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.i)
%exitcond.peel.not.i = icmp eq i32 %3, 1
br i1 %exitcond.peel.not.i, label %trace.exit, label %if.end.i
if.end.i: ; preds = %if.end.peel.i, %if.end.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %if.end.i ], [ 1, %if.end.peel.i ]
%putchar7.i = call i32 @putchar(i32 32)
%arrayidx.i = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv.i
%4 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call2.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%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 %trace.exit, label %if.end.i, !llvm.loop !9
trace.exit: ; preds = %if.end.i, %for.end, %if.end.peel.i
%putchar.i = call i32 @putchar(i32 10)
%5 = load i32, ptr @count, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %5)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #10
ret i32 0
}
; 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 #7
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #9
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 uwtable "min-legal-vector-width"="0" "no-trapping-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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { 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 #8 = { nofree nounwind }
attributes #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { nounwind }
attributes #11 = { 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}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#define MAX 500000
#define SENTINEL 2000000000
static int L[MAX / 2 + 1];
static int R[MAX / 2 + 1];
static int num_comparison;
void merge(int A[], int n, int left, int mid, int right)
{
int n1 = mid - left;
int n2 = right - mid;
for (int i = 0; i < n1; i++) {
L[i] = A[left + i];
}
for (int i = 0; i < n2; i++) {
R[i] = A[mid + i];
}
L[n1] = R[n2] = SENTINEL;
int i = 0, j = 0;
for (int k = left; k < right; k++) {
num_comparison++;
if (L[i] <= R[j]) {
A[k] = L[i++];
} else {
A[k] = R[j++];
}
}
}
void mergeSort(int A[], int n, int left, int right)
{
if (left + 1 < right) {
int mid = (left + right) / 2;
mergeSort(A, n, left, mid);
mergeSort(A, n, mid, right);
merge(A, n, left, mid, right);
}
}
int main()
{
int n;
int A[MAX];
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &A[i]);
}
mergeSort(A, n, 0, n);
for (int i = 0; i < n; i++) {
if (i > 0) {
printf(" ");
}
printf("%d", A[i]);
}
printf("\n");
printf("%d\n", num_comparison);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_147986/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_147986/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@L = internal unnamed_addr global [250001 x i32] zeroinitializer, align 16
@R = internal unnamed_addr global [250001 x i32] zeroinitializer, align 16
@num_comparison = internal unnamed_addr global i32 0, align 4
@.str = 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
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond5.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @L, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond5.preheader
for.cond5.preheader: ; preds = %for.body.preheader, %entry
%cmp669 = icmp sgt i32 %sub1, 0
br i1 %cmp669, label %for.body8.preheader, label %for.cond.cleanup7
for.body8.preheader: ; preds = %for.cond5.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep79 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @R, ptr noundef nonnull align 4 dereferenceable(1) %scevgep79, i64 %13, i1 false), !tbaa !5
br label %for.cond.cleanup7
for.cond.cleanup7: ; preds = %for.body8.preheader, %for.cond5.preheader
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %idxprom17
store i32 2000000000, ptr %arrayidx18, align 4, !tbaa !5
%idxprom19 = sext i32 %sub to i64
%arrayidx20 = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %idxprom19
store i32 2000000000, ptr %arrayidx20, align 4, !tbaa !5
%cmp2372 = icmp slt i32 %left, %right
br i1 %cmp2372, label %for.body25.preheader, label %for.cond.cleanup24
for.body25.preheader: ; preds = %for.cond.cleanup7
%num_comparison.promoted = load i32, ptr @num_comparison, align 4, !tbaa !5
%14 = sext i32 %left to i64
%15 = add i32 %num_comparison.promoted, %right
%wide.trip.count = sext i32 %right to i64
br label %for.body25
for.cond22.for.cond.cleanup24_crit_edge: ; preds = %for.body25
%16 = sub i32 %15, %left
store i32 %16, ptr @num_comparison, align 4, !tbaa !5
br label %for.cond.cleanup24
for.cond.cleanup24: ; preds = %for.cond22.for.cond.cleanup24_crit_edge, %for.cond.cleanup7
ret void
for.body25: ; preds = %for.body25.preheader, %for.body25
%indvars.iv = phi i64 [ %14, %for.body25.preheader ], [ %indvars.iv.next, %for.body25 ]
%j.075 = phi i32 [ 0, %for.body25.preheader ], [ %j.1, %for.body25 ]
%i21.074 = phi i32 [ 0, %for.body25.preheader ], [ %i21.1, %for.body25 ]
%idxprom27 = zext i32 %i21.074 to i64
%arrayidx28 = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %idxprom27
%17 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%idxprom29 = zext i32 %j.075 to i64
%arrayidx30 = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %idxprom29
%18 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%cmp31.not = icmp sle i32 %17, %18
%.sink = tail call i32 @llvm.smin.i32(i32 %17, i32 %18)
%inc32 = zext i1 %cmp31.not to i32
%i21.1 = add nuw nsw i32 %i21.074, %inc32
%not.cmp31.not = xor i1 %cmp31.not, true
%inc37 = zext i1 %not.cmp31.not to i32
%j.1 = add nuw nsw i32 %j.075, %inc37
%19 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %19, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond22.for.cond.cleanup24_crit_edge, label %for.body25, !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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %n, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %n, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %n, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub nsw i32 %right, %div
%cmp67.i = icmp sgt i32 %sub.i, 0
br i1 %cmp67.i, label %for.body.preheader.i, label %for.cond5.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep.i = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %div, %2
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @L, ptr noundef nonnull align 4 dereferenceable(1) %scevgep.i, i64 %6, i1 false), !tbaa !5
br label %for.cond5.preheader.i
for.cond5.preheader.i: ; preds = %for.body.preheader.i, %if.then
%cmp669.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp669.i, label %for.body8.preheader.i, label %for.cond.cleanup7.i
for.body8.preheader.i: ; preds = %for.cond5.preheader.i
%7 = sext i32 %div to i64
%8 = shl nsw i64 %7, 2
%scevgep79.i = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %div, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @R, ptr noundef nonnull align 4 dereferenceable(1) %scevgep79.i, i64 %13, i1 false), !tbaa !5
br label %for.cond.cleanup7.i
for.cond.cleanup7.i: ; preds = %for.body8.preheader.i, %for.cond5.preheader.i
%idxprom17.i = sext i32 %sub1.i to i64
%arrayidx18.i = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %idxprom17.i
store i32 2000000000, ptr %arrayidx18.i, align 4, !tbaa !5
%idxprom19.i = sext i32 %sub.i to i64
%arrayidx20.i = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %idxprom19.i
store i32 2000000000, ptr %arrayidx20.i, align 4, !tbaa !5
%num_comparison.promoted.i = load i32, ptr @num_comparison, align 4, !tbaa !5
%14 = sext i32 %left to i64
%wide.trip.count.i = sext i32 %right to i64
br label %for.body25.i
for.cond22.for.cond.cleanup24_crit_edge.i: ; preds = %for.body25.i
%15 = sub i32 %right, %left
%16 = add i32 %15, %num_comparison.promoted.i
store i32 %16, ptr @num_comparison, align 4, !tbaa !5
br label %if.end
for.body25.i: ; preds = %for.body25.i, %for.cond.cleanup7.i
%indvars.iv.i = phi i64 [ %14, %for.cond.cleanup7.i ], [ %indvars.iv.next.i, %for.body25.i ]
%j.075.i = phi i32 [ 0, %for.cond.cleanup7.i ], [ %j.1.i, %for.body25.i ]
%i21.074.i = phi i32 [ 0, %for.cond.cleanup7.i ], [ %i21.1.i, %for.body25.i ]
%idxprom27.i = zext i32 %i21.074.i to i64
%arrayidx28.i = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %idxprom27.i
%17 = load i32, ptr %arrayidx28.i, align 4, !tbaa !5
%idxprom29.i = zext i32 %j.075.i to i64
%arrayidx30.i = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %idxprom29.i
%18 = load i32, ptr %arrayidx30.i, align 4, !tbaa !5
%cmp31.not.i = icmp sle i32 %17, %18
%.sink.i = tail call i32 @llvm.smin.i32(i32 %17, i32 %18)
%inc32.i = zext i1 %cmp31.not.i to i32
%i21.1.i = add nuw nsw i32 %i21.074.i, %inc32.i
%not.cmp31.not.i = xor i1 %cmp31.not.i, true
%inc37.i = zext i1 %not.cmp31.not.i to i32
%j.1.i = add nuw nsw i32 %j.075.i, %inc37.i
%19 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
store i32 %.sink.i, ptr %19, align 4
%indvars.iv.next.i = add 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 %for.cond22.for.cond.cleanup24_crit_edge.i, label %for.body25.i, !llvm.loop !9
if.end: ; preds = %for.cond22.for.cond.cleanup24_crit_edge.i, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%A = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %3, %for.body ]
call void @mergeSort(ptr noundef nonnull %A, i32 noundef %.lcssa, i32 noundef 0, i32 noundef %.lcssa)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp425 = icmp sgt i32 %1, 0
br i1 %cmp425, label %if.end.peel, label %for.cond.cleanup5
if.end.peel: ; preds = %for.cond.cleanup
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call11.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp4.peel = icmp sgt i32 %2, 1
br i1 %cmp4.peel, label %if.end, label %for.cond.cleanup5
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 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
%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.cond.cleanup, !llvm.loop !11
for.cond.cleanup5: ; preds = %if.end, %if.end.peel, %for.cond.cleanup
%putchar = call i32 @putchar(i32 10)
%5 = load i32, ptr @num_comparison, align 4, !tbaa !5
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %5)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv29 = phi i64 [ %indvars.iv.next30, %if.end ], [ 1, %if.end.peel ]
%putchar22 = call i32 @putchar(i32 32)
%arrayidx10 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv29
%6 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
%indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp4 = icmp slt i64 %indvars.iv.next30, %8
br i1 %cmp4, label %if.end, label %for.cond.cleanup5, !llvm.loop !12
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; 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) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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}
!13 = !{!"llvm.loop.peeled.count", i32 1}
|
#include<stdio.h>
#include<stdlib.h>
#define INFTY 1000000000
void merge(int*,int,int,int);
void mergeSort(int*,int,int);
int cnt=0;
int main(){
int i,n,*p;
int S[500000];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&S[i]);
}
p=&S[0];
mergeSort(p,0,n);
for(i=0;i<n-1;i++){
printf("%d ",S[i]);
}
printf("%d\n%d\n",S[i],cnt);
return 0;
}
void merge(int *A,int left,int mid,int right){
int n1,n2,i,j,k,*L,*R;
n1=mid-left;
n2=right-mid;
L=(int*)malloc(sizeof(int)*(n1+1));
R=(int*)malloc(sizeof(int)*(n2+1));
for(i=0;i<n1;i++){
L[i]=A[left+i];
}
for(i=0;i<n2;i++){
R[i]=A[mid+i];
}
L[n1]=INFTY;
R[n2]=INFTY;
i=0;
j=0;
for(k=left;k<right;k++){
if(L[i]<=R[j]){
A[k]=L[i];
cnt++;
i+=1;
}
else {
A[k]=R[j];
cnt++;
j+=1;
}
}
}
void mergeSort(int *A,int left,int right){
int mid;
if(left+1<right){
mid=(left+right)/2;
mergeSort(A,left,mid);
mergeSort(A,mid,right);
merge(A,left,mid,right);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148028/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148028/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%d\0A%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%S = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %S) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %S, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp424 = icmp sgt i32 %3, 1
br i1 %cmp424, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %for.body5
%indvars.iv29 = phi i64 [ %indvars.iv.next30, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv29
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp4 = icmp slt i64 %indvars.iv.next30, %6
br i1 %cmp4, label %for.body5, label %for.end11.loopexit, !llvm.loop !11
for.end11.loopexit: ; preds = %for.body5
%7 = and i64 %indvars.iv.next30, 4294967295
br label %for.end11
for.end11: ; preds = %for.end11.loopexit, %for.end
%i.1.lcssa = phi i64 [ 0, %for.end ], [ %7, %for.end11.loopexit ]
%arrayidx13 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %i.1.lcssa
%8 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%9 = load i32, ptr @cnt, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %S) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%add = add nsw i32 %sub, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 2
%call = tail call noalias ptr @malloc(i64 noundef %mul) #6
%add2 = add nsw i32 %sub1, 1
%conv3 = sext i32 %add2 to i64
%mul4 = shl nsw i64 %conv3, 2
%call5 = tail call noalias ptr @malloc(i64 noundef %mul4) #6
%cmp85 = icmp sgt i32 %sub, 0
br i1 %cmp85, label %for.body.preheader, label %for.cond10.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond10.preheader
for.cond10.preheader: ; preds = %for.body.preheader, %entry
%cmp1187 = icmp sgt i32 %sub1, 0
br i1 %cmp1187, label %for.body13.preheader, label %for.end21
for.body13.preheader: ; preds = %for.cond10.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep95 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %call5, ptr noundef nonnull align 4 dereferenceable(1) %scevgep95, i64 %13, i1 false), !tbaa !5
br label %for.end21
for.end21: ; preds = %for.body13.preheader, %for.cond10.preheader
%idxprom22 = sext i32 %sub to i64
%arrayidx23 = getelementptr inbounds i32, ptr %call, i64 %idxprom22
store i32 1000000000, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = sext i32 %sub1 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %call5, i64 %idxprom24
store i32 1000000000, ptr %arrayidx25, align 4, !tbaa !5
%cmp2789 = icmp slt i32 %left, %right
br i1 %cmp2789, label %for.body29.preheader, label %for.end50
for.body29.preheader: ; preds = %for.end21
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body29
for.body29: ; preds = %for.body29.preheader, %for.inc48
%indvars.iv = phi i64 [ %14, %for.body29.preheader ], [ %indvars.iv.next, %for.inc48 ]
%i.292 = phi i32 [ 0, %for.body29.preheader ], [ %i.3, %for.inc48 ]
%j.091 = phi i32 [ 0, %for.body29.preheader ], [ %j.1, %for.inc48 ]
%idxprom30 = sext i32 %i.292 to i64
%arrayidx31 = getelementptr inbounds i32, ptr %call, i64 %idxprom30
%15 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%idxprom32 = sext i32 %j.091 to i64
%arrayidx33 = getelementptr inbounds i32, ptr %call5, i64 %idxprom32
%16 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%cmp34.not = icmp sgt i32 %15, %16
%arrayidx45 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
br i1 %cmp34.not, label %if.else, label %if.then
if.then: ; preds = %for.body29
store i32 %15, ptr %arrayidx45, align 4, !tbaa !5
%add41 = add nsw i32 %i.292, 1
br label %for.inc48
if.else: ; preds = %for.body29
store i32 %16, ptr %arrayidx45, align 4, !tbaa !5
%add47 = add nsw i32 %j.091, 1
br label %for.inc48
for.inc48: ; preds = %if.then, %if.else
%j.1 = phi i32 [ %j.091, %if.then ], [ %add47, %if.else ]
%i.3 = phi i32 [ %add41, %if.then ], [ %i.292, %if.else ]
%inc40.sink.in = load i32, ptr @cnt, align 4, !tbaa !5
%inc40.sink = add nsw i32 %inc40.sink.in, 1
store i32 %inc40.sink, ptr @cnt, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end50, label %for.body29, !llvm.loop !12
for.end50: ; preds = %for.inc48, %for.end21
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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#define INFINITY 1000000000
int A[500000];
int num=0;
int n1,n2;
int L[5000000];
int R[5000000];
void merge(int A[],int left,int mid,int right){
int i,k,j;
n1=mid-left;
n2=right-mid;
for(i=0;i<n1;i++)L[i]=A[left+i];
for(i=0;i<n2;i++)R[i]=A[mid+i];
L[n1]=INFINITY;
R[n2]=INFINITY;
i=0;
j=0;
for(k=left;k<right;k++){
if(L[i]<=R[j]){
A[k]=L[i];
i=i+1;
num++;
}
else{
num++;
A[k]=R[j];
j=j+1;
}
}
}
void mergesort(int A[],int left,int right){
if(left+1<right){
int mid;
mid = (left + right)/2;
mergesort(A, left, mid);
mergesort(A, mid, right);
merge(A, left, mid, right);
}
}
int main(){
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
mergesort(A,0,n);
for(i=0;i<n;i++){
if(i==n-1){
printf("%d\n",(int)A[i]);
break;
}
printf("%d ",(int)A[i]);
}
printf("%d\n",num);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148071/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148071/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@num = dso_local local_unnamed_addr global i32 0, align 4
@n1 = dso_local local_unnamed_addr global i32 0, align 4
@n2 = dso_local local_unnamed_addr global i32 0, align 4
@L = dso_local local_unnamed_addr global [5000000 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [5000000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@A = dso_local global [500000 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 [4 x i8] c"%d \00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A88 = ptrtoint ptr %A to i64
%sub = sub nsw i32 %mid, %left
store i32 %sub, ptr @n1, align 4, !tbaa !5
%sub1 = sub i32 %right, %mid
store i32 %sub1, ptr @n2, align 4, !tbaa !5
%cmp65 = icmp sgt i32 %sub, 0
br i1 %cmp65, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader106, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A88
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader106, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load89 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [5000000 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load89, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, 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.cond4.preheader, label %for.body.preheader106
for.body.preheader106: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader106, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader106 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader106 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [5000000 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !13
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader106
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader106 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp567 = icmp sgt i32 %sub1, 0
br i1 %cmp567, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %mid to i64
%wide.trip.count79 = zext i32 %sub1 to i64
%invariant.gep86 = getelementptr i32, ptr %A, i64 %13
%min.iters.check94 = icmp ult i32 %sub1, 12
br i1 %min.iters.check94, label %for.body6.preheader105, label %vector.memcheck90
vector.memcheck90: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A88
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check91 = icmp ult i64 %16, 32
br i1 %diff.check91, label %for.body6.preheader105, label %vector.ph95
vector.ph95: ; preds = %vector.memcheck90
%n.vec97 = and i64 %wide.trip.count79, 4294967288
br label %vector.body100
vector.body100: ; preds = %vector.body100, %vector.ph95
%index101 = phi i64 [ 0, %vector.ph95 ], [ %index.next104, %vector.body100 ]
%17 = getelementptr i32, ptr %invariant.gep86, i64 %index101
%wide.load102 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load103 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [5000000 x i32], ptr @R, i64 0, i64 %index101
store <4 x i32> %wide.load102, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load103, ptr %20, align 16, !tbaa !5
%index.next104 = add nuw i64 %index101, 8
%21 = icmp eq i64 %index.next104, %n.vec97
br i1 %21, label %middle.block92, label %vector.body100, !llvm.loop !15
middle.block92: ; preds = %vector.body100
%cmp.n99 = icmp eq i64 %n.vec97, %wide.trip.count79
br i1 %cmp.n99, label %for.end14, label %for.body6.preheader105
for.body6.preheader105: ; preds = %vector.memcheck90, %for.body6.preheader, %middle.block92
%indvars.iv75.ph = phi i64 [ 0, %vector.memcheck90 ], [ 0, %for.body6.preheader ], [ %n.vec97, %middle.block92 ]
%22 = xor i64 %indvars.iv75.ph, -1
%23 = add nsw i64 %22, %wide.trip.count79
%xtraiter107 = and i64 %wide.trip.count79, 3
%lcmp.mod108.not = icmp eq i64 %xtraiter107, 0
br i1 %lcmp.mod108.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader105, %for.body6.prol
%indvars.iv75.prol = phi i64 [ %indvars.iv.next76.prol, %for.body6.prol ], [ %indvars.iv75.ph, %for.body6.preheader105 ]
%prol.iter109 = phi i64 [ %prol.iter109.next, %for.body6.prol ], [ 0, %for.body6.preheader105 ]
%gep87.prol = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv75.prol
%24 = load i32, ptr %gep87.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [5000000 x i32], ptr @R, i64 0, i64 %indvars.iv75.prol
store i32 %24, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next76.prol = add nuw nsw i64 %indvars.iv75.prol, 1
%prol.iter109.next = add i64 %prol.iter109, 1
%prol.iter109.cmp.not = icmp eq i64 %prol.iter109.next, %xtraiter107
br i1 %prol.iter109.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !16
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader105
%indvars.iv75.unr = phi i64 [ %indvars.iv75.ph, %for.body6.preheader105 ], [ %indvars.iv.next76.prol, %for.body6.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [5000000 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [5000000 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [5000000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [5000000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !17
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv75 = phi i64 [ %indvars.iv.next76.3, %for.body6 ], [ %indvars.iv75.unr, %for.body6.prol.loopexit ]
%gep87 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv75
%30 = load i32, ptr %gep87, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [5000000 x i32], ptr @R, i64 0, i64 %indvars.iv75
store i32 %30, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%gep87.1 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76
%31 = load i32, ptr %gep87.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [5000000 x i32], ptr @R, i64 0, i64 %indvars.iv.next76
store i32 %31, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next76.1 = add nuw nsw i64 %indvars.iv75, 2
%gep87.2 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76.1
%32 = load i32, ptr %gep87.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [5000000 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.1
store i32 %32, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next76.2 = add nuw nsw i64 %indvars.iv75, 3
%gep87.3 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76.2
%33 = load i32, ptr %gep87.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [5000000 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.2
store i32 %33, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next76.3 = add nuw nsw i64 %indvars.iv75, 4
%exitcond80.not.3 = icmp eq i64 %indvars.iv.next76.3, %wide.trip.count79
br i1 %exitcond80.not.3, label %for.end14, label %for.body6, !llvm.loop !18
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block92, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [5000000 x i32], ptr @L, i64 0, i64 %idxprom15
store i32 1000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [5000000 x i32], ptr @R, i64 0, i64 %idxprom17
store i32 1000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2069 = icmp slt i32 %left, %right
br i1 %cmp2069, label %for.body21.preheader, label %for.end41
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %left to i64
%wide.trip.count84 = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.inc39
%indvars.iv81 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next82, %for.inc39 ]
%j.072 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.inc39 ]
%i.270 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.inc39 ]
%idxprom22 = sext i32 %i.270 to i64
%arrayidx23 = getelementptr inbounds [5000000 x i32], ptr @L, i64 0, i64 %idxprom22
%35 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%idxprom24 = sext i32 %j.072 to i64
%arrayidx25 = getelementptr inbounds [5000000 x i32], ptr @R, i64 0, i64 %idxprom24
%36 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26.not = icmp sgt i32 %35, %36
br i1 %cmp26.not, label %if.else, label %if.then
if.then: ; preds = %for.body21
%arrayidx30 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv81
store i32 %35, ptr %arrayidx30, align 4, !tbaa !5
%add31 = add nsw i32 %i.270, 1
%37 = load i32, ptr @num, align 4, !tbaa !5
%inc32 = add nsw i32 %37, 1
store i32 %inc32, ptr @num, align 4, !tbaa !5
br label %for.inc39
if.else: ; preds = %for.body21
%38 = load i32, ptr @num, align 4, !tbaa !5
%inc33 = add nsw i32 %38, 1
store i32 %inc33, ptr @num, align 4, !tbaa !5
%arrayidx37 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv81
store i32 %36, ptr %arrayidx37, align 4, !tbaa !5
%add38 = add nsw i32 %j.072, 1
br label %for.inc39
for.inc39: ; preds = %if.then, %if.else
%i.3 = phi i32 [ %add31, %if.then ], [ %i.270, %if.else ]
%j.1 = phi i32 [ %j.072, %if.then ], [ %add38, %if.else ]
%indvars.iv.next82 = add nsw i64 %indvars.iv81, 1
%exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count84
br i1 %exitcond85.not, label %for.end41, label %for.body21, !llvm.loop !19
for.end41: ; preds = %for.inc39, %for.end14
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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergesort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #2 {
entry:
%A12 = ptrtoint ptr %A to i64
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergesort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergesort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
store i32 %sub.i, ptr @n1, align 4, !tbaa !5
%sub1.i = sub i32 %right, %div
store i32 %sub1.i, ptr @n2, align 4, !tbaa !5
%cmp65.i = icmp sgt i32 %sub.i, 0
br i1 %cmp65.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A12
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load13 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [5000000 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load13, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [5000000 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !21
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp567.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp567.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count79.i = zext i32 %sub1.i to i64
%invariant.gep86.i = getelementptr i32, ptr %A, i64 %13
%min.iters.check18 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check18, label %for.body6.i.preheader, label %vector.memcheck14
vector.memcheck14: ; preds = %for.body6.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A12
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check15 = icmp ult i64 %16, 32
br i1 %diff.check15, label %for.body6.i.preheader, label %vector.ph19
vector.ph19: ; preds = %vector.memcheck14
%n.vec21 = and i64 %wide.trip.count79.i, 4294967288
br label %vector.body24
vector.body24: ; preds = %vector.body24, %vector.ph19
%index25 = phi i64 [ 0, %vector.ph19 ], [ %index.next28, %vector.body24 ]
%17 = getelementptr i32, ptr %invariant.gep86.i, i64 %index25
%wide.load26 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load27 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [5000000 x i32], ptr @R, i64 0, i64 %index25
store <4 x i32> %wide.load26, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load27, ptr %20, align 16, !tbaa !5
%index.next28 = add nuw i64 %index25, 8
%21 = icmp eq i64 %index.next28, %n.vec21
br i1 %21, label %middle.block16, label %vector.body24, !llvm.loop !22
middle.block16: ; preds = %vector.body24
%cmp.n23 = icmp eq i64 %n.vec21, %wide.trip.count79.i
br i1 %cmp.n23, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck14, %for.body6.preheader.i, %middle.block16
%indvars.iv75.i.ph = phi i64 [ 0, %vector.memcheck14 ], [ 0, %for.body6.preheader.i ], [ %n.vec21, %middle.block16 ]
%22 = xor i64 %indvars.iv75.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count79.i
%xtraiter29 = and i64 %wide.trip.count79.i, 3
%lcmp.mod30.not = icmp eq i64 %xtraiter29, 0
br i1 %lcmp.mod30.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv75.i.prol = phi i64 [ %indvars.iv.next76.i.prol, %for.body6.i.prol ], [ %indvars.iv75.i.ph, %for.body6.i.preheader ]
%prol.iter31 = phi i64 [ %prol.iter31.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep87.i.prol = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv75.i.prol
%24 = load i32, ptr %gep87.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [5000000 x i32], ptr @R, i64 0, i64 %indvars.iv75.i.prol
store i32 %24, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next76.i.prol = add nuw nsw i64 %indvars.iv75.i.prol, 1
%prol.iter31.next = add i64 %prol.iter31, 1
%prol.iter31.cmp.not = icmp eq i64 %prol.iter31.next, %xtraiter29
br i1 %prol.iter31.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !23
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv75.i.unr = phi i64 [ %indvars.iv75.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next76.i.prol, %for.body6.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [5000000 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [5000000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [5000000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [5000000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !24
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv75.i = phi i64 [ %indvars.iv.next76.i.3, %for.body6.i ], [ %indvars.iv75.i.unr, %for.body6.i.prol.loopexit ]
%gep87.i = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv75.i
%30 = load i32, ptr %gep87.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [5000000 x i32], ptr @R, i64 0, i64 %indvars.iv75.i
store i32 %30, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next76.i = add nuw nsw i64 %indvars.iv75.i, 1
%gep87.i.1 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i
%31 = load i32, ptr %gep87.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [5000000 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i
store i32 %31, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next76.i.1 = add nuw nsw i64 %indvars.iv75.i, 2
%gep87.i.2 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i.1
%32 = load i32, ptr %gep87.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [5000000 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i.1
store i32 %32, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next76.i.2 = add nuw nsw i64 %indvars.iv75.i, 3
%gep87.i.3 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i.2
%33 = load i32, ptr %gep87.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [5000000 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i.2
store i32 %33, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next76.i.3 = add nuw nsw i64 %indvars.iv75.i, 4
%exitcond80.not.i.3 = icmp eq i64 %indvars.iv.next76.i.3, %wide.trip.count79.i
br i1 %exitcond80.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !25
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block16, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub.i to i64
%arrayidx16.i = getelementptr inbounds [5000000 x i32], ptr @L, i64 0, i64 %idxprom15.i
store i32 1000000000, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub1.i to i64
%arrayidx18.i = getelementptr inbounds [5000000 x i32], ptr @R, i64 0, i64 %idxprom17.i
store i32 1000000000, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %left to i64
%wide.trip.count84.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.inc39.i, %for.end14.i
%indvars.iv81.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next82.i, %for.inc39.i ]
%j.072.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.inc39.i ]
%i.270.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.inc39.i ]
%idxprom22.i = sext i32 %i.270.i to i64
%arrayidx23.i = getelementptr inbounds [5000000 x i32], ptr @L, i64 0, i64 %idxprom22.i
%35 = load i32, ptr %arrayidx23.i, align 4, !tbaa !5
%idxprom24.i = sext i32 %j.072.i to i64
%arrayidx25.i = getelementptr inbounds [5000000 x i32], ptr @R, i64 0, i64 %idxprom24.i
%36 = load i32, ptr %arrayidx25.i, align 4, !tbaa !5
%cmp26.not.i = icmp sgt i32 %35, %36
br i1 %cmp26.not.i, label %if.else.i, label %if.then.i
if.then.i: ; preds = %for.body21.i
%arrayidx30.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv81.i
store i32 %35, ptr %arrayidx30.i, align 4, !tbaa !5
%add31.i = add nsw i32 %i.270.i, 1
%37 = load i32, ptr @num, align 4, !tbaa !5
%inc32.i = add nsw i32 %37, 1
store i32 %inc32.i, ptr @num, align 4, !tbaa !5
br label %for.inc39.i
if.else.i: ; preds = %for.body21.i
%38 = load i32, ptr @num, align 4, !tbaa !5
%inc33.i = add nsw i32 %38, 1
store i32 %inc33.i, ptr @num, align 4, !tbaa !5
%arrayidx37.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv81.i
store i32 %36, ptr %arrayidx37.i, align 4, !tbaa !5
%add38.i = add nsw i32 %j.072.i, 1
br label %for.inc39.i
for.inc39.i: ; preds = %if.else.i, %if.then.i
%i.3.i = phi i32 [ %add31.i, %if.then.i ], [ %i.270.i, %if.else.i ]
%j.1.i = phi i32 [ %j.072.i, %if.then.i ], [ %add38.i, %if.else.i ]
%indvars.iv.next82.i = add nsw i64 %indvars.iv81.i, 1
%exitcond85.not.i = icmp eq i64 %indvars.iv.next82.i, %wide.trip.count84.i
br i1 %exitcond85.not.i, label %if.end, label %for.body21.i, !llvm.loop !19
if.end: ; preds = %for.inc39.i, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%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.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !26
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergesort(ptr noundef nonnull @A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp327 = icmp sgt i32 %3, 0
br i1 %cmp327, label %for.body4, label %for.end14
for.body4: ; preds = %for.end, %if.end
%indvars.iv32 = phi i64 [ %indvars.iv.next33, %if.end ], [ 0, %for.end ]
%4 = phi i32 [ %8, %if.end ], [ %3, %for.end ]
%sub = add nsw i32 %4, -1
%5 = zext i32 %sub to i64
%cmp5 = icmp eq i64 %indvars.iv32, %5
br i1 %cmp5, label %if.then, label %if.end
if.then: ; preds = %for.body4
%idxprom6 = and i64 %indvars.iv32, 4294967295
%arrayidx7 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %idxprom6
%6 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6)
br label %for.end14
if.end: ; preds = %for.body4
%arrayidx10 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv32
%7 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp3 = icmp slt i64 %indvars.iv.next33, %9
br i1 %cmp3, label %for.body4, label %for.end14, !llvm.loop !27
for.end14: ; preds = %if.end, %for.end, %if.then
%10 = load i32, ptr @num, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree norecurse 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~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, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !10, !11}
!18 = distinct !{!18, !10, !11}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !11, !12}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !10, !11, !12}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !10, !11}
!25 = distinct !{!25, !10, !11}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#define SENTINEL (1000000001)
int c = 0;
int S[500000];
int L[250001];
int R[250001];
char str[5500000];
char *p = str;
static void Merge(int A[], int left, int mid, int right);
static void MergeSort(int A[], int left, int right);
static int getNum(void);
static void putNum(int n);
int main(void) {
register int i;
int n;
fread(str, sizeof(char), 5500000, stdin);
n = getNum();
for (i = 0; i < n; ++i) {
S[i] = getNum();
}
MergeSort(S, 0, n);
--n;
p = str;
for (i = 0; i < n; ++i) {
putNum(S[i]);
*p = ' ';
++p;
}
putNum(S[i]);
*p = '\n';
++p;
putNum(c);
*p = '\0';
puts(str);
return 0;
}
int getNum(void) {
int n = 0;
while ((*p >= '0') && (*p <= '9')) {
n = n * 10 + (int)(*p - '0');
++p;
}
++p;
return n;
}
void putNum(int n) {
int d = n / 10;
if (n < 10) {
*p = '0' + (char)n;
++p;
return;
}
if (d) putNum(d);
*p = '0' + (char)(n % 10);
++p;
}
void Merge(int A[], int left, int mid, int right) {
int i, j, k;
int n1 = mid - left;
int n2 = right - mid;
memcpy(L, A + left, n1 * sizeof(int));
memcpy(R, A + mid, n2 * sizeof(int));
L[n1] = R[n2] = SENTINEL;
i = j = 0;
for (k = left; k < right; ++k) {
++c;
if (L[i] <= R[j]) {
A[k] = L[i];
++i;
} else {
A[k] = R[j];
++j;
}
}
}
void MergeSort(int A[], int left, int right) {
int mid;
if (left + 1 < right) {
mid = (left + right) / 2;
MergeSort(A, left, mid);
MergeSort(A, mid, right);
Merge(A, left, mid, right);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148129/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148129/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@c = dso_local local_unnamed_addr global i32 0, align 4
@str = dso_local global [5500000 x i8] zeroinitializer, align 16
@p = dso_local local_unnamed_addr global ptr @str, align 8
@stdin = external local_unnamed_addr global ptr, align 8
@S = dso_local local_unnamed_addr global [500000 x i32] zeroinitializer, align 16
@L = dso_local local_unnamed_addr global [250001 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [250001 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = tail call i64 @fread(ptr noundef nonnull @str, i64 noundef 1, i64 noundef 5500000, ptr noundef %0)
%p.promoted.i = load ptr, ptr @p, align 8, !tbaa !5
%1 = load i8, ptr %p.promoted.i, align 1, !tbaa !9
%2 = add i8 %1, -48
%or.cond9.i = icmp ult i8 %2, 10
br i1 %or.cond9.i, label %while.body.i, label %getNum.exit.thread
getNum.exit.thread: ; preds = %entry
%incdec.ptr6.i53 = getelementptr inbounds i8, ptr %p.promoted.i, i64 1
store ptr %incdec.ptr6.i53, ptr @p, align 8, !tbaa !5
br label %for.end
while.body.i: ; preds = %entry, %while.body.i
%3 = phi i8 [ %4, %while.body.i ], [ %1, %entry ]
%n.011.i = phi i32 [ %add.i, %while.body.i ], [ 0, %entry ]
%incdec.ptr810.i = phi ptr [ %incdec.ptr.i, %while.body.i ], [ %p.promoted.i, %entry ]
%conv.i = zext i8 %3 to i32
%mul.i = mul nsw i32 %n.011.i, 10
%sub.i = add nsw i32 %conv.i, -48
%add.i = add i32 %sub.i, %mul.i
%incdec.ptr.i = getelementptr inbounds i8, ptr %incdec.ptr810.i, i64 1
store ptr %incdec.ptr.i, ptr @p, align 8, !tbaa !5
%4 = load i8, ptr %incdec.ptr.i, align 1, !tbaa !9
%5 = add i8 %4, -48
%or.cond.i = icmp ult i8 %5, 10
br i1 %or.cond.i, label %while.body.i, label %getNum.exit, !llvm.loop !10
getNum.exit: ; preds = %while.body.i
%incdec.ptr6.i = getelementptr inbounds i8, ptr %incdec.ptr810.i, i64 2
store ptr %incdec.ptr6.i, ptr @p, align 8, !tbaa !5
%cmp40 = icmp sgt i32 %add.i, 0
br i1 %cmp40, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %getNum.exit
%wide.trip.count = zext i32 %add.i to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %getNum.exit38
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %getNum.exit38 ]
%incdec.ptr.i363941 = phi ptr [ %incdec.ptr6.i, %for.body.preheader ], [ %incdec.ptr6.i28, %getNum.exit38 ]
%6 = load i8, ptr %incdec.ptr.i363941, align 1, !tbaa !9
%7 = add i8 %6, -48
%or.cond9.i25 = icmp ult i8 %7, 10
br i1 %or.cond9.i25, label %while.body.i29, label %getNum.exit38
while.body.i29: ; preds = %for.body, %while.body.i29
%8 = phi i8 [ %9, %while.body.i29 ], [ %6, %for.body ]
%n.011.i30 = phi i32 [ %add.i35, %while.body.i29 ], [ 0, %for.body ]
%incdec.ptr810.i31 = phi ptr [ %incdec.ptr.i36, %while.body.i29 ], [ %incdec.ptr.i363941, %for.body ]
%conv.i32 = zext i8 %8 to i32
%mul.i33 = mul nsw i32 %n.011.i30, 10
%sub.i34 = add nsw i32 %conv.i32, -48
%add.i35 = add i32 %sub.i34, %mul.i33
%incdec.ptr.i36 = getelementptr inbounds i8, ptr %incdec.ptr810.i31, i64 1
store ptr %incdec.ptr.i36, ptr @p, align 8, !tbaa !5
%9 = load i8, ptr %incdec.ptr.i36, align 1, !tbaa !9
%10 = add i8 %9, -48
%or.cond.i37 = icmp ult i8 %10, 10
br i1 %or.cond.i37, label %while.body.i29, label %getNum.exit38, !llvm.loop !10
getNum.exit38: ; preds = %while.body.i29, %for.body
%n.0.lcssa.i26 = phi i32 [ 0, %for.body ], [ %add.i35, %while.body.i29 ]
%.lcssa.i27 = phi ptr [ %incdec.ptr.i363941, %for.body ], [ %incdec.ptr.i36, %while.body.i29 ]
%incdec.ptr6.i28 = getelementptr inbounds i8, ptr %.lcssa.i27, i64 1
store ptr %incdec.ptr6.i28, ptr @p, align 8, !tbaa !5
%arrayidx = getelementptr inbounds [500000 x i32], ptr @S, i64 0, i64 %indvars.iv
store i32 %n.0.lcssa.i26, ptr %arrayidx, align 4, !tbaa !12
%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 !14
for.end: ; preds = %getNum.exit38, %getNum.exit.thread, %getNum.exit
%n.0.lcssa.i55 = phi i32 [ 0, %getNum.exit.thread ], [ %add.i, %getNum.exit ], [ %add.i, %getNum.exit38 ]
tail call fastcc void @MergeSort(i32 noundef 0, i32 noundef %n.0.lcssa.i55)
%dec = add i32 %n.0.lcssa.i55, -1
store ptr @str, ptr @p, align 8, !tbaa !5
%cmp443 = icmp sgt i32 %n.0.lcssa.i55, 1
br i1 %cmp443, label %for.body5.preheader, label %for.end10
for.body5.preheader: ; preds = %for.end
%wide.trip.count49 = zext i32 %dec to i64
br label %for.body5
for.body5: ; preds = %for.body5.preheader, %for.body5
%indvars.iv46 = phi i64 [ 0, %for.body5.preheader ], [ %indvars.iv.next47, %for.body5 ]
%arrayidx7 = getelementptr inbounds [500000 x i32], ptr @S, i64 0, i64 %indvars.iv46
%11 = load i32, ptr %arrayidx7, align 4, !tbaa !12
tail call fastcc void @putNum(i32 noundef %11)
%12 = load ptr, ptr @p, align 8, !tbaa !5
store i8 32, ptr %12, align 1, !tbaa !9
%13 = load ptr, ptr @p, align 8, !tbaa !5
%incdec.ptr = getelementptr inbounds i8, ptr %13, i64 1
store ptr %incdec.ptr, ptr @p, align 8, !tbaa !5
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%exitcond50.not = icmp eq i64 %indvars.iv.next47, %wide.trip.count49
br i1 %exitcond50.not, label %for.end10.loopexit, label %for.body5, !llvm.loop !15
for.end10.loopexit: ; preds = %for.body5
%14 = zext i32 %dec to i64
br label %for.end10
for.end10: ; preds = %for.end, %for.end10.loopexit
%i.1.lcssa = phi i64 [ %14, %for.end10.loopexit ], [ 0, %for.end ]
%arrayidx12 = getelementptr inbounds [500000 x i32], ptr @S, i64 0, i64 %i.1.lcssa
%15 = load i32, ptr %arrayidx12, align 4, !tbaa !12
tail call fastcc void @putNum(i32 noundef %15)
%16 = load ptr, ptr @p, align 8, !tbaa !5
store i8 10, ptr %16, align 1, !tbaa !9
%17 = load ptr, ptr @p, align 8, !tbaa !5
%incdec.ptr13 = getelementptr inbounds i8, ptr %17, i64 1
store ptr %incdec.ptr13, ptr @p, align 8, !tbaa !5
%18 = load i32, ptr @c, align 4, !tbaa !12
tail call fastcc void @putNum(i32 noundef %18)
%19 = load ptr, ptr @p, align 8, !tbaa !5
store i8 0, ptr %19, align 1, !tbaa !9
%call14 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @str)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define internal fastcc void @MergeSort(i32 noundef %left, i32 noundef %right) unnamed_addr #2 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %for.body.preheader.i, label %if.end
for.body.preheader.i: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call fastcc void @MergeSort(i32 noundef %left, i32 noundef %div)
tail call fastcc void @MergeSort(i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub nsw i32 %right, %div
%idx.ext.i = sext i32 %left to i64
%add.ptr.i = getelementptr inbounds i32, ptr @S, i64 %idx.ext.i
%conv.i = sext i32 %sub.i to i64
%mul.i = shl nsw i64 %conv.i, 2
tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @L, ptr nonnull align 4 %add.ptr.i, i64 %mul.i, i1 false)
%idx.ext2.i = sext i32 %div to i64
%add.ptr3.i = getelementptr inbounds i32, ptr @S, i64 %idx.ext2.i
%conv4.i = sext i32 %sub1.i to i64
%mul5.i = shl nsw i64 %conv4.i, 2
tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @R, ptr nonnull align 4 %add.ptr3.i, i64 %mul5.i, i1 false)
%arrayidx.i = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %conv4.i
store i32 1000000001, ptr %arrayidx.i, align 4, !tbaa !12
%arrayidx7.i = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %conv.i
store i32 1000000001, ptr %arrayidx7.i, align 4, !tbaa !12
%c.promoted.i = load i32, ptr @c, align 4, !tbaa !12
%wide.trip.count.i = sext i32 %right to i64
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.preheader.i
%indvars.iv.i = phi i64 [ %idx.ext.i, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.body.i ]
%i.06.i = phi i32 [ 0, %for.body.preheader.i ], [ %i.1.i, %for.body.i ]
%j.05.i = phi i32 [ 0, %for.body.preheader.i ], [ %j.1.i, %for.body.i ]
%idxprom9.i = zext i32 %i.06.i to i64
%arrayidx10.i = getelementptr inbounds [250001 x i32], ptr @L, i64 0, i64 %idxprom9.i
%0 = load i32, ptr %arrayidx10.i, align 4, !tbaa !12
%idxprom11.i = zext i32 %j.05.i to i64
%arrayidx12.i = getelementptr inbounds [250001 x i32], ptr @R, i64 0, i64 %idxprom11.i
%1 = load i32, ptr %arrayidx12.i, align 4, !tbaa !12
%cmp13.not.i = icmp sgt i32 %0, %1
%.sink.i = tail call i32 @llvm.smin.i32(i32 %0, i32 %1)
%inc24.i = zext i1 %cmp13.not.i to i32
%j.1.i = add nuw nsw i32 %j.05.i, %inc24.i
%not.cmp13.not.i = xor i1 %cmp13.not.i, true
%inc19.i = zext i1 %not.cmp13.not.i to i32
%i.1.i = add nuw nsw i32 %i.06.i, %inc19.i
%2 = getelementptr inbounds i32, ptr @S, i64 %indvars.iv.i
store i32 %.sink.i, ptr %2, align 4
%indvars.iv.next.i = add 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 %Merge.exit, label %for.body.i, !llvm.loop !16
Merge.exit: ; preds = %for.body.i
%3 = sub i32 %right, %left
%4 = add i32 %3, %c.promoted.i
store i32 %4, ptr @c, align 4, !tbaa !12
br label %if.end
if.end: ; preds = %Merge.exit, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: write, inaccessiblemem: none) uwtable
define internal fastcc void @putNum(i32 noundef %n) unnamed_addr #3 {
entry:
%cmp = icmp slt i32 %n, 10
br i1 %cmp, label %if.then, label %if.end4
if.then: ; preds = %entry
%0 = trunc i32 %n to i8
%conv2 = add i8 %0, 48
br label %cleanup
if.end4: ; preds = %entry
%div14 = udiv i32 %n, 10
tail call fastcc void @putNum(i32 noundef %div14)
%rem = urem i32 %n, 10
%1 = trunc i32 %rem to i8
%conv8 = or i8 %1, 48
br label %cleanup
cleanup: ; preds = %if.end4, %if.then
%conv8.sink = phi i8 [ %conv8, %if.end4 ], [ %conv2, %if.then ]
%2 = load ptr, ptr @p, align 8, !tbaa !5
store i8 %conv8.sink, ptr %2, align 1, !tbaa !9
%.pn = load ptr, ptr @p, align 8, !tbaa !5
%storemerge = getelementptr inbounds i8, ptr %.pn, i64 1
store ptr %storemerge, ptr @p, align 8, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
; 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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nosync nounwind memory(readwrite, 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
|
#include <stdio.h>
#define MAX 500000
void merge(int A[],int l,int m,int r);
void mergesort(int A[],int l,int r);
int n,c=0;
int L[MAX/2+2],R[MAX/2+2];
int main(){
int i;
int A[MAX];
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&A[i]);
mergesort(A,0,n);
for(i=0;i<n;i++){
if(i>0) printf(" ");
printf("%d",A[i]);
}
printf("\n");
printf("%d\n",c);
return 0;
}
void merge(int A[],int l,int m,int r){
int n1,n2,i,j,k;
n1=m-l;
n2=r-m;
for(i=0;i<n1;i++) L[i]=A[l+i];
for(i=0;i<n2;i++) R[i]=A[m+i];
L[n1]=R[n2]=2000000000;
i=0,j=0;
for(k=l;k<r;k++){
c++;
if(L[i]<=R[j]){
A[k]=L[i];
i++;
}else{
A[k]=R[j];
j++;
}
}
}
void mergesort(int A[],int l,int r){
if(l+1<r){
int m;
m=(l+r)/2;
mergesort(A,l,m);
mergesort(A,m,r);
merge(A,l,m,r);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148194/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148194/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@c = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@L = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #6
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %0, 0
br i1 %cmp22, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergesort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr @n, align 4, !tbaa !5
%cmp324 = icmp sgt i32 %3, 0
br i1 %cmp324, label %if.end.peel, label %for.end12
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call9.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr @n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %4, 1
br i1 %cmp3.peel, label %if.end, label %for.end12
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %if.end ], [ 1, %if.end.peel ]
%putchar21 = call i32 @putchar(i32 32)
%arrayidx8 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv28
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
%6 = load i32, ptr @n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next29, %7
br i1 %cmp3, label %if.end, label %for.end12, !llvm.loop !11
for.end12: ; preds = %if.end, %if.end.peel, %for.end
%putchar = call i32 @putchar(i32 10)
%8 = load i32, ptr @c, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergesort(ptr noundef %A, i32 noundef %l, i32 noundef %r) local_unnamed_addr #3 {
entry:
%A12 = ptrtoint ptr %A to i64
%add = add nsw i32 %l, 1
%cmp = icmp slt i32 %add, %r
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %r, %l
%div = sdiv i32 %add1, 2
tail call void @mergesort(ptr noundef %A, i32 noundef %l, i32 noundef %div)
tail call void @mergesort(ptr noundef %A, i32 noundef %div, i32 noundef %r)
%sub.i = sub nsw i32 %div, %l
%sub1.i = sub i32 %r, %div
%cmp67.i = icmp sgt i32 %sub.i, 0
br i1 %cmp67.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %l to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A12
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load13 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load13, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !16
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp569.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp569.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count81.i = zext i32 %sub1.i to i64
%invariant.gep88.i = getelementptr i32, ptr %A, i64 %13
%min.iters.check18 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check18, label %for.body6.i.preheader, label %vector.memcheck14
vector.memcheck14: ; preds = %for.body6.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A12
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check15 = icmp ult i64 %16, 32
br i1 %diff.check15, label %for.body6.i.preheader, label %vector.ph19
vector.ph19: ; preds = %vector.memcheck14
%n.vec21 = and i64 %wide.trip.count81.i, 4294967288
br label %vector.body24
vector.body24: ; preds = %vector.body24, %vector.ph19
%index25 = phi i64 [ 0, %vector.ph19 ], [ %index.next28, %vector.body24 ]
%17 = getelementptr i32, ptr %invariant.gep88.i, i64 %index25
%wide.load26 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load27 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index25
store <4 x i32> %wide.load26, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load27, ptr %20, align 16, !tbaa !5
%index.next28 = add nuw i64 %index25, 8
%21 = icmp eq i64 %index.next28, %n.vec21
br i1 %21, label %middle.block16, label %vector.body24, !llvm.loop !18
middle.block16: ; preds = %vector.body24
%cmp.n23 = icmp eq i64 %n.vec21, %wide.trip.count81.i
br i1 %cmp.n23, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck14, %for.body6.preheader.i, %middle.block16
%indvars.iv77.i.ph = phi i64 [ 0, %vector.memcheck14 ], [ 0, %for.body6.preheader.i ], [ %n.vec21, %middle.block16 ]
%22 = xor i64 %indvars.iv77.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count81.i
%xtraiter29 = and i64 %wide.trip.count81.i, 3
%lcmp.mod30.not = icmp eq i64 %xtraiter29, 0
br i1 %lcmp.mod30.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv77.i.prol = phi i64 [ %indvars.iv.next78.i.prol, %for.body6.i.prol ], [ %indvars.iv77.i.ph, %for.body6.i.preheader ]
%prol.iter31 = phi i64 [ %prol.iter31.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep89.i.prol = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv77.i.prol
%24 = load i32, ptr %gep89.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv77.i.prol
store i32 %24, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next78.i.prol = add nuw nsw i64 %indvars.iv77.i.prol, 1
%prol.iter31.next = add i64 %prol.iter31, 1
%prol.iter31.cmp.not = icmp eq i64 %prol.iter31.next, %xtraiter29
br i1 %prol.iter31.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !19
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv77.i.unr = phi i64 [ %indvars.iv77.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next78.i.prol, %for.body6.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !20
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv77.i = phi i64 [ %indvars.iv.next78.i.3, %for.body6.i ], [ %indvars.iv77.i.unr, %for.body6.i.prol.loopexit ]
%gep89.i = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv77.i
%30 = load i32, ptr %gep89.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv77.i
store i32 %30, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next78.i = add nuw nsw i64 %indvars.iv77.i, 1
%gep89.i.1 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i
%31 = load i32, ptr %gep89.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i
store i32 %31, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next78.i.1 = add nuw nsw i64 %indvars.iv77.i, 2
%gep89.i.2 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i.1
%32 = load i32, ptr %gep89.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i.1
store i32 %32, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next78.i.2 = add nuw nsw i64 %indvars.iv77.i, 3
%gep89.i.3 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i.2
%33 = load i32, ptr %gep89.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i.2
store i32 %33, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next78.i.3 = add nuw nsw i64 %indvars.iv77.i, 4
%exitcond82.not.i.3 = icmp eq i64 %indvars.iv.next78.i.3, %wide.trip.count81.i
br i1 %exitcond82.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !21
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block16, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub1.i to i64
%arrayidx16.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom15.i
store i32 2000000000, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub.i to i64
%arrayidx18.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom17.i
store i32 2000000000, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %l to i64
%wide.trip.count86.i = sext i32 %r to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv83.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next84.i, %for.body21.i ]
%j.073.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.body21.i ]
%i.272.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.body21.i ]
%35 = load i32, ptr @c, align 4, !tbaa !5
%inc22.i = add nsw i32 %35, 1
store i32 %inc22.i, ptr @c, align 4, !tbaa !5
%idxprom23.i = zext i32 %i.272.i to i64
%arrayidx24.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23.i
%36 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = zext i32 %j.073.i to i64
%arrayidx26.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25.i
%37 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%cmp27.not.i = icmp sle i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc32.i = zext i1 %cmp27.not.i to i32
%i.3.i = add nuw nsw i32 %i.272.i, %inc32.i
%not.cmp27.not.i = xor i1 %cmp27.not.i, true
%inc37.i = zext i1 %not.cmp27.not.i to i32
%j.1.i = add nuw nsw i32 %j.073.i, %inc37.i
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv83.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next84.i = add nsw i64 %indvars.iv83.i, 1
%exitcond87.not.i = icmp eq i64 %indvars.iv.next84.i, %wide.trip.count86.i
br i1 %exitcond87.not.i, label %if.end, label %for.body21.i, !llvm.loop !22
if.end: ; preds = %for.body21.i, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %l, i32 noundef %m, i32 noundef %r) local_unnamed_addr #3 {
entry:
%A90 = ptrtoint ptr %A to i64
%sub = sub nsw i32 %m, %l
%sub1 = sub i32 %r, %m
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %l to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader108, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A90
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader108, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load91 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load91, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !23
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond4.preheader, label %for.body.preheader108
for.body.preheader108: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader108, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader108 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader108 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !24
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader108
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader108 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp569 = icmp sgt i32 %sub1, 0
br i1 %cmp569, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %m to i64
%wide.trip.count81 = zext i32 %sub1 to i64
%invariant.gep88 = getelementptr i32, ptr %A, i64 %13
%min.iters.check96 = icmp ult i32 %sub1, 12
br i1 %min.iters.check96, label %for.body6.preheader107, label %vector.memcheck92
vector.memcheck92: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A90
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check93 = icmp ult i64 %16, 32
br i1 %diff.check93, label %for.body6.preheader107, label %vector.ph97
vector.ph97: ; preds = %vector.memcheck92
%n.vec99 = and i64 %wide.trip.count81, 4294967288
br label %vector.body102
vector.body102: ; preds = %vector.body102, %vector.ph97
%index103 = phi i64 [ 0, %vector.ph97 ], [ %index.next106, %vector.body102 ]
%17 = getelementptr i32, ptr %invariant.gep88, i64 %index103
%wide.load104 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load105 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index103
store <4 x i32> %wide.load104, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load105, ptr %20, align 16, !tbaa !5
%index.next106 = add nuw i64 %index103, 8
%21 = icmp eq i64 %index.next106, %n.vec99
br i1 %21, label %middle.block94, label %vector.body102, !llvm.loop !25
middle.block94: ; preds = %vector.body102
%cmp.n101 = icmp eq i64 %n.vec99, %wide.trip.count81
br i1 %cmp.n101, label %for.end14, label %for.body6.preheader107
for.body6.preheader107: ; preds = %vector.memcheck92, %for.body6.preheader, %middle.block94
%indvars.iv77.ph = phi i64 [ 0, %vector.memcheck92 ], [ 0, %for.body6.preheader ], [ %n.vec99, %middle.block94 ]
%22 = xor i64 %indvars.iv77.ph, -1
%23 = add nsw i64 %22, %wide.trip.count81
%xtraiter109 = and i64 %wide.trip.count81, 3
%lcmp.mod110.not = icmp eq i64 %xtraiter109, 0
br i1 %lcmp.mod110.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader107, %for.body6.prol
%indvars.iv77.prol = phi i64 [ %indvars.iv.next78.prol, %for.body6.prol ], [ %indvars.iv77.ph, %for.body6.preheader107 ]
%prol.iter111 = phi i64 [ %prol.iter111.next, %for.body6.prol ], [ 0, %for.body6.preheader107 ]
%gep89.prol = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv77.prol
%24 = load i32, ptr %gep89.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv77.prol
store i32 %24, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next78.prol = add nuw nsw i64 %indvars.iv77.prol, 1
%prol.iter111.next = add i64 %prol.iter111, 1
%prol.iter111.cmp.not = icmp eq i64 %prol.iter111.next, %xtraiter109
br i1 %prol.iter111.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !26
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader107
%indvars.iv77.unr = phi i64 [ %indvars.iv77.ph, %for.body6.preheader107 ], [ %indvars.iv.next78.prol, %for.body6.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !27
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv77 = phi i64 [ %indvars.iv.next78.3, %for.body6 ], [ %indvars.iv77.unr, %for.body6.prol.loopexit ]
%gep89 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv77
%30 = load i32, ptr %gep89, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv77
store i32 %30, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%gep89.1 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78
%31 = load i32, ptr %gep89.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78
store i32 %31, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next78.1 = add nuw nsw i64 %indvars.iv77, 2
%gep89.2 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78.1
%32 = load i32, ptr %gep89.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.1
store i32 %32, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next78.2 = add nuw nsw i64 %indvars.iv77, 3
%gep89.3 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78.2
%33 = load i32, ptr %gep89.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.2
store i32 %33, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next78.3 = add nuw nsw i64 %indvars.iv77, 4
%exitcond82.not.3 = icmp eq i64 %indvars.iv.next78.3, %wide.trip.count81
br i1 %exitcond82.not.3, label %for.end14, label %for.body6, !llvm.loop !28
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block94, %for.cond4.preheader
%idxprom15 = sext i32 %sub1 to i64
%arrayidx16 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom15
store i32 2000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub to i64
%arrayidx18 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom17
store i32 2000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2071 = icmp slt i32 %l, %r
br i1 %cmp2071, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %l to i64
%wide.trip.count86 = sext i32 %r to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv83 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next84, %for.body21 ]
%j.073 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%i.272 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%35 = load i32, ptr @c, align 4, !tbaa !5
%inc22 = add nsw i32 %35, 1
store i32 %inc22, ptr @c, align 4, !tbaa !5
%idxprom23 = zext i32 %i.272 to i64
%arrayidx24 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23
%36 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.073 to i64
%arrayidx26 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25
%37 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sle i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc32 = zext i1 %cmp27.not to i32
%i.3 = add nuw nsw i32 %i.272, %inc32
%not.cmp27.not = xor i1 %cmp27.not, true
%inc37 = zext i1 %not.cmp27.not to i32
%j.1 = add nuw nsw i32 %j.073, %inc37
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv83
store i32 %.sink, ptr %38, align 4
%indvars.iv.next84 = add nsw i64 %indvars.iv83, 1
%exitcond87.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count86
br i1 %exitcond87.not, label %for.end40, label %for.body21, !llvm.loop !22
for.end40: ; preds = %for.body21, %for.end14
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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 = { 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 #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, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !10, !14, !15}
!19 = distinct !{!19, !17}
!20 = distinct !{!20, !10, !14}
!21 = distinct !{!21, !10, !14}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10, !14, !15}
!24 = distinct !{!24, !17}
!25 = distinct !{!25, !10, !14, !15}
!26 = distinct !{!26, !17}
!27 = distinct !{!27, !10, !14}
!28 = distinct !{!28, !10, !14}
|
#include <stdio.h>
#define N 500000
int A[N],count=0;
void Merge(int a[N], int left, int right);
int main(void);
void Merge(int a[N], int left, int right)
{
int mid, i, j, k;
if (left >= right)
return;
mid = (left + right) / 2;
Merge(a, left, mid);
Merge(a, mid + 1, right);
for (i = left; i <= mid; i++)
A[i] = a[i];
for (i = mid + 1, j = right; i <= right; i++, j--)
A[i] = a[j];
i = left;
j = right;
for (k = left; k <= right; k++)
if (A[i] <= A[j]){
a[k] = A[i++];
count++;
}
else{
a[k] = A[j--];
count++;
}
}
int main(void)
{
int i,total;
int A[N];
scanf("%d",&total);
for(i=0;i<total;++i)
scanf("%d",&A[i]);
Merge(A, 0, total - 1);
for (i = 0; i < total; i++){
if(i){
printf(" ");
}
printf("%d", A[i]);
}
printf("\n");
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148244/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148244/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@A = dso_local local_unnamed_addr global [500000 x i32] zeroinitializer, align 16
@.str = 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
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @Merge(ptr noundef %a, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%a103 = ptrtoint ptr %a to i64
%cmp.not = icmp slt i32 %left, %right
br i1 %cmp.not, label %if.end, label %cleanup
if.end: ; preds = %entry
%add = add nsw i32 %right, %left
%div = sdiv i32 %add, 2
tail call void @Merge(ptr noundef %a, i32 noundef %left, i32 noundef %div)
%add1 = add nsw i32 %div, 1
tail call void @Merge(ptr noundef %a, i32 noundef %add1, i32 noundef %right)
%cmp2.not78 = icmp slt i32 %div, %left
br i1 %cmp2.not78, label %for.cond6.preheader, label %for.body.preheader
for.body.preheader: ; preds = %if.end
%0 = sext i32 %left to i64
%1 = sub i32 %div, %left
%2 = zext i32 %1 to i64
%3 = add nuw nsw i64 %2, 1
%min.iters.check = icmp ult i32 %1, 15
br i1 %min.iters.check, label %for.body.preheader129, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%4 = shl nsw i64 %0, 2
%5 = add i64 %4, ptrtoint (ptr @A to i64)
%6 = add i64 %4, %a103
%7 = sub i64 %5, %6
%diff.check = icmp ult i64 %7, 32
br i1 %diff.check, label %for.body.preheader129, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %3, 8589934584
%ind.end = add nsw i64 %n.vec, %0
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 %index, %0
%8 = getelementptr inbounds i32, ptr %a, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load104 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %offset.idx
store <4 x i32> %wide.load, ptr %10, align 4, !tbaa !5
%11 = getelementptr inbounds i32, ptr %10, i64 4
store <4 x i32> %wide.load104, ptr %11, align 4, !tbaa !5
%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 !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %3, %n.vec
br i1 %cmp.n, label %for.cond6.preheader, label %for.body.preheader129
for.body.preheader129: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %0, %vector.memcheck ], [ %0, %for.body.preheader ], [ %ind.end, %middle.block ]
%13 = add nsw i32 %div, 1
%14 = trunc i64 %indvars.iv.ph to i32
%15 = sub i32 %13, %14
%16 = sub i32 %div, %14
%xtraiter = and i32 %15, 3
%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.preheader129, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader129 ]
%prol.iter = phi i32 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader129 ]
%arrayidx.prol = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.prol
%17 = load i32, ptr %arrayidx.prol, align 4, !tbaa !5
%arrayidx4.prol = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv.prol
store i32 %17, ptr %arrayidx4.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i32 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !13
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader129
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader129 ], [ %indvars.iv.next.prol, %for.body.prol ]
%18 = icmp ult i32 %16, 3
br i1 %18, label %for.cond6.preheader, label %for.body
for.cond6.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %if.end
%cmp7.not80.not = icmp slt i32 %div, %right
br i1 %cmp7.not80.not, label %for.body8.preheader, label %for.cond16.preheader
for.body8.preheader: ; preds = %for.cond6.preheader
%19 = sext i32 %right to i64
%narrow = add nsw i32 %div, 1
%20 = sext i32 %narrow to i64
%21 = add i32 %right, 1
%22 = xor i32 %div, -1
%23 = add i32 %22, %right
%24 = zext i32 %23 to i64
%25 = add nuw nsw i64 %24, 1
%min.iters.check111 = icmp ult i32 %23, 27
br i1 %min.iters.check111, label %for.body8.preheader128, label %vector.memcheck105
vector.memcheck105: ; preds = %for.body8.preheader
%26 = sext i32 %div to i64
%27 = shl nsw i64 %26, 2
%28 = getelementptr i8, ptr @A, i64 %27
%29 = xor i32 %div, -1
%30 = add i32 %29, %right
%31 = zext i32 %30 to i64
%32 = shl nuw nsw i64 %31, 2
%33 = getelementptr i8, ptr @A, i64 %27
%34 = getelementptr i8, ptr %33, i64 %32
%scevgep106 = getelementptr i8, ptr %34, i64 8
%35 = shl nsw i64 %19, 2
%36 = sub nsw i64 %35, %32
%scevgep107 = getelementptr i8, ptr %a, i64 %36
%37 = getelementptr i8, ptr %a, i64 %35
%bound0 = icmp ult ptr %28, %37
%bound1 = icmp ult ptr %scevgep107, %scevgep106
%found.conflict = and i1 %bound0, %bound1
br i1 %found.conflict, label %for.body8.preheader128, label %vector.ph112
vector.ph112: ; preds = %vector.memcheck105
%n.vec114 = and i64 %25, 8589934584
%ind.end115 = add nsw i64 %n.vec114, %20
%ind.end117 = sub nsw i64 %19, %n.vec114
br label %vector.body120
vector.body120: ; preds = %vector.body120, %vector.ph112
%index121 = phi i64 [ 0, %vector.ph112 ], [ %index.next127, %vector.body120 ]
%offset.idx122 = sub i64 %19, %index121
%offset.idx123 = add i64 %index121, %20
%38 = getelementptr inbounds i32, ptr %a, i64 %offset.idx122
%39 = getelementptr inbounds i32, ptr %38, i64 -3
%wide.load124 = load <4 x i32>, ptr %39, align 4, !tbaa !5, !alias.scope !15
%reverse = shufflevector <4 x i32> %wide.load124, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%40 = getelementptr inbounds i32, ptr %38, i64 -7
%wide.load125 = load <4 x i32>, ptr %40, align 4, !tbaa !5, !alias.scope !15
%reverse126 = shufflevector <4 x i32> %wide.load125, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%41 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %offset.idx123
store <4 x i32> %reverse, ptr %41, align 4, !tbaa !5, !alias.scope !18, !noalias !15
%42 = getelementptr inbounds i32, ptr %41, i64 4
store <4 x i32> %reverse126, ptr %42, align 4, !tbaa !5, !alias.scope !18, !noalias !15
%index.next127 = add nuw i64 %index121, 8
%43 = icmp eq i64 %index.next127, %n.vec114
br i1 %43, label %middle.block109, label %vector.body120, !llvm.loop !20
middle.block109: ; preds = %vector.body120
%cmp.n119 = icmp eq i64 %25, %n.vec114
br i1 %cmp.n119, label %for.cond16.preheader, label %for.body8.preheader128
for.body8.preheader128: ; preds = %vector.memcheck105, %for.body8.preheader, %middle.block109
%indvars.iv91.ph = phi i64 [ %20, %vector.memcheck105 ], [ %20, %for.body8.preheader ], [ %ind.end115, %middle.block109 ]
%indvars.iv89.ph = phi i64 [ %19, %vector.memcheck105 ], [ %19, %for.body8.preheader ], [ %ind.end117, %middle.block109 ]
%44 = add i32 %right, 1
%45 = trunc i64 %indvars.iv91.ph to i32
%46 = sub i32 %44, %45
%47 = sub i32 %right, %45
%xtraiter130 = and i32 %46, 3
%lcmp.mod131.not = icmp eq i32 %xtraiter130, 0
br i1 %lcmp.mod131.not, label %for.body8.prol.loopexit, label %for.body8.prol
for.body8.prol: ; preds = %for.body8.preheader128, %for.body8.prol
%indvars.iv91.prol = phi i64 [ %indvars.iv.next92.prol, %for.body8.prol ], [ %indvars.iv91.ph, %for.body8.preheader128 ]
%indvars.iv89.prol = phi i64 [ %indvars.iv.next90.prol, %for.body8.prol ], [ %indvars.iv89.ph, %for.body8.preheader128 ]
%prol.iter132 = phi i32 [ %prol.iter132.next, %for.body8.prol ], [ 0, %for.body8.preheader128 ]
%arrayidx10.prol = getelementptr inbounds i32, ptr %a, i64 %indvars.iv89.prol
%48 = load i32, ptr %arrayidx10.prol, align 4, !tbaa !5
%arrayidx12.prol = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv91.prol
store i32 %48, ptr %arrayidx12.prol, align 4, !tbaa !5
%indvars.iv.next92.prol = add nsw i64 %indvars.iv91.prol, 1
%indvars.iv.next90.prol = add nsw i64 %indvars.iv89.prol, -1
%prol.iter132.next = add i32 %prol.iter132, 1
%prol.iter132.cmp.not = icmp eq i32 %prol.iter132.next, %xtraiter130
br i1 %prol.iter132.cmp.not, label %for.body8.prol.loopexit, label %for.body8.prol, !llvm.loop !21
for.body8.prol.loopexit: ; preds = %for.body8.prol, %for.body8.preheader128
%indvars.iv91.unr = phi i64 [ %indvars.iv91.ph, %for.body8.preheader128 ], [ %indvars.iv.next92.prol, %for.body8.prol ]
%indvars.iv89.unr = phi i64 [ %indvars.iv89.ph, %for.body8.preheader128 ], [ %indvars.iv.next90.prol, %for.body8.prol ]
%49 = icmp ult i32 %47, 3
br i1 %49, label %for.cond16.preheader, label %for.body8.preheader128.new
for.body8.preheader128.new: ; preds = %for.body8.prol.loopexit
%invariant.gep = getelementptr i32, ptr %a, i64 -1
%invariant.gep133 = getelementptr i32, ptr %a, i64 -2
%invariant.gep135 = getelementptr i32, ptr %a, i64 -3
br label %for.body8
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%50 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx4 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv
store i32 %50, ptr %arrayidx4, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next
%51 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%arrayidx4.1 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv.next
store i32 %51, ptr %arrayidx4.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next.1
%52 = load i32, ptr %arrayidx.2, align 4, !tbaa !5
%arrayidx4.2 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv.next.1
store i32 %52, ptr %arrayidx4.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next.2
%53 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%arrayidx4.3 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv.next.2
store i32 %53, ptr %arrayidx4.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nsw i64 %indvars.iv, 4
%lftr.wideiv.3 = trunc i64 %indvars.iv.next.3 to i32
%exitcond.not.3 = icmp eq i32 %add1, %lftr.wideiv.3
br i1 %exitcond.not.3, label %for.cond6.preheader, label %for.body, !llvm.loop !22
for.cond16.preheader: ; preds = %for.body8.prol.loopexit, %for.body8, %middle.block109, %for.cond6.preheader
%cmp17.not83 = icmp sgt i32 %left, %right
br i1 %cmp17.not83, label %cleanup, label %for.body18.preheader
for.body18.preheader: ; preds = %for.cond16.preheader
%54 = sext i32 %left to i64
%55 = add i32 %right, 1
br label %for.body18
for.body8: ; preds = %for.body8, %for.body8.preheader128.new
%indvars.iv91 = phi i64 [ %indvars.iv91.unr, %for.body8.preheader128.new ], [ %indvars.iv.next92.3, %for.body8 ]
%indvars.iv89 = phi i64 [ %indvars.iv89.unr, %for.body8.preheader128.new ], [ %indvars.iv.next90.3, %for.body8 ]
%arrayidx10 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv89
%56 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%arrayidx12 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv91
store i32 %56, ptr %arrayidx12, align 4, !tbaa !5
%indvars.iv.next92 = add nsw i64 %indvars.iv91, 1
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv89
%57 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx12.1 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv.next92
store i32 %57, ptr %arrayidx12.1, align 4, !tbaa !5
%indvars.iv.next92.1 = add nsw i64 %indvars.iv91, 2
%gep134 = getelementptr i32, ptr %invariant.gep133, i64 %indvars.iv89
%58 = load i32, ptr %gep134, align 4, !tbaa !5
%arrayidx12.2 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv.next92.1
store i32 %58, ptr %arrayidx12.2, align 4, !tbaa !5
%indvars.iv.next92.2 = add nsw i64 %indvars.iv91, 3
%gep136 = getelementptr i32, ptr %invariant.gep135, i64 %indvars.iv89
%59 = load i32, ptr %gep136, align 4, !tbaa !5
%arrayidx12.3 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %indvars.iv.next92.2
store i32 %59, ptr %arrayidx12.3, align 4, !tbaa !5
%indvars.iv.next92.3 = add nsw i64 %indvars.iv91, 4
%indvars.iv.next90.3 = add nsw i64 %indvars.iv89, -4
%lftr.wideiv96.3 = trunc i64 %indvars.iv.next92.3 to i32
%exitcond97.not.3 = icmp eq i32 %21, %lftr.wideiv96.3
br i1 %exitcond97.not.3, label %for.cond16.preheader, label %for.body8, !llvm.loop !23
for.body18: ; preds = %for.body18.preheader, %for.body18
%indvars.iv98 = phi i64 [ %54, %for.body18.preheader ], [ %indvars.iv.next99, %for.body18 ]
%j.185 = phi i32 [ %right, %for.body18.preheader ], [ %j.2, %for.body18 ]
%i.284 = phi i32 [ %left, %for.body18.preheader ], [ %i.3, %for.body18 ]
%idxprom19 = sext i32 %i.284 to i64
%arrayidx20 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %idxprom19
%60 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%idxprom21 = sext i32 %j.185 to i64
%arrayidx22 = getelementptr inbounds [500000 x i32], ptr @A, i64 0, i64 %idxprom21
%61 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.not = icmp sle i32 %60, %61
%.sink = tail call i32 @llvm.smin.i32(i32 %60, i32 %61)
%inc25 = zext i1 %cmp23.not to i32
%i.3 = add nsw i32 %i.284, %inc25
%not.cmp23.not = xor i1 %cmp23.not, true
%dec31 = sext i1 %not.cmp23.not to i32
%j.2 = add nsw i32 %j.185, %dec31
%62 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv98
store i32 %.sink, ptr %62, align 4
%storemerge.in = load i32, ptr @count, align 4, !tbaa !5
%storemerge = add nsw i32 %storemerge.in, 1
store i32 %storemerge, ptr @count, align 4, !tbaa !5
%indvars.iv.next99 = add nsw i64 %indvars.iv98, 1
%lftr.wideiv101 = trunc i64 %indvars.iv.next99 to i32
%exitcond102.not = icmp eq i32 %55, %lftr.wideiv101
br i1 %exitcond102.not, label %cleanup, label %for.body18, !llvm.loop !24
cleanup: ; preds = %for.body18, %for.cond16.preheader, %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 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:
%total = alloca i32, align 4
%A = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %total) #6
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %total)
%0 = load i32, ptr %total, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %total, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !25
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%sub = add nsw i32 %.lcssa, -1
call void @Merge(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %sub)
%3 = load i32, ptr %total, align 4, !tbaa !5
%cmp323 = icmp sgt i32 %3, 0
br i1 %cmp323, label %if.end.peel, label %for.end11
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call8.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %total, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %4, 1
br i1 %cmp3.peel, label %if.end, label %for.end11
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv27 = phi i64 [ %indvars.iv.next28, %if.end ], [ 1, %if.end.peel ]
%putchar20 = call i32 @putchar(i32 32)
%arrayidx7 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv27
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
%6 = load i32, ptr %total, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next28, %7
br i1 %cmp3, label %if.end, label %for.end11, !llvm.loop !26
for.end11: ; preds = %if.end, %if.end.peel, %for.end
%putchar = call i32 @putchar(i32 10)
%8 = load i32, ptr @count, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %total) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) 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 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = !{!16}
!16 = distinct !{!16, !17}
!17 = distinct !{!17, !"LVerDomain"}
!18 = !{!19}
!19 = distinct !{!19, !17}
!20 = distinct !{!20, !10, !11, !12}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !10, !11}
!23 = distinct !{!23, !10, !11}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10, !27}
!27 = !{!"llvm.loop.peeled.count", i32 1}
|
#include<stdio.h>
#define N 500000
#define M 2000000000
int count,S[N],L[N/2+2],R[N/2+2];
void mergeSort(int * ,int ,int);
void merge(int * ,int ,int ,int);
int main()
{
int n,i;
count=0;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&S[i]);
mergeSort(S,0,n);
for(i=0;i<n;i++){
printf("%d",S[i]);
if(i<n-1)printf(" ");
}
printf("\n%d\n",count);
return 0;
}
void merge(int *S,int left,int mid,int right){
int i,j,k;
int l,r;
l=mid-left;
r=right-mid;
for(i=0;i<l;i++)
L[i]=S[left+i];
for(i=0;i<r;i++)
R[i]=S[mid+i];
L[l]=M;
R[r]=M;
i=0;
j=0;
for(k=left;k<right;k++){
count++;
if(L[i]<=R[j])S[k]=L[i++];
else S[k]=R[j++];
}
}
void mergeSort(int *S,int left,int right){
int mid;
if(left+1<right){
mid=(left+right)/2;
mergeSort(S,left,mid);
mergeSort(S,mid,right);
merge(S,left,mid,right);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148288/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148288/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@S = dso_local global [500000 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
@L = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
store i32 0, ptr @count, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr @S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull @S, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp322 = icmp sgt i32 %3, 0
br i1 %cmp322, label %for.body4, label %for.end12
for.body4: ; preds = %for.end, %for.inc10
%indvars.iv26 = phi i64 [ %indvars.iv.next27, %for.inc10 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr @S, i64 0, i64 %indvars.iv26
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp8 = icmp slt i64 %indvars.iv26, %6
br i1 %cmp8, label %if.then, label %for.inc10
if.then: ; preds = %for.body4
%putchar = call i32 @putchar(i32 32)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc10
for.inc10: ; preds = %for.body4, %if.then
%7 = phi i32 [ %5, %for.body4 ], [ %.pre, %if.then ]
%indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next27, %8
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !11
for.end12: ; preds = %for.inc10, %for.end
%9 = load i32, ptr @count, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
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: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %S, i32 noundef %left, i32 noundef %right) local_unnamed_addr #3 {
entry:
%S12 = ptrtoint ptr %S to i64
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %S, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %S, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub i32 %right, %div
%cmp65.i = icmp sgt i32 %sub.i, 0
br i1 %cmp65.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %S, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %S12
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load13 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load13, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !15
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp567.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp567.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count79.i = zext i32 %sub1.i to i64
%invariant.gep86.i = getelementptr i32, ptr %S, i64 %13
%min.iters.check18 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check18, label %for.body6.i.preheader, label %vector.memcheck14
vector.memcheck14: ; preds = %for.body6.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %S12
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check15 = icmp ult i64 %16, 32
br i1 %diff.check15, label %for.body6.i.preheader, label %vector.ph19
vector.ph19: ; preds = %vector.memcheck14
%n.vec21 = and i64 %wide.trip.count79.i, 4294967288
br label %vector.body24
vector.body24: ; preds = %vector.body24, %vector.ph19
%index25 = phi i64 [ 0, %vector.ph19 ], [ %index.next28, %vector.body24 ]
%17 = getelementptr i32, ptr %invariant.gep86.i, i64 %index25
%wide.load26 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load27 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index25
store <4 x i32> %wide.load26, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load27, ptr %20, align 16, !tbaa !5
%index.next28 = add nuw i64 %index25, 8
%21 = icmp eq i64 %index.next28, %n.vec21
br i1 %21, label %middle.block16, label %vector.body24, !llvm.loop !17
middle.block16: ; preds = %vector.body24
%cmp.n23 = icmp eq i64 %n.vec21, %wide.trip.count79.i
br i1 %cmp.n23, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck14, %for.body6.preheader.i, %middle.block16
%indvars.iv75.i.ph = phi i64 [ 0, %vector.memcheck14 ], [ 0, %for.body6.preheader.i ], [ %n.vec21, %middle.block16 ]
%22 = xor i64 %indvars.iv75.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count79.i
%xtraiter29 = and i64 %wide.trip.count79.i, 3
%lcmp.mod30.not = icmp eq i64 %xtraiter29, 0
br i1 %lcmp.mod30.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv75.i.prol = phi i64 [ %indvars.iv.next76.i.prol, %for.body6.i.prol ], [ %indvars.iv75.i.ph, %for.body6.i.preheader ]
%prol.iter31 = phi i64 [ %prol.iter31.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep87.i.prol = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv75.i.prol
%24 = load i32, ptr %gep87.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.i.prol
store i32 %24, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next76.i.prol = add nuw nsw i64 %indvars.iv75.i.prol, 1
%prol.iter31.next = add i64 %prol.iter31, 1
%prol.iter31.cmp.not = icmp eq i64 %prol.iter31.next, %xtraiter29
br i1 %prol.iter31.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !18
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv75.i.unr = phi i64 [ %indvars.iv75.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next76.i.prol, %for.body6.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !19
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv75.i = phi i64 [ %indvars.iv.next76.i.3, %for.body6.i ], [ %indvars.iv75.i.unr, %for.body6.i.prol.loopexit ]
%gep87.i = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv75.i
%30 = load i32, ptr %gep87.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.i
store i32 %30, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next76.i = add nuw nsw i64 %indvars.iv75.i, 1
%gep87.i.1 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i
%31 = load i32, ptr %gep87.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i
store i32 %31, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next76.i.1 = add nuw nsw i64 %indvars.iv75.i, 2
%gep87.i.2 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i.1
%32 = load i32, ptr %gep87.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i.1
store i32 %32, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next76.i.2 = add nuw nsw i64 %indvars.iv75.i, 3
%gep87.i.3 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i.2
%33 = load i32, ptr %gep87.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i.2
store i32 %33, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next76.i.3 = add nuw nsw i64 %indvars.iv75.i, 4
%exitcond80.not.i.3 = icmp eq i64 %indvars.iv.next76.i.3, %wide.trip.count79.i
br i1 %exitcond80.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !20
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block16, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub.i to i64
%arrayidx16.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom15.i
store i32 2000000000, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub1.i to i64
%arrayidx18.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom17.i
store i32 2000000000, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %left to i64
%wide.trip.count84.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv81.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next82.i, %for.body21.i ]
%i.272.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.body21.i ]
%j.071.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.body21.i ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22.i = add nsw i32 %35, 1
store i32 %inc22.i, ptr @count, align 4, !tbaa !5
%idxprom23.i = zext i32 %i.272.i to i64
%arrayidx24.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23.i
%36 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = zext i32 %j.071.i to i64
%arrayidx26.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25.i
%37 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%cmp27.not.i = icmp sgt i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc33.i = zext i1 %cmp27.not.i to i32
%j.1.i = add nuw nsw i32 %j.071.i, %inc33.i
%not.cmp27.not.i = xor i1 %cmp27.not.i, true
%inc28.i = zext i1 %not.cmp27.not.i to i32
%i.3.i = add nuw nsw i32 %i.272.i, %inc28.i
%38 = getelementptr inbounds i32, ptr %S, i64 %indvars.iv81.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next82.i = add nsw i64 %indvars.iv81.i, 1
%exitcond85.not.i = icmp eq i64 %indvars.iv.next82.i, %wide.trip.count84.i
br i1 %exitcond85.not.i, label %if.end, label %for.body21.i, !llvm.loop !21
if.end: ; preds = %for.body21.i, %entry
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %S, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #3 {
entry:
%S88 = ptrtoint ptr %S to i64
%sub = sub nsw i32 %mid, %left
%sub1 = sub i32 %right, %mid
%cmp65 = icmp sgt i32 %sub, 0
br i1 %cmp65, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %S, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader106, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %S88
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader106, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load89 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load89, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !22
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond4.preheader, label %for.body.preheader106
for.body.preheader106: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader106, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader106 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader106 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !23
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader106
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader106 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp567 = icmp sgt i32 %sub1, 0
br i1 %cmp567, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %mid to i64
%wide.trip.count79 = zext i32 %sub1 to i64
%invariant.gep86 = getelementptr i32, ptr %S, i64 %13
%min.iters.check94 = icmp ult i32 %sub1, 12
br i1 %min.iters.check94, label %for.body6.preheader105, label %vector.memcheck90
vector.memcheck90: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %S88
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check91 = icmp ult i64 %16, 32
br i1 %diff.check91, label %for.body6.preheader105, label %vector.ph95
vector.ph95: ; preds = %vector.memcheck90
%n.vec97 = and i64 %wide.trip.count79, 4294967288
br label %vector.body100
vector.body100: ; preds = %vector.body100, %vector.ph95
%index101 = phi i64 [ 0, %vector.ph95 ], [ %index.next104, %vector.body100 ]
%17 = getelementptr i32, ptr %invariant.gep86, i64 %index101
%wide.load102 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load103 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index101
store <4 x i32> %wide.load102, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load103, ptr %20, align 16, !tbaa !5
%index.next104 = add nuw i64 %index101, 8
%21 = icmp eq i64 %index.next104, %n.vec97
br i1 %21, label %middle.block92, label %vector.body100, !llvm.loop !24
middle.block92: ; preds = %vector.body100
%cmp.n99 = icmp eq i64 %n.vec97, %wide.trip.count79
br i1 %cmp.n99, label %for.end14, label %for.body6.preheader105
for.body6.preheader105: ; preds = %vector.memcheck90, %for.body6.preheader, %middle.block92
%indvars.iv75.ph = phi i64 [ 0, %vector.memcheck90 ], [ 0, %for.body6.preheader ], [ %n.vec97, %middle.block92 ]
%22 = xor i64 %indvars.iv75.ph, -1
%23 = add nsw i64 %22, %wide.trip.count79
%xtraiter107 = and i64 %wide.trip.count79, 3
%lcmp.mod108.not = icmp eq i64 %xtraiter107, 0
br i1 %lcmp.mod108.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader105, %for.body6.prol
%indvars.iv75.prol = phi i64 [ %indvars.iv.next76.prol, %for.body6.prol ], [ %indvars.iv75.ph, %for.body6.preheader105 ]
%prol.iter109 = phi i64 [ %prol.iter109.next, %for.body6.prol ], [ 0, %for.body6.preheader105 ]
%gep87.prol = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv75.prol
%24 = load i32, ptr %gep87.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.prol
store i32 %24, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next76.prol = add nuw nsw i64 %indvars.iv75.prol, 1
%prol.iter109.next = add i64 %prol.iter109, 1
%prol.iter109.cmp.not = icmp eq i64 %prol.iter109.next, %xtraiter107
br i1 %prol.iter109.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !25
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader105
%indvars.iv75.unr = phi i64 [ %indvars.iv75.ph, %for.body6.preheader105 ], [ %indvars.iv.next76.prol, %for.body6.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !26
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv75 = phi i64 [ %indvars.iv.next76.3, %for.body6 ], [ %indvars.iv75.unr, %for.body6.prol.loopexit ]
%gep87 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv75
%30 = load i32, ptr %gep87, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75
store i32 %30, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%gep87.1 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76
%31 = load i32, ptr %gep87.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76
store i32 %31, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next76.1 = add nuw nsw i64 %indvars.iv75, 2
%gep87.2 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76.1
%32 = load i32, ptr %gep87.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.1
store i32 %32, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next76.2 = add nuw nsw i64 %indvars.iv75, 3
%gep87.3 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76.2
%33 = load i32, ptr %gep87.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.2
store i32 %33, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next76.3 = add nuw nsw i64 %indvars.iv75, 4
%exitcond80.not.3 = icmp eq i64 %indvars.iv.next76.3, %wide.trip.count79
br i1 %exitcond80.not.3, label %for.end14, label %for.body6, !llvm.loop !27
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block92, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom15
store i32 2000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom17
store i32 2000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2069 = icmp slt i32 %left, %right
br i1 %cmp2069, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %left to i64
%wide.trip.count84 = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv81 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next82, %for.body21 ]
%i.272 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%j.071 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22 = add nsw i32 %35, 1
store i32 %inc22, ptr @count, align 4, !tbaa !5
%idxprom23 = zext i32 %i.272 to i64
%arrayidx24 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23
%36 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.071 to i64
%arrayidx26 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25
%37 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sgt i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc33 = zext i1 %cmp27.not to i32
%j.1 = add nuw nsw i32 %j.071, %inc33
%not.cmp27.not = xor i1 %cmp27.not, true
%inc28 = zext i1 %not.cmp27.not to i32
%i.3 = add nuw nsw i32 %i.272, %inc28
%38 = getelementptr inbounds i32, ptr %S, i64 %indvars.iv81
store i32 %.sink, ptr %38, align 4
%indvars.iv.next82 = add nsw i64 %indvars.iv81, 1
%exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count84
br i1 %exitcond85.not, label %for.end40, label %for.body21, !llvm.loop !21
for.end40: ; preds = %for.body21, %for.end14
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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 = { 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 #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}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !10, !13, !14}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !10, !13}
!20 = distinct !{!20, !10, !13}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10, !13, !14}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !10, !13, !14}
!25 = distinct !{!25, !16}
!26 = distinct !{!26, !10, !13}
!27 = distinct !{!27, !10, !13}
|
#include <stdio.h>
#include <stdlib.h>
#define INF 1000000001
void merge(int *, int, int, int);
void mergeSort(int *, int, int);
int cnt=0;
int main(){
int i,n,s[500000];
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&s[i]);
mergeSort(s, 0, n);
for(i=0;i<n;i++){
if(i)printf(" ");
printf("%d",s[i]);
}
printf("\n%d\n",cnt);
return 0;
}
void mergeSort(int *A, int left, int right){
int mid;
if(left+1 < right){
mid = (left+right)/2;
mergeSort(A, left, mid);
mergeSort(A, mid, right);
merge(A, left, mid, right);
}
}
void merge(int *A, int left, int mid, int right){
int i,j,k,n1,n2,l[500000],r[500000];
n1 = mid - left;
n2 = right - mid;
// l = malloc(sizeof(int)*n1);
// r = malloc(sizeof(int)*n2);
for(i=0;i<n1;i++)l[i]=A[left+i];
for(i=0;i<n2;i++)r[i]=A[mid+i];
l[n1]=INF;r[n2]=INF;
i=0;j=0;
for(k=left;k<right;k++){
cnt++;
if(l[i]<=r[j]){
A[k]=l[i];
i++;
}
else{
A[k]=r[j];
j++;
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148330/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148330/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %s) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %s, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp321 = icmp sgt i32 %3, 0
br i1 %cmp321, label %if.end.peel, label %for.end11
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr %s, align 16, !tbaa !5
%call8.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %4, 1
br i1 %cmp3.peel, label %if.end, label %for.end11
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv25 = phi i64 [ %indvars.iv.next26, %if.end ], [ 1, %if.end.peel ]
%putchar = call i32 @putchar(i32 32)
%arrayidx7 = getelementptr inbounds [500000 x i32], ptr %s, i64 0, i64 %indvars.iv25
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next26, %7
br i1 %cmp3, label %if.end, label %for.end11, !llvm.loop !11
for.end11: ; preds = %if.end, %if.end.peel, %for.end
%8 = load i32, ptr @cnt, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %s) #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(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #3 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; 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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #3 {
entry:
%l = alloca [500000 x i32], align 16
%r = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %l) #7
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %r) #7
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %l, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body.preheader, %entry
%cmp569 = icmp sgt i32 %sub1, 0
br i1 %cmp569, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep77 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %r, ptr noundef nonnull align 4 dereferenceable(1) %scevgep77, i64 %13, i1 false), !tbaa !5
br label %for.end14
for.end14: ; preds = %for.body6.preheader, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [500000 x i32], ptr %l, i64 0, i64 %idxprom15
store i32 1000000001, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [500000 x i32], ptr %r, i64 0, i64 %idxprom17
store i32 1000000001, ptr %arrayidx18, align 4, !tbaa !5
%cmp2071 = icmp slt i32 %left, %right
br i1 %cmp2071, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv = phi i64 [ %14, %for.body21.preheader ], [ %indvars.iv.next, %for.body21 ]
%i.274 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%j.073 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%15 = load i32, ptr @cnt, align 4, !tbaa !5
%inc22 = add nsw i32 %15, 1
store i32 %inc22, ptr @cnt, align 4, !tbaa !5
%idxprom23 = zext i32 %i.274 to i64
%arrayidx24 = getelementptr inbounds [500000 x i32], ptr %l, i64 0, i64 %idxprom23
%16 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.073 to i64
%arrayidx26 = getelementptr inbounds [500000 x i32], ptr %r, i64 0, i64 %idxprom25
%17 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sgt i32 %16, %17
%.sink = tail call i32 @llvm.smin.i32(i32 %16, i32 %17)
%inc37 = zext i1 %cmp27.not to i32
%j.1 = add nuw nsw i32 %j.073, %inc37
%not.cmp27.not = xor i1 %cmp27.not, true
%inc32 = zext i1 %not.cmp27.not to i32
%i.3 = add nuw nsw i32 %i.274, %inc32
%18 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %18, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end40, label %for.body21, !llvm.loop !13
for.end40: ; preds = %for.body21, %for.end14
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %r) #7
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %l) #7
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; 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) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.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(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 #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <math.h>
int count = 0;
void merge(int A[],int left,int mid,int right){
int n1 = mid - left,n2 = right - mid;
int L[n1],R[n2];
int i,j,k;
for(i=0;i<=n1-1;i++)L[i] = A[left + i];
for(i=0;i<=n2-1;i++)R[i] = A[mid + i];
L[n1] = 10000000000;
R[n2] = 10000000000;
i = 0;j = 0;
for(k=left;k<=right-1;k++){
if(L[i]<=R[j]){
A[k] = L[i];
i++;
}
else{
A[k] = R[j];
j++;
}
count++;
}
}
void mergeSort(int A[],int left,int right){
if(left+1<right){
int mid = (left + right)/2;
mergeSort(A,left,mid);
mergeSort(A,mid,right);
merge(A,left,mid,right);
}
}
int main(){
int n,S[10000000],i;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&S[i]);
mergeSort(S,0,n);
for(i=0;i<n-1;i++)printf("%d ",S[i]);
printf("%d\n",S[i]);
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148374/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148374/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%0 = zext i32 %sub to i64
%vla = alloca i32, i64 %0, align 16
%1 = zext i32 %sub1 to i64
%vla2 = alloca i32, i64 %1, align 16
%cmp.not.not73 = icmp sgt i32 %sub, 0
br i1 %cmp.not.not73, label %for.body.preheader, label %for.cond6.preheader
for.body.preheader: ; preds = %entry
%2 = sext i32 %left to i64
%3 = shl nsw i64 %2, 2
%scevgep = getelementptr i8, ptr %A, i64 %3
%4 = xor i32 %left, -1
%5 = add i32 %4, %mid
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
%8 = add nuw nsw i64 %7, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %8, i1 false), !tbaa !5
br label %for.cond6.preheader
for.cond6.preheader: ; preds = %for.body.preheader, %entry
%cmp8.not.not75 = icmp sgt i32 %sub1, 0
br i1 %cmp8.not.not75, label %for.body9.preheader, label %for.end17
for.body9.preheader: ; preds = %for.cond6.preheader
%9 = sext i32 %mid to i64
%10 = shl nsw i64 %9, 2
%scevgep83 = getelementptr i8, ptr %A, i64 %10
%11 = xor i32 %mid, -1
%12 = add i32 %11, %right
%13 = zext i32 %12 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nuw nsw i64 %14, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla2, ptr noundef nonnull align 4 dereferenceable(1) %scevgep83, i64 %15, i1 false), !tbaa !5
br label %for.end17
for.end17: ; preds = %for.body9.preheader, %for.cond6.preheader
%idxprom18 = sext i32 %sub to i64
%arrayidx19 = getelementptr inbounds i32, ptr %vla, i64 %idxprom18
store i32 1410065408, ptr %arrayidx19, align 4, !tbaa !5
%idxprom20 = sext i32 %sub1 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom20
store i32 1410065408, ptr %arrayidx21, align 4, !tbaa !5
%cmp24.not.not77 = icmp slt i32 %left, %right
br i1 %cmp24.not.not77, label %for.body25.preheader, label %for.end44
for.body25.preheader: ; preds = %for.end17
%16 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body25
for.body25: ; preds = %for.body25.preheader, %for.body25
%indvars.iv = phi i64 [ %16, %for.body25.preheader ], [ %indvars.iv.next, %for.body25 ]
%j.079 = phi i32 [ 0, %for.body25.preheader ], [ %j.1, %for.body25 ]
%i.278 = phi i32 [ 0, %for.body25.preheader ], [ %i.3, %for.body25 ]
%idxprom26 = zext i32 %i.278 to i64
%arrayidx27 = getelementptr inbounds i32, ptr %vla, i64 %idxprom26
%17 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%idxprom28 = zext i32 %j.079 to i64
%arrayidx29 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom28
%18 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%cmp30.not = icmp sle i32 %17, %18
%.sink = tail call i32 @llvm.smin.i32(i32 %17, i32 %18)
%inc35 = zext i1 %cmp30.not to i32
%i.3 = add nuw nsw i32 %i.278, %inc35
%not.cmp30.not = xor i1 %cmp30.not, true
%inc40 = zext i1 %not.cmp30.not to i32
%j.1 = add nuw nsw i32 %j.079, %inc40
%19 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %19, align 4
%20 = load i32, ptr @count, align 4, !tbaa !5
%inc41 = add nsw i32 %20, 1
store i32 %inc41, ptr @count, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end44, label %for.body25, !llvm.loop !9
for.end44: ; preds = %for.body25, %for.end17
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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret12
common.ret12: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right)
br label %common.ret12
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%S = alloca [10000000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 40000000, ptr nonnull %S) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %S, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp324 = icmp sgt i32 %3, 1
br i1 %cmp324, label %for.body4, label %for.end10
for.body4: ; preds = %for.end, %for.body4
%indvars.iv29 = phi i64 [ %indvars.iv.next30, %for.body4 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [10000000 x i32], ptr %S, i64 0, i64 %indvars.iv29
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next30, %6
br i1 %cmp3, label %for.body4, label %for.end10.loopexit, !llvm.loop !12
for.end10.loopexit: ; preds = %for.body4
%7 = and i64 %indvars.iv.next30, 4294967295
br label %for.end10
for.end10: ; preds = %for.end10.loopexit, %for.end
%i.1.lcssa = phi i64 [ 0, %for.end ], [ %7, %for.end10.loopexit ]
%arrayidx12 = getelementptr inbounds [10000000 x i32], ptr %S, i64 0, i64 %i.1.lcssa
%8 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
%9 = load i32, ptr @count, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 40000000, ptr nonnull %S) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#define MAX 500000
#define SENTINEL 1000000001
int count;
int L[MAX/2+2],R[MAX/2+2];
void merge(int a[MAX],int n,int left,int mid,int right){
int n1=mid-left;
int n2=right-mid;
for(int i=0;i<n1;i++)L[i]=a[left+i];
for(int i=0;i<n2;i++)R[i]=a[mid+i];
L[n1]=SENTINEL;
R[n2]=SENTINEL;
int i=0,j=0;
for(int k=left;k<right;k++){
count++;
if(L[i]<=R[j]){
a[k]=L[i++];
}
else a[k]=R[j++];
}
}
void mergeSort(int a[MAX],int n,int left,int right){
if(left+1<right){
int mid=(left+right)/2;
mergeSort(a,n,left,mid);
mergeSort(a,n,mid,right);
merge(a,n,left,mid,right);
}
}
int main(void){
int a[MAX],n,i;
count=0;
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",&a[i]);
mergeSort(a,n,0,n);
for(int i=0;i<n;i++){
if(i)printf(" ");
printf("%d",a[i]);
}
printf("\n");
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148417/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148417/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@L = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = 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
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %a, i32 noundef %n, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%a90 = ptrtoint ptr %a to i64
%sub = sub nsw i32 %mid, %left
%sub1 = sub i32 %right, %mid
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond5.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %a, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader108, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %a90
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader108, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load91 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load91, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, 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.cond5.preheader, label %for.body.preheader108
for.body.preheader108: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader108, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader108 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader108 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !13
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader108
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader108 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond5.preheader, label %for.body
for.cond5.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp669 = icmp sgt i32 %sub1, 0
br i1 %cmp669, label %for.body8.preheader, label %for.cond.cleanup7
for.body8.preheader: ; preds = %for.cond5.preheader
%13 = sext i32 %mid to i64
%wide.trip.count81 = zext i32 %sub1 to i64
%invariant.gep88 = getelementptr i32, ptr %a, i64 %13
%min.iters.check96 = icmp ult i32 %sub1, 12
br i1 %min.iters.check96, label %for.body8.preheader107, label %vector.memcheck92
vector.memcheck92: ; preds = %for.body8.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %a90
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check93 = icmp ult i64 %16, 32
br i1 %diff.check93, label %for.body8.preheader107, label %vector.ph97
vector.ph97: ; preds = %vector.memcheck92
%n.vec99 = and i64 %wide.trip.count81, 4294967288
br label %vector.body102
vector.body102: ; preds = %vector.body102, %vector.ph97
%index103 = phi i64 [ 0, %vector.ph97 ], [ %index.next106, %vector.body102 ]
%17 = getelementptr i32, ptr %invariant.gep88, i64 %index103
%wide.load104 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load105 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index103
store <4 x i32> %wide.load104, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load105, ptr %20, align 16, !tbaa !5
%index.next106 = add nuw i64 %index103, 8
%21 = icmp eq i64 %index.next106, %n.vec99
br i1 %21, label %middle.block94, label %vector.body102, !llvm.loop !15
middle.block94: ; preds = %vector.body102
%cmp.n101 = icmp eq i64 %n.vec99, %wide.trip.count81
br i1 %cmp.n101, label %for.cond.cleanup7, label %for.body8.preheader107
for.body8.preheader107: ; preds = %vector.memcheck92, %for.body8.preheader, %middle.block94
%indvars.iv77.ph = phi i64 [ 0, %vector.memcheck92 ], [ 0, %for.body8.preheader ], [ %n.vec99, %middle.block94 ]
%22 = xor i64 %indvars.iv77.ph, -1
%23 = add nsw i64 %22, %wide.trip.count81
%xtraiter109 = and i64 %wide.trip.count81, 3
%lcmp.mod110.not = icmp eq i64 %xtraiter109, 0
br i1 %lcmp.mod110.not, label %for.body8.prol.loopexit, label %for.body8.prol
for.body8.prol: ; preds = %for.body8.preheader107, %for.body8.prol
%indvars.iv77.prol = phi i64 [ %indvars.iv.next78.prol, %for.body8.prol ], [ %indvars.iv77.ph, %for.body8.preheader107 ]
%prol.iter111 = phi i64 [ %prol.iter111.next, %for.body8.prol ], [ 0, %for.body8.preheader107 ]
%gep89.prol = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv77.prol
%24 = load i32, ptr %gep89.prol, align 4, !tbaa !5
%arrayidx13.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv77.prol
store i32 %24, ptr %arrayidx13.prol, align 4, !tbaa !5
%indvars.iv.next78.prol = add nuw nsw i64 %indvars.iv77.prol, 1
%prol.iter111.next = add i64 %prol.iter111, 1
%prol.iter111.cmp.not = icmp eq i64 %prol.iter111.next, %xtraiter109
br i1 %prol.iter111.cmp.not, label %for.body8.prol.loopexit, label %for.body8.prol, !llvm.loop !16
for.body8.prol.loopexit: ; preds = %for.body8.prol, %for.body8.preheader107
%indvars.iv77.unr = phi i64 [ %indvars.iv77.ph, %for.body8.preheader107 ], [ %indvars.iv.next78.prol, %for.body8.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.cond.cleanup7, label %for.body8
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond5.preheader, label %for.body, !llvm.loop !17
for.cond.cleanup7: ; preds = %for.body8.prol.loopexit, %for.body8, %middle.block94, %for.cond5.preheader
%idxprom17 = sext i32 %sub to i64
%arrayidx18 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom17
store i32 1000000001, ptr %arrayidx18, align 4, !tbaa !5
%idxprom19 = sext i32 %sub1 to i64
%arrayidx20 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom19
store i32 1000000001, ptr %arrayidx20, align 4, !tbaa !5
%cmp2371 = icmp slt i32 %left, %right
br i1 %cmp2371, label %for.body25.preheader, label %for.cond.cleanup24
for.body25.preheader: ; preds = %for.cond.cleanup7
%30 = sext i32 %left to i64
%wide.trip.count86 = sext i32 %right to i64
br label %for.body25
for.body8: ; preds = %for.body8.prol.loopexit, %for.body8
%indvars.iv77 = phi i64 [ %indvars.iv.next78.3, %for.body8 ], [ %indvars.iv77.unr, %for.body8.prol.loopexit ]
%gep89 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv77
%31 = load i32, ptr %gep89, align 4, !tbaa !5
%arrayidx13 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv77
store i32 %31, ptr %arrayidx13, align 4, !tbaa !5
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%gep89.1 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78
%32 = load i32, ptr %gep89.1, align 4, !tbaa !5
%arrayidx13.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78
store i32 %32, ptr %arrayidx13.1, align 4, !tbaa !5
%indvars.iv.next78.1 = add nuw nsw i64 %indvars.iv77, 2
%gep89.2 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78.1
%33 = load i32, ptr %gep89.2, align 4, !tbaa !5
%arrayidx13.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.1
store i32 %33, ptr %arrayidx13.2, align 4, !tbaa !5
%indvars.iv.next78.2 = add nuw nsw i64 %indvars.iv77, 3
%gep89.3 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78.2
%34 = load i32, ptr %gep89.3, align 4, !tbaa !5
%arrayidx13.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.2
store i32 %34, ptr %arrayidx13.3, align 4, !tbaa !5
%indvars.iv.next78.3 = add nuw nsw i64 %indvars.iv77, 4
%exitcond82.not.3 = icmp eq i64 %indvars.iv.next78.3, %wide.trip.count81
br i1 %exitcond82.not.3, label %for.cond.cleanup7, label %for.body8, !llvm.loop !18
for.cond.cleanup24: ; preds = %for.body25, %for.cond.cleanup7
ret void
for.body25: ; preds = %for.body25.preheader, %for.body25
%indvars.iv83 = phi i64 [ %30, %for.body25.preheader ], [ %indvars.iv.next84, %for.body25 ]
%j.073 = phi i32 [ 0, %for.body25.preheader ], [ %j.1, %for.body25 ]
%i21.072 = phi i32 [ 0, %for.body25.preheader ], [ %i21.1, %for.body25 ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc26 = add nsw i32 %35, 1
store i32 %inc26, ptr @count, align 4, !tbaa !5
%idxprom27 = zext i32 %i21.072 to i64
%arrayidx28 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom27
%36 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%idxprom29 = zext i32 %j.073 to i64
%arrayidx30 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom29
%37 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%cmp31.not = icmp sle i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc32 = zext i1 %cmp31.not to i32
%i21.1 = add nuw nsw i32 %i21.072, %inc32
%not.cmp31.not = xor i1 %cmp31.not, true
%inc37 = zext i1 %not.cmp31.not to i32
%j.1 = add nuw nsw i32 %j.073, %inc37
%38 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv83
store i32 %.sink, ptr %38, align 4
%indvars.iv.next84 = add nsw i64 %indvars.iv83, 1
%exitcond87.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count86
br i1 %exitcond87.not, label %for.cond.cleanup24, label %for.body25, !llvm.loop !19
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %a, i32 noundef %n, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%a14 = ptrtoint ptr %a to i64
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %a, i32 noundef %n, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %a, i32 noundef %n, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub i32 %right, %div
%cmp67.i = icmp sgt i32 %sub.i, 0
br i1 %cmp67.i, label %for.body.preheader.i, label %for.cond5.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %a, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %a14
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load15 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load15, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond5.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !21
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond5.preheader.i, label %for.body.i
for.cond5.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp669.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp669.i, label %for.body8.preheader.i, label %for.cond.cleanup7.i
for.body8.preheader.i: ; preds = %for.cond5.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count81.i = zext i32 %sub1.i to i64
%invariant.gep88.i = getelementptr i32, ptr %a, i64 %13
%min.iters.check20 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check20, label %for.body8.i.preheader, label %vector.memcheck16
vector.memcheck16: ; preds = %for.body8.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %a14
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check17 = icmp ult i64 %16, 32
br i1 %diff.check17, label %for.body8.i.preheader, label %vector.ph21
vector.ph21: ; preds = %vector.memcheck16
%n.vec23 = and i64 %wide.trip.count81.i, 4294967288
br label %vector.body26
vector.body26: ; preds = %vector.body26, %vector.ph21
%index27 = phi i64 [ 0, %vector.ph21 ], [ %index.next30, %vector.body26 ]
%17 = getelementptr i32, ptr %invariant.gep88.i, i64 %index27
%wide.load28 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load29 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index27
store <4 x i32> %wide.load28, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load29, ptr %20, align 16, !tbaa !5
%index.next30 = add nuw i64 %index27, 8
%21 = icmp eq i64 %index.next30, %n.vec23
br i1 %21, label %middle.block18, label %vector.body26, !llvm.loop !22
middle.block18: ; preds = %vector.body26
%cmp.n25 = icmp eq i64 %n.vec23, %wide.trip.count81.i
br i1 %cmp.n25, label %for.cond.cleanup7.i, label %for.body8.i.preheader
for.body8.i.preheader: ; preds = %vector.memcheck16, %for.body8.preheader.i, %middle.block18
%indvars.iv77.i.ph = phi i64 [ 0, %vector.memcheck16 ], [ 0, %for.body8.preheader.i ], [ %n.vec23, %middle.block18 ]
%22 = xor i64 %indvars.iv77.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count81.i
%xtraiter31 = and i64 %wide.trip.count81.i, 3
%lcmp.mod32.not = icmp eq i64 %xtraiter31, 0
br i1 %lcmp.mod32.not, label %for.body8.i.prol.loopexit, label %for.body8.i.prol
for.body8.i.prol: ; preds = %for.body8.i.preheader, %for.body8.i.prol
%indvars.iv77.i.prol = phi i64 [ %indvars.iv.next78.i.prol, %for.body8.i.prol ], [ %indvars.iv77.i.ph, %for.body8.i.preheader ]
%prol.iter33 = phi i64 [ %prol.iter33.next, %for.body8.i.prol ], [ 0, %for.body8.i.preheader ]
%gep89.i.prol = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv77.i.prol
%24 = load i32, ptr %gep89.i.prol, align 4, !tbaa !5
%arrayidx13.i.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv77.i.prol
store i32 %24, ptr %arrayidx13.i.prol, align 4, !tbaa !5
%indvars.iv.next78.i.prol = add nuw nsw i64 %indvars.iv77.i.prol, 1
%prol.iter33.next = add i64 %prol.iter33, 1
%prol.iter33.cmp.not = icmp eq i64 %prol.iter33.next, %xtraiter31
br i1 %prol.iter33.cmp.not, label %for.body8.i.prol.loopexit, label %for.body8.i.prol, !llvm.loop !23
for.body8.i.prol.loopexit: ; preds = %for.body8.i.prol, %for.body8.i.preheader
%indvars.iv77.i.unr = phi i64 [ %indvars.iv77.i.ph, %for.body8.i.preheader ], [ %indvars.iv.next78.i.prol, %for.body8.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.cond.cleanup7.i, label %for.body8.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond5.preheader.i, label %for.body.i, !llvm.loop !24
for.cond.cleanup7.i: ; preds = %for.body8.i.prol.loopexit, %for.body8.i, %middle.block18, %for.cond5.preheader.i
%idxprom17.i = sext i32 %sub.i to i64
%arrayidx18.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom17.i
store i32 1000000001, ptr %arrayidx18.i, align 4, !tbaa !5
%idxprom19.i = sext i32 %sub1.i to i64
%arrayidx20.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom19.i
store i32 1000000001, ptr %arrayidx20.i, align 4, !tbaa !5
%30 = sext i32 %left to i64
%wide.trip.count86.i = sext i32 %right to i64
br label %for.body25.i
for.body8.i: ; preds = %for.body8.i.prol.loopexit, %for.body8.i
%indvars.iv77.i = phi i64 [ %indvars.iv.next78.i.3, %for.body8.i ], [ %indvars.iv77.i.unr, %for.body8.i.prol.loopexit ]
%gep89.i = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv77.i
%31 = load i32, ptr %gep89.i, align 4, !tbaa !5
%arrayidx13.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv77.i
store i32 %31, ptr %arrayidx13.i, align 4, !tbaa !5
%indvars.iv.next78.i = add nuw nsw i64 %indvars.iv77.i, 1
%gep89.i.1 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i
%32 = load i32, ptr %gep89.i.1, align 4, !tbaa !5
%arrayidx13.i.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i
store i32 %32, ptr %arrayidx13.i.1, align 4, !tbaa !5
%indvars.iv.next78.i.1 = add nuw nsw i64 %indvars.iv77.i, 2
%gep89.i.2 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i.1
%33 = load i32, ptr %gep89.i.2, align 4, !tbaa !5
%arrayidx13.i.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i.1
store i32 %33, ptr %arrayidx13.i.2, align 4, !tbaa !5
%indvars.iv.next78.i.2 = add nuw nsw i64 %indvars.iv77.i, 3
%gep89.i.3 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i.2
%34 = load i32, ptr %gep89.i.3, align 4, !tbaa !5
%arrayidx13.i.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i.2
store i32 %34, ptr %arrayidx13.i.3, align 4, !tbaa !5
%indvars.iv.next78.i.3 = add nuw nsw i64 %indvars.iv77.i, 4
%exitcond82.not.i.3 = icmp eq i64 %indvars.iv.next78.i.3, %wide.trip.count81.i
br i1 %exitcond82.not.i.3, label %for.cond.cleanup7.i, label %for.body8.i, !llvm.loop !25
for.body25.i: ; preds = %for.body25.i, %for.cond.cleanup7.i
%indvars.iv83.i = phi i64 [ %30, %for.cond.cleanup7.i ], [ %indvars.iv.next84.i, %for.body25.i ]
%j.073.i = phi i32 [ 0, %for.cond.cleanup7.i ], [ %j.1.i, %for.body25.i ]
%i21.072.i = phi i32 [ 0, %for.cond.cleanup7.i ], [ %i21.1.i, %for.body25.i ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc26.i = add nsw i32 %35, 1
store i32 %inc26.i, ptr @count, align 4, !tbaa !5
%idxprom27.i = zext i32 %i21.072.i to i64
%arrayidx28.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom27.i
%36 = load i32, ptr %arrayidx28.i, align 4, !tbaa !5
%idxprom29.i = zext i32 %j.073.i to i64
%arrayidx30.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom29.i
%37 = load i32, ptr %arrayidx30.i, align 4, !tbaa !5
%cmp31.not.i = icmp sle i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc32.i = zext i1 %cmp31.not.i to i32
%i21.1.i = add nuw nsw i32 %i21.072.i, %inc32.i
%not.cmp31.not.i = xor i1 %cmp31.not.i, true
%inc37.i = zext i1 %not.cmp31.not.i to i32
%j.1.i = add nuw nsw i32 %j.073.i, %inc37.i
%38 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv83.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next84.i = add nsw i64 %indvars.iv83.i, 1
%exitcond87.not.i = icmp eq i64 %indvars.iv.next84.i, %wide.trip.count86.i
br i1 %exitcond87.not.i, label %if.end, label %for.body25.i, !llvm.loop !19
if.end: ; preds = %for.body25.i, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%a = alloca [500000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %a) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
store i32 0, ptr @count, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %3, %for.body ]
call void @mergeSort(ptr noundef nonnull %a, i32 noundef %.lcssa, i32 noundef 0, i32 noundef %.lcssa)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp525 = icmp sgt i32 %1, 0
br i1 %cmp525, label %if.end.peel, label %for.cond.cleanup6
if.end.peel: ; preds = %for.cond.cleanup
%.pre = load i32, ptr %a, align 16, !tbaa !5
%call11.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp5.peel = icmp sgt i32 %2, 1
br i1 %cmp5.peel, label %if.end, label %for.cond.cleanup6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !26
for.cond.cleanup6: ; preds = %if.end, %if.end.peel, %for.cond.cleanup
%putchar = call i32 @putchar(i32 10)
%5 = load i32, ptr @count, align 4, !tbaa !5
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %5)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %a) #6
ret i32 0
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv29 = phi i64 [ %indvars.iv.next30, %if.end ], [ 1, %if.end.peel ]
%putchar22 = call i32 @putchar(i32 32)
%arrayidx10 = getelementptr inbounds [500000 x i32], ptr %a, i64 0, i64 %indvars.iv29
%6 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %6)
%indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp5 = icmp slt i64 %indvars.iv.next30, %8
br i1 %cmp5, label %if.end, label %for.cond.cleanup6, !llvm.loop !27
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) 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 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !10, !11}
!18 = distinct !{!18, !10, !11}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !11, !12}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !10, !11, !12}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !10, !11}
!25 = distinct !{!25, !10, !11}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10, !28}
!28 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
#define MAX 500000
#define SENTINEL 2000000000/*教科書の無限大*/
int L[MAX/2+2], R[MAX/2+2];
int cnt;
void merge(int A[],int n,int left, int mid, int right) {
int i, j, k;/*k=統合*/
int n1 = mid -left;
int n2 = right - mid;
for(i=0;i<n1;i++) L[i] = A[left + i];
for(i=0;i<n2;i++) R[i] = A[mid + i];
L[n1] = R[n2] = SENTINEL;
i=0, j=0;
for(k=left; k<right; k++) {
cnt++;
if(L[i]<=R[j]) {/*以下にする理由安定なソートであるため*/
A[k] = L[i++];
} else {
A[k] = R[j++];
}
}
}
void mergeSort(int A[],int n,int left,int right) {
int mid;
if(left+1 < right) {
mid = (left+right) / 2;
mergeSort(A,n,left,mid);
mergeSort(A,n,mid, right);
merge(A,n,left,mid,right);
}
}
int main(void) {
int A[MAX], n, i;
cnt = 0;
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&A[i]);
mergeSort(A, n, 0, n);
for(i=0;i<n;i++) {
if(i) printf(" ");
printf("%d",A[i]);
}
printf("\n%d\n",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148460/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148460/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@L = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %n, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A88 = ptrtoint ptr %A to i64
%sub = sub nsw i32 %mid, %left
%sub1 = sub i32 %right, %mid
%cmp65 = icmp sgt i32 %sub, 0
br i1 %cmp65, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader106, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A88
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader106, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load89 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load89, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, 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.cond4.preheader, label %for.body.preheader106
for.body.preheader106: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader106, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader106 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader106 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !13
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader106
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader106 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp567 = icmp sgt i32 %sub1, 0
br i1 %cmp567, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %mid to i64
%wide.trip.count79 = zext i32 %sub1 to i64
%invariant.gep86 = getelementptr i32, ptr %A, i64 %13
%min.iters.check94 = icmp ult i32 %sub1, 12
br i1 %min.iters.check94, label %for.body6.preheader105, label %vector.memcheck90
vector.memcheck90: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A88
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check91 = icmp ult i64 %16, 32
br i1 %diff.check91, label %for.body6.preheader105, label %vector.ph95
vector.ph95: ; preds = %vector.memcheck90
%n.vec97 = and i64 %wide.trip.count79, 4294967288
br label %vector.body100
vector.body100: ; preds = %vector.body100, %vector.ph95
%index101 = phi i64 [ 0, %vector.ph95 ], [ %index.next104, %vector.body100 ]
%17 = getelementptr i32, ptr %invariant.gep86, i64 %index101
%wide.load102 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load103 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index101
store <4 x i32> %wide.load102, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load103, ptr %20, align 16, !tbaa !5
%index.next104 = add nuw i64 %index101, 8
%21 = icmp eq i64 %index.next104, %n.vec97
br i1 %21, label %middle.block92, label %vector.body100, !llvm.loop !15
middle.block92: ; preds = %vector.body100
%cmp.n99 = icmp eq i64 %n.vec97, %wide.trip.count79
br i1 %cmp.n99, label %for.end14, label %for.body6.preheader105
for.body6.preheader105: ; preds = %vector.memcheck90, %for.body6.preheader, %middle.block92
%indvars.iv75.ph = phi i64 [ 0, %vector.memcheck90 ], [ 0, %for.body6.preheader ], [ %n.vec97, %middle.block92 ]
%22 = xor i64 %indvars.iv75.ph, -1
%23 = add nsw i64 %22, %wide.trip.count79
%xtraiter107 = and i64 %wide.trip.count79, 3
%lcmp.mod108.not = icmp eq i64 %xtraiter107, 0
br i1 %lcmp.mod108.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader105, %for.body6.prol
%indvars.iv75.prol = phi i64 [ %indvars.iv.next76.prol, %for.body6.prol ], [ %indvars.iv75.ph, %for.body6.preheader105 ]
%prol.iter109 = phi i64 [ %prol.iter109.next, %for.body6.prol ], [ 0, %for.body6.preheader105 ]
%gep87.prol = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv75.prol
%24 = load i32, ptr %gep87.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.prol
store i32 %24, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next76.prol = add nuw nsw i64 %indvars.iv75.prol, 1
%prol.iter109.next = add i64 %prol.iter109, 1
%prol.iter109.cmp.not = icmp eq i64 %prol.iter109.next, %xtraiter107
br i1 %prol.iter109.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !16
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader105
%indvars.iv75.unr = phi i64 [ %indvars.iv75.ph, %for.body6.preheader105 ], [ %indvars.iv.next76.prol, %for.body6.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !17
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv75 = phi i64 [ %indvars.iv.next76.3, %for.body6 ], [ %indvars.iv75.unr, %for.body6.prol.loopexit ]
%gep87 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv75
%30 = load i32, ptr %gep87, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75
store i32 %30, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%gep87.1 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76
%31 = load i32, ptr %gep87.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76
store i32 %31, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next76.1 = add nuw nsw i64 %indvars.iv75, 2
%gep87.2 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76.1
%32 = load i32, ptr %gep87.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.1
store i32 %32, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next76.2 = add nuw nsw i64 %indvars.iv75, 3
%gep87.3 = getelementptr i32, ptr %invariant.gep86, i64 %indvars.iv.next76.2
%33 = load i32, ptr %gep87.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.2
store i32 %33, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next76.3 = add nuw nsw i64 %indvars.iv75, 4
%exitcond80.not.3 = icmp eq i64 %indvars.iv.next76.3, %wide.trip.count79
br i1 %exitcond80.not.3, label %for.end14, label %for.body6, !llvm.loop !18
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block92, %for.cond4.preheader
%idxprom15 = sext i32 %sub1 to i64
%arrayidx16 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom15
store i32 2000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub to i64
%arrayidx18 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom17
store i32 2000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2069 = icmp slt i32 %left, %right
br i1 %cmp2069, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %left to i64
%wide.trip.count84 = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv81 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next82, %for.body21 ]
%i.272 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%j.071 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%35 = load i32, ptr @cnt, align 4, !tbaa !5
%inc22 = add nsw i32 %35, 1
store i32 %inc22, ptr @cnt, align 4, !tbaa !5
%idxprom23 = zext i32 %i.272 to i64
%arrayidx24 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23
%36 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.071 to i64
%arrayidx26 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25
%37 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sgt i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc33 = zext i1 %cmp27.not to i32
%j.1 = add nuw nsw i32 %j.071, %inc33
%not.cmp27.not = xor i1 %cmp27.not, true
%inc28 = zext i1 %not.cmp27.not to i32
%i.3 = add nuw nsw i32 %i.272, %inc28
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv81
store i32 %.sink, ptr %38, align 4
%indvars.iv.next82 = add nsw i64 %indvars.iv81, 1
%exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count84
br i1 %exitcond85.not, label %for.end40, label %for.body21, !llvm.loop !19
for.end40: ; preds = %for.body21, %for.end14
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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %n, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A14 = ptrtoint ptr %A to i64
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %n, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %n, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub i32 %right, %div
%cmp65.i = icmp sgt i32 %sub.i, 0
br i1 %cmp65.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A14
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load15 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load15, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !21
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp567.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp567.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count79.i = zext i32 %sub1.i to i64
%invariant.gep86.i = getelementptr i32, ptr %A, i64 %13
%min.iters.check20 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check20, label %for.body6.i.preheader, label %vector.memcheck16
vector.memcheck16: ; preds = %for.body6.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A14
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check17 = icmp ult i64 %16, 32
br i1 %diff.check17, label %for.body6.i.preheader, label %vector.ph21
vector.ph21: ; preds = %vector.memcheck16
%n.vec23 = and i64 %wide.trip.count79.i, 4294967288
br label %vector.body26
vector.body26: ; preds = %vector.body26, %vector.ph21
%index27 = phi i64 [ 0, %vector.ph21 ], [ %index.next30, %vector.body26 ]
%17 = getelementptr i32, ptr %invariant.gep86.i, i64 %index27
%wide.load28 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load29 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index27
store <4 x i32> %wide.load28, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load29, ptr %20, align 16, !tbaa !5
%index.next30 = add nuw i64 %index27, 8
%21 = icmp eq i64 %index.next30, %n.vec23
br i1 %21, label %middle.block18, label %vector.body26, !llvm.loop !22
middle.block18: ; preds = %vector.body26
%cmp.n25 = icmp eq i64 %n.vec23, %wide.trip.count79.i
br i1 %cmp.n25, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck16, %for.body6.preheader.i, %middle.block18
%indvars.iv75.i.ph = phi i64 [ 0, %vector.memcheck16 ], [ 0, %for.body6.preheader.i ], [ %n.vec23, %middle.block18 ]
%22 = xor i64 %indvars.iv75.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count79.i
%xtraiter31 = and i64 %wide.trip.count79.i, 3
%lcmp.mod32.not = icmp eq i64 %xtraiter31, 0
br i1 %lcmp.mod32.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv75.i.prol = phi i64 [ %indvars.iv.next76.i.prol, %for.body6.i.prol ], [ %indvars.iv75.i.ph, %for.body6.i.preheader ]
%prol.iter33 = phi i64 [ %prol.iter33.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep87.i.prol = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv75.i.prol
%24 = load i32, ptr %gep87.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.i.prol
store i32 %24, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next76.i.prol = add nuw nsw i64 %indvars.iv75.i.prol, 1
%prol.iter33.next = add i64 %prol.iter33, 1
%prol.iter33.cmp.not = icmp eq i64 %prol.iter33.next, %xtraiter31
br i1 %prol.iter33.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !23
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv75.i.unr = phi i64 [ %indvars.iv75.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next76.i.prol, %for.body6.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !24
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv75.i = phi i64 [ %indvars.iv.next76.i.3, %for.body6.i ], [ %indvars.iv75.i.unr, %for.body6.i.prol.loopexit ]
%gep87.i = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv75.i
%30 = load i32, ptr %gep87.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv75.i
store i32 %30, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next76.i = add nuw nsw i64 %indvars.iv75.i, 1
%gep87.i.1 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i
%31 = load i32, ptr %gep87.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i
store i32 %31, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next76.i.1 = add nuw nsw i64 %indvars.iv75.i, 2
%gep87.i.2 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i.1
%32 = load i32, ptr %gep87.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i.1
store i32 %32, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next76.i.2 = add nuw nsw i64 %indvars.iv75.i, 3
%gep87.i.3 = getelementptr i32, ptr %invariant.gep86.i, i64 %indvars.iv.next76.i.2
%33 = load i32, ptr %gep87.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next76.i.2
store i32 %33, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next76.i.3 = add nuw nsw i64 %indvars.iv75.i, 4
%exitcond80.not.i.3 = icmp eq i64 %indvars.iv.next76.i.3, %wide.trip.count79.i
br i1 %exitcond80.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !25
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block18, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub1.i to i64
%arrayidx16.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom15.i
store i32 2000000000, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub.i to i64
%arrayidx18.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom17.i
store i32 2000000000, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %left to i64
%wide.trip.count84.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv81.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next82.i, %for.body21.i ]
%i.272.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.body21.i ]
%j.071.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.body21.i ]
%35 = load i32, ptr @cnt, align 4, !tbaa !5
%inc22.i = add nsw i32 %35, 1
store i32 %inc22.i, ptr @cnt, align 4, !tbaa !5
%idxprom23.i = zext i32 %i.272.i to i64
%arrayidx24.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23.i
%36 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = zext i32 %j.071.i to i64
%arrayidx26.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25.i
%37 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%cmp27.not.i = icmp sgt i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc33.i = zext i1 %cmp27.not.i to i32
%j.1.i = add nuw nsw i32 %j.071.i, %inc33.i
%not.cmp27.not.i = xor i1 %cmp27.not.i, true
%inc28.i = zext i1 %not.cmp27.not.i to i32
%i.3.i = add nuw nsw i32 %i.272.i, %inc28.i
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv81.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next82.i = add nsw i64 %indvars.iv81.i, 1
%exitcond85.not.i = icmp eq i64 %indvars.iv.next82.i, %wide.trip.count84.i
br i1 %exitcond85.not.i, label %if.end, label %for.body21.i, !llvm.loop !19
if.end: ; preds = %for.body21.i, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%A = alloca [500000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %A) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
store i32 0, ptr @cnt, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !26
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %A, i32 noundef %.lcssa, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp321 = icmp sgt i32 %3, 0
br i1 %cmp321, label %if.end.peel, label %for.end11
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr %A, align 16, !tbaa !5
%call8.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %4, 1
br i1 %cmp3.peel, label %if.end, label %for.end11
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv25 = phi i64 [ %indvars.iv.next26, %if.end ], [ 1, %if.end.peel ]
%putchar = call i32 @putchar(i32 32)
%arrayidx7 = getelementptr inbounds [500000 x i32], ptr %A, i64 0, i64 %indvars.iv25
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next26, %7
br i1 %cmp3, label %if.end, label %for.end11, !llvm.loop !27
for.end11: ; preds = %if.end, %if.end.peel, %for.end
%8 = load i32, ptr @cnt, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %A) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) 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 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !10, !11}
!18 = distinct !{!18, !10, !11}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !11, !12}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !10, !11, !12}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !10, !11}
!25 = distinct !{!25, !10, !11}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10, !28}
!28 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
int S[500000];
int L[250002], R[250002];
int cnt = 0;
#define SENTINEL 2147483647
void merge(int *A, int left, int mid, int right)
{
int n1, n2;
int i, j, k;
n1 = mid - left;
n2 = right - mid;
for (i = 0; i < n1; i++) {
L[i] = A[left + i];
}
L[i] = SENTINEL;
for (i = 0; i < n2; i++) {
R[i] = A[mid + i];
}
R[i] = SENTINEL;
for (i = 0,j = 0, k = left; k < right; k++) {
cnt++;
if (L[i] <= R[j]) {
A[k] = L[i];
i++;
}
else {
A[k] = R[j];
j++;
}
}
}
void mergeSort(int *A, int left, int right)
{
if (left + 1 < right) {
int mid = (left + right) / 2;
mergeSort(A, left, mid);
mergeSort(A, mid, right);
merge(A, left, mid, right);
}
}
int main()
{
int i, n;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &S[i]);
}
mergeSort(S, 0, n);
for (i = 0; i < n; i++) {
if (i) printf(" ");
printf("%d", S[i]);
}
printf("\n%d\n", cnt);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148503/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148503/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@L = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [250002 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@S = dso_local global [500000 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [5 x i8] c"\0A%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A91 = ptrtoint ptr %A to i64
%sub = sub nsw i32 %mid, %left
%sub1 = sub i32 %right, %mid
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader109, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A91
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader109, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load92 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load92, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, 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.loopexit, label %for.body.preheader109
for.body.preheader109: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader109, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader109 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader109 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !13
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader109
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader109 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.end.loopexit, label %for.body
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%13 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %13, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%14 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %14, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%15 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %15, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%16 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %16, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.end.loopexit, label %for.body, !llvm.loop !15
for.end.loopexit: ; preds = %for.body.prol.loopexit, %for.body, %middle.block
%17 = zext i32 %sub to i64
br label %for.end
for.end: ; preds = %entry, %for.end.loopexit
%i.0.lcssa = phi i64 [ %17, %for.end.loopexit ], [ 0, %entry ]
%arrayidx5 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %i.0.lcssa
store i32 2147483647, ptr %arrayidx5, align 4, !tbaa !5
%cmp769 = icmp sgt i32 %sub1, 0
br i1 %cmp769, label %for.body8.preheader, label %for.end16
for.body8.preheader: ; preds = %for.end
%18 = sext i32 %mid to i64
%wide.trip.count82 = zext i32 %sub1 to i64
%invariant.gep89 = getelementptr i32, ptr %A, i64 %18
%min.iters.check97 = icmp ult i32 %sub1, 12
br i1 %min.iters.check97, label %for.body8.preheader108, label %vector.memcheck93
vector.memcheck93: ; preds = %for.body8.preheader
%19 = shl nsw i64 %18, 2
%20 = add i64 %19, %A91
%21 = sub i64 ptrtoint (ptr @R to i64), %20
%diff.check94 = icmp ult i64 %21, 32
br i1 %diff.check94, label %for.body8.preheader108, label %vector.ph98
vector.ph98: ; preds = %vector.memcheck93
%n.vec100 = and i64 %wide.trip.count82, 4294967288
br label %vector.body103
vector.body103: ; preds = %vector.body103, %vector.ph98
%index104 = phi i64 [ 0, %vector.ph98 ], [ %index.next107, %vector.body103 ]
%22 = getelementptr i32, ptr %invariant.gep89, i64 %index104
%wide.load105 = load <4 x i32>, ptr %22, align 4, !tbaa !5
%23 = getelementptr i32, ptr %22, i64 4
%wide.load106 = load <4 x i32>, ptr %23, align 4, !tbaa !5
%24 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index104
store <4 x i32> %wide.load105, ptr %24, align 16, !tbaa !5
%25 = getelementptr inbounds i32, ptr %24, i64 4
store <4 x i32> %wide.load106, ptr %25, align 16, !tbaa !5
%index.next107 = add nuw i64 %index104, 8
%26 = icmp eq i64 %index.next107, %n.vec100
br i1 %26, label %middle.block95, label %vector.body103, !llvm.loop !16
middle.block95: ; preds = %vector.body103
%cmp.n102 = icmp eq i64 %n.vec100, %wide.trip.count82
br i1 %cmp.n102, label %for.end16.loopexit, label %for.body8.preheader108
for.body8.preheader108: ; preds = %vector.memcheck93, %for.body8.preheader, %middle.block95
%indvars.iv78.ph = phi i64 [ 0, %vector.memcheck93 ], [ 0, %for.body8.preheader ], [ %n.vec100, %middle.block95 ]
%27 = xor i64 %indvars.iv78.ph, -1
%28 = add nsw i64 %27, %wide.trip.count82
%xtraiter110 = and i64 %wide.trip.count82, 3
%lcmp.mod111.not = icmp eq i64 %xtraiter110, 0
br i1 %lcmp.mod111.not, label %for.body8.prol.loopexit, label %for.body8.prol
for.body8.prol: ; preds = %for.body8.preheader108, %for.body8.prol
%indvars.iv78.prol = phi i64 [ %indvars.iv.next79.prol, %for.body8.prol ], [ %indvars.iv78.ph, %for.body8.preheader108 ]
%prol.iter112 = phi i64 [ %prol.iter112.next, %for.body8.prol ], [ 0, %for.body8.preheader108 ]
%gep90.prol = getelementptr i32, ptr %invariant.gep89, i64 %indvars.iv78.prol
%29 = load i32, ptr %gep90.prol, align 4, !tbaa !5
%arrayidx13.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv78.prol
store i32 %29, ptr %arrayidx13.prol, align 4, !tbaa !5
%indvars.iv.next79.prol = add nuw nsw i64 %indvars.iv78.prol, 1
%prol.iter112.next = add i64 %prol.iter112, 1
%prol.iter112.cmp.not = icmp eq i64 %prol.iter112.next, %xtraiter110
br i1 %prol.iter112.cmp.not, label %for.body8.prol.loopexit, label %for.body8.prol, !llvm.loop !17
for.body8.prol.loopexit: ; preds = %for.body8.prol, %for.body8.preheader108
%indvars.iv78.unr = phi i64 [ %indvars.iv78.ph, %for.body8.preheader108 ], [ %indvars.iv.next79.prol, %for.body8.prol ]
%30 = icmp ult i64 %28, 3
br i1 %30, label %for.end16.loopexit, label %for.body8
for.body8: ; preds = %for.body8.prol.loopexit, %for.body8
%indvars.iv78 = phi i64 [ %indvars.iv.next79.3, %for.body8 ], [ %indvars.iv78.unr, %for.body8.prol.loopexit ]
%gep90 = getelementptr i32, ptr %invariant.gep89, i64 %indvars.iv78
%31 = load i32, ptr %gep90, align 4, !tbaa !5
%arrayidx13 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv78
store i32 %31, ptr %arrayidx13, align 4, !tbaa !5
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%gep90.1 = getelementptr i32, ptr %invariant.gep89, i64 %indvars.iv.next79
%32 = load i32, ptr %gep90.1, align 4, !tbaa !5
%arrayidx13.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next79
store i32 %32, ptr %arrayidx13.1, align 4, !tbaa !5
%indvars.iv.next79.1 = add nuw nsw i64 %indvars.iv78, 2
%gep90.2 = getelementptr i32, ptr %invariant.gep89, i64 %indvars.iv.next79.1
%33 = load i32, ptr %gep90.2, align 4, !tbaa !5
%arrayidx13.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next79.1
store i32 %33, ptr %arrayidx13.2, align 4, !tbaa !5
%indvars.iv.next79.2 = add nuw nsw i64 %indvars.iv78, 3
%gep90.3 = getelementptr i32, ptr %invariant.gep89, i64 %indvars.iv.next79.2
%34 = load i32, ptr %gep90.3, align 4, !tbaa !5
%arrayidx13.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next79.2
store i32 %34, ptr %arrayidx13.3, align 4, !tbaa !5
%indvars.iv.next79.3 = add nuw nsw i64 %indvars.iv78, 4
%exitcond83.not.3 = icmp eq i64 %indvars.iv.next79.3, %wide.trip.count82
br i1 %exitcond83.not.3, label %for.end16.loopexit, label %for.body8, !llvm.loop !18
for.end16.loopexit: ; preds = %for.body8.prol.loopexit, %for.body8, %middle.block95
%35 = zext i32 %sub1 to i64
br label %for.end16
for.end16: ; preds = %for.end, %for.end16.loopexit
%i.1.lcssa = phi i64 [ %35, %for.end16.loopexit ], [ 0, %for.end ]
%arrayidx18 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %i.1.lcssa
store i32 2147483647, ptr %arrayidx18, align 4, !tbaa !5
%cmp2072 = icmp slt i32 %left, %right
br i1 %cmp2072, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end16
%36 = sext i32 %left to i64
%wide.trip.count87 = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv84 = phi i64 [ %36, %for.body21.preheader ], [ %indvars.iv.next85, %for.body21 ]
%j.074 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%i.273 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%37 = load i32, ptr @cnt, align 4, !tbaa !5
%inc22 = add nsw i32 %37, 1
store i32 %inc22, ptr @cnt, align 4, !tbaa !5
%idxprom23 = zext i32 %i.273 to i64
%arrayidx24 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23
%38 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.074 to i64
%arrayidx26 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25
%39 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sle i32 %38, %39
%.sink = tail call i32 @llvm.smin.i32(i32 %38, i32 %39)
%inc32 = zext i1 %cmp27.not to i32
%i.3 = add nuw nsw i32 %i.273, %inc32
%not.cmp27.not = xor i1 %cmp27.not, true
%inc37 = zext i1 %not.cmp27.not to i32
%j.1 = add nuw nsw i32 %j.074, %inc37
%40 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv84
store i32 %.sink, ptr %40, align 4
%indvars.iv.next85 = add nsw i64 %indvars.iv84, 1
%exitcond88.not = icmp eq i64 %indvars.iv.next85, %wide.trip.count87
br i1 %exitcond88.not, label %for.end40, label %for.body21, !llvm.loop !19
for.end40: ; preds = %for.body21, %for.end16
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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A12 = ptrtoint ptr %A to i64
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub i32 %right, %div
%cmp67.i = icmp sgt i32 %sub.i, 0
br i1 %cmp67.i, label %for.body.preheader.i, label %for.end.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A12
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load13 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load13, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.end.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !21
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.end.i, label %for.body.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%13 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %13, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%14 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %14, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%15 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %15, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%16 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %16, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.end.i, label %for.body.i, !llvm.loop !22
for.end.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%i.0.lcssa.i = phi i64 [ 0, %if.then ], [ %wide.trip.count.i, %middle.block ], [ %wide.trip.count.i, %for.body.i ], [ %wide.trip.count.i, %for.body.i.prol.loopexit ]
%arrayidx5.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %i.0.lcssa.i
store i32 2147483647, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp769.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp769.i, label %for.body8.preheader.i, label %for.end16.i
for.body8.preheader.i: ; preds = %for.end.i
%17 = sext i32 %div to i64
%wide.trip.count82.i = zext i32 %sub1.i to i64
%invariant.gep89.i = getelementptr i32, ptr %A, i64 %17
%min.iters.check18 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check18, label %for.body8.i.preheader, label %vector.memcheck14
vector.memcheck14: ; preds = %for.body8.preheader.i
%18 = shl nsw i64 %17, 2
%19 = add i64 %18, %A12
%20 = sub i64 ptrtoint (ptr @R to i64), %19
%diff.check15 = icmp ult i64 %20, 32
br i1 %diff.check15, label %for.body8.i.preheader, label %vector.ph19
vector.ph19: ; preds = %vector.memcheck14
%n.vec21 = and i64 %wide.trip.count82.i, 4294967288
br label %vector.body24
vector.body24: ; preds = %vector.body24, %vector.ph19
%index25 = phi i64 [ 0, %vector.ph19 ], [ %index.next28, %vector.body24 ]
%21 = getelementptr i32, ptr %invariant.gep89.i, i64 %index25
%wide.load26 = load <4 x i32>, ptr %21, align 4, !tbaa !5
%22 = getelementptr i32, ptr %21, i64 4
%wide.load27 = load <4 x i32>, ptr %22, align 4, !tbaa !5
%23 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %index25
store <4 x i32> %wide.load26, ptr %23, align 16, !tbaa !5
%24 = getelementptr inbounds i32, ptr %23, i64 4
store <4 x i32> %wide.load27, ptr %24, align 16, !tbaa !5
%index.next28 = add nuw i64 %index25, 8
%25 = icmp eq i64 %index.next28, %n.vec21
br i1 %25, label %middle.block16, label %vector.body24, !llvm.loop !23
middle.block16: ; preds = %vector.body24
%cmp.n23 = icmp eq i64 %n.vec21, %wide.trip.count82.i
br i1 %cmp.n23, label %for.end16.i, label %for.body8.i.preheader
for.body8.i.preheader: ; preds = %vector.memcheck14, %for.body8.preheader.i, %middle.block16
%indvars.iv78.i.ph = phi i64 [ 0, %vector.memcheck14 ], [ 0, %for.body8.preheader.i ], [ %n.vec21, %middle.block16 ]
%26 = xor i64 %indvars.iv78.i.ph, -1
%27 = add nsw i64 %26, %wide.trip.count82.i
%xtraiter29 = and i64 %wide.trip.count82.i, 3
%lcmp.mod30.not = icmp eq i64 %xtraiter29, 0
br i1 %lcmp.mod30.not, label %for.body8.i.prol.loopexit, label %for.body8.i.prol
for.body8.i.prol: ; preds = %for.body8.i.preheader, %for.body8.i.prol
%indvars.iv78.i.prol = phi i64 [ %indvars.iv.next79.i.prol, %for.body8.i.prol ], [ %indvars.iv78.i.ph, %for.body8.i.preheader ]
%prol.iter31 = phi i64 [ %prol.iter31.next, %for.body8.i.prol ], [ 0, %for.body8.i.preheader ]
%gep90.i.prol = getelementptr i32, ptr %invariant.gep89.i, i64 %indvars.iv78.i.prol
%28 = load i32, ptr %gep90.i.prol, align 4, !tbaa !5
%arrayidx13.i.prol = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv78.i.prol
store i32 %28, ptr %arrayidx13.i.prol, align 4, !tbaa !5
%indvars.iv.next79.i.prol = add nuw nsw i64 %indvars.iv78.i.prol, 1
%prol.iter31.next = add i64 %prol.iter31, 1
%prol.iter31.cmp.not = icmp eq i64 %prol.iter31.next, %xtraiter29
br i1 %prol.iter31.cmp.not, label %for.body8.i.prol.loopexit, label %for.body8.i.prol, !llvm.loop !24
for.body8.i.prol.loopexit: ; preds = %for.body8.i.prol, %for.body8.i.preheader
%indvars.iv78.i.unr = phi i64 [ %indvars.iv78.i.ph, %for.body8.i.preheader ], [ %indvars.iv.next79.i.prol, %for.body8.i.prol ]
%29 = icmp ult i64 %27, 3
br i1 %29, label %for.end16.i, label %for.body8.i
for.body8.i: ; preds = %for.body8.i.prol.loopexit, %for.body8.i
%indvars.iv78.i = phi i64 [ %indvars.iv.next79.i.3, %for.body8.i ], [ %indvars.iv78.i.unr, %for.body8.i.prol.loopexit ]
%gep90.i = getelementptr i32, ptr %invariant.gep89.i, i64 %indvars.iv78.i
%30 = load i32, ptr %gep90.i, align 4, !tbaa !5
%arrayidx13.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv78.i
store i32 %30, ptr %arrayidx13.i, align 4, !tbaa !5
%indvars.iv.next79.i = add nuw nsw i64 %indvars.iv78.i, 1
%gep90.i.1 = getelementptr i32, ptr %invariant.gep89.i, i64 %indvars.iv.next79.i
%31 = load i32, ptr %gep90.i.1, align 4, !tbaa !5
%arrayidx13.i.1 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next79.i
store i32 %31, ptr %arrayidx13.i.1, align 4, !tbaa !5
%indvars.iv.next79.i.1 = add nuw nsw i64 %indvars.iv78.i, 2
%gep90.i.2 = getelementptr i32, ptr %invariant.gep89.i, i64 %indvars.iv.next79.i.1
%32 = load i32, ptr %gep90.i.2, align 4, !tbaa !5
%arrayidx13.i.2 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next79.i.1
store i32 %32, ptr %arrayidx13.i.2, align 4, !tbaa !5
%indvars.iv.next79.i.2 = add nuw nsw i64 %indvars.iv78.i, 3
%gep90.i.3 = getelementptr i32, ptr %invariant.gep89.i, i64 %indvars.iv.next79.i.2
%33 = load i32, ptr %gep90.i.3, align 4, !tbaa !5
%arrayidx13.i.3 = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %indvars.iv.next79.i.2
store i32 %33, ptr %arrayidx13.i.3, align 4, !tbaa !5
%indvars.iv.next79.i.3 = add nuw nsw i64 %indvars.iv78.i, 4
%exitcond83.not.i.3 = icmp eq i64 %indvars.iv.next79.i.3, %wide.trip.count82.i
br i1 %exitcond83.not.i.3, label %for.end16.i, label %for.body8.i, !llvm.loop !25
for.end16.i: ; preds = %for.body8.i.prol.loopexit, %for.body8.i, %middle.block16, %for.end.i
%i.1.lcssa.i = phi i64 [ 0, %for.end.i ], [ %wide.trip.count82.i, %middle.block16 ], [ %wide.trip.count82.i, %for.body8.i ], [ %wide.trip.count82.i, %for.body8.i.prol.loopexit ]
%arrayidx18.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %i.1.lcssa.i
store i32 2147483647, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %left to i64
%wide.trip.count87.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end16.i
%indvars.iv84.i = phi i64 [ %34, %for.end16.i ], [ %indvars.iv.next85.i, %for.body21.i ]
%j.074.i = phi i32 [ 0, %for.end16.i ], [ %j.1.i, %for.body21.i ]
%i.273.i = phi i32 [ 0, %for.end16.i ], [ %i.3.i, %for.body21.i ]
%35 = load i32, ptr @cnt, align 4, !tbaa !5
%inc22.i = add nsw i32 %35, 1
store i32 %inc22.i, ptr @cnt, align 4, !tbaa !5
%idxprom23.i = zext i32 %i.273.i to i64
%arrayidx24.i = getelementptr inbounds [250002 x i32], ptr @L, i64 0, i64 %idxprom23.i
%36 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = zext i32 %j.074.i to i64
%arrayidx26.i = getelementptr inbounds [250002 x i32], ptr @R, i64 0, i64 %idxprom25.i
%37 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%cmp27.not.i = icmp sle i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc32.i = zext i1 %cmp27.not.i to i32
%i.3.i = add nuw nsw i32 %i.273.i, %inc32.i
%not.cmp27.not.i = xor i1 %cmp27.not.i, true
%inc37.i = zext i1 %not.cmp27.not.i to i32
%j.1.i = add nuw nsw i32 %j.074.i, %inc37.i
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv84.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next85.i = add nsw i64 %indvars.iv84.i, 1
%exitcond88.not.i = icmp eq i64 %indvars.iv.next85.i, %wide.trip.count87.i
br i1 %exitcond88.not.i, label %if.end, label %for.body21.i, !llvm.loop !19
if.end: ; preds = %for.body21.i, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr @S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !26
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull @S, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp321 = icmp sgt i32 %3, 0
br i1 %cmp321, label %if.end.peel, label %for.end11
if.end.peel: ; preds = %for.end
%.pre = load i32, ptr @S, align 16, !tbaa !5
%call8.peel = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.peel = icmp sgt i32 %4, 1
br i1 %cmp3.peel, label %if.end, label %for.end11
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv25 = phi i64 [ %indvars.iv.next26, %if.end ], [ 1, %if.end.peel ]
%putchar = call i32 @putchar(i32 32)
%arrayidx7 = getelementptr inbounds [500000 x i32], ptr @S, i64 0, i64 %indvars.iv25
%5 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5)
%indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next26, %7
br i1 %cmp3, label %if.end, label %for.end11, !llvm.loop !27
for.end11: ; preds = %if.end, %if.end.peel, %for.end
%8 = load i32, ptr @cnt, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10, !11}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !10, !11}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !11, !12}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !10, !11}
!23 = distinct !{!23, !10, !11, !12}
!24 = distinct !{!24, !14}
!25 = distinct !{!25, !10, !11}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10, !28}
!28 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
#define MAX 1000000000
int count,n,L[MAX/20],R[MAX/20];
void merge(int A[],int left,int mid,int right){
int i,k;
int n1 = mid - left;
int n2 = right - mid;
for(i=0;i<n1;i++)
L[i] = A[left+i];
for(i=0;i<n2;i++)
R[i] = A[mid+i];
L[n1] = MAX;
R[n2] = MAX;
int j=0;
i = 0;
for(k=left;k<right;k++){
count++;
if(L[i] <= R[j]){
A[k] = L[i];
i++;
}
else{
A[k] = R[j];
j++;
}
}
}
void mergeSort(int A[], int left, int right){
int mid;
if(left+1 < right){
mid = (left + right) / 2;
mergeSort(A, left, mid);
mergeSort(A, mid, right);
merge(A, left, mid, right);
}
}
int main(){
int i,S[500000];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&S[i]);
mergeSort(S,0,n);
for(i=0;i<n-1;i++){
printf("%d",S[i]);
printf(" ");
}
printf("%d\n%d\n",S[i],count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148547/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148547/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@L = dso_local local_unnamed_addr global [50000000 x i32] zeroinitializer, align 16
@R = dso_local local_unnamed_addr global [50000000 x i32] zeroinitializer, align 16
@count = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [7 x i8] c"%d\0A%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A90 = ptrtoint ptr %A to i64
%sub = sub nsw i32 %mid, %left
%sub1 = sub i32 %right, %mid
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%wide.trip.count = zext i32 %sub to i64
%invariant.gep = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub, 12
br i1 %min.iters.check, label %for.body.preheader108, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A90
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.preheader108, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%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 ]
%4 = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load91 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [50000000 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load91, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, 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.cond4.preheader, label %for.body.preheader108
for.body.preheader108: ; preds = %vector.memcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.ph, -1
%10 = add nsw i64 %9, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader108, %for.body.prol
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.preheader108 ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader108 ]
%gep.prol = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.prol
%11 = load i32, ptr %gep.prol, align 4, !tbaa !5
%arrayidx3.prol = getelementptr inbounds [50000000 x i32], ptr @L, i64 0, i64 %indvars.iv.prol
store i32 %11, ptr %arrayidx3.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !13
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader108
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body.preheader108 ], [ %indvars.iv.next.prol, %for.body.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader, label %for.body
for.cond4.preheader: ; preds = %for.body.prol.loopexit, %for.body, %middle.block, %entry
%cmp569 = icmp sgt i32 %sub1, 0
br i1 %cmp569, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%13 = sext i32 %mid to i64
%wide.trip.count81 = zext i32 %sub1 to i64
%invariant.gep88 = getelementptr i32, ptr %A, i64 %13
%min.iters.check96 = icmp ult i32 %sub1, 12
br i1 %min.iters.check96, label %for.body6.preheader107, label %vector.memcheck92
vector.memcheck92: ; preds = %for.body6.preheader
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A90
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check93 = icmp ult i64 %16, 32
br i1 %diff.check93, label %for.body6.preheader107, label %vector.ph97
vector.ph97: ; preds = %vector.memcheck92
%n.vec99 = and i64 %wide.trip.count81, 4294967288
br label %vector.body102
vector.body102: ; preds = %vector.body102, %vector.ph97
%index103 = phi i64 [ 0, %vector.ph97 ], [ %index.next106, %vector.body102 ]
%17 = getelementptr i32, ptr %invariant.gep88, i64 %index103
%wide.load104 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load105 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [50000000 x i32], ptr @R, i64 0, i64 %index103
store <4 x i32> %wide.load104, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load105, ptr %20, align 16, !tbaa !5
%index.next106 = add nuw i64 %index103, 8
%21 = icmp eq i64 %index.next106, %n.vec99
br i1 %21, label %middle.block94, label %vector.body102, !llvm.loop !15
middle.block94: ; preds = %vector.body102
%cmp.n101 = icmp eq i64 %n.vec99, %wide.trip.count81
br i1 %cmp.n101, label %for.end14, label %for.body6.preheader107
for.body6.preheader107: ; preds = %vector.memcheck92, %for.body6.preheader, %middle.block94
%indvars.iv77.ph = phi i64 [ 0, %vector.memcheck92 ], [ 0, %for.body6.preheader ], [ %n.vec99, %middle.block94 ]
%22 = xor i64 %indvars.iv77.ph, -1
%23 = add nsw i64 %22, %wide.trip.count81
%xtraiter109 = and i64 %wide.trip.count81, 3
%lcmp.mod110.not = icmp eq i64 %xtraiter109, 0
br i1 %lcmp.mod110.not, label %for.body6.prol.loopexit, label %for.body6.prol
for.body6.prol: ; preds = %for.body6.preheader107, %for.body6.prol
%indvars.iv77.prol = phi i64 [ %indvars.iv.next78.prol, %for.body6.prol ], [ %indvars.iv77.ph, %for.body6.preheader107 ]
%prol.iter111 = phi i64 [ %prol.iter111.next, %for.body6.prol ], [ 0, %for.body6.preheader107 ]
%gep89.prol = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv77.prol
%24 = load i32, ptr %gep89.prol, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds [50000000 x i32], ptr @R, i64 0, i64 %indvars.iv77.prol
store i32 %24, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next78.prol = add nuw nsw i64 %indvars.iv77.prol, 1
%prol.iter111.next = add i64 %prol.iter111, 1
%prol.iter111.cmp.not = icmp eq i64 %prol.iter111.next, %xtraiter109
br i1 %prol.iter111.cmp.not, label %for.body6.prol.loopexit, label %for.body6.prol, !llvm.loop !16
for.body6.prol.loopexit: ; preds = %for.body6.prol, %for.body6.preheader107
%indvars.iv77.unr = phi i64 [ %indvars.iv77.ph, %for.body6.preheader107 ], [ %indvars.iv.next78.prol, %for.body6.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14, label %for.body6
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.unr, %for.body.prol.loopexit ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%26 = load i32, ptr %gep, align 4, !tbaa !5
%arrayidx3 = getelementptr inbounds [50000000 x i32], ptr @L, i64 0, i64 %indvars.iv
store i32 %26, ptr %arrayidx3, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%gep.1 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next
%27 = load i32, ptr %gep.1, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [50000000 x i32], ptr @L, i64 0, i64 %indvars.iv.next
store i32 %27, ptr %arrayidx3.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%gep.2 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.1
%28 = load i32, ptr %gep.2, align 4, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [50000000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.1
store i32 %28, ptr %arrayidx3.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%gep.3 = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.next.2
%29 = load i32, ptr %gep.3, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [50000000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.2
store i32 %29, ptr %arrayidx3.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond4.preheader, label %for.body, !llvm.loop !17
for.body6: ; preds = %for.body6.prol.loopexit, %for.body6
%indvars.iv77 = phi i64 [ %indvars.iv.next78.3, %for.body6 ], [ %indvars.iv77.unr, %for.body6.prol.loopexit ]
%gep89 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv77
%30 = load i32, ptr %gep89, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [50000000 x i32], ptr @R, i64 0, i64 %indvars.iv77
store i32 %30, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%gep89.1 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78
%31 = load i32, ptr %gep89.1, align 4, !tbaa !5
%arrayidx11.1 = getelementptr inbounds [50000000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78
store i32 %31, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next78.1 = add nuw nsw i64 %indvars.iv77, 2
%gep89.2 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78.1
%32 = load i32, ptr %gep89.2, align 4, !tbaa !5
%arrayidx11.2 = getelementptr inbounds [50000000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.1
store i32 %32, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next78.2 = add nuw nsw i64 %indvars.iv77, 3
%gep89.3 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv.next78.2
%33 = load i32, ptr %gep89.3, align 4, !tbaa !5
%arrayidx11.3 = getelementptr inbounds [50000000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.2
store i32 %33, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next78.3 = add nuw nsw i64 %indvars.iv77, 4
%exitcond82.not.3 = icmp eq i64 %indvars.iv.next78.3, %wide.trip.count81
br i1 %exitcond82.not.3, label %for.end14, label %for.body6, !llvm.loop !18
for.end14: ; preds = %for.body6.prol.loopexit, %for.body6, %middle.block94, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [50000000 x i32], ptr @L, i64 0, i64 %idxprom15
store i32 1000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [50000000 x i32], ptr @R, i64 0, i64 %idxprom17
store i32 1000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2071 = icmp slt i32 %left, %right
br i1 %cmp2071, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%34 = sext i32 %left to i64
%wide.trip.count86 = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv83 = phi i64 [ %34, %for.body21.preheader ], [ %indvars.iv.next84, %for.body21 ]
%j.074 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%i.273 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22 = add nsw i32 %35, 1
store i32 %inc22, ptr @count, align 4, !tbaa !5
%idxprom23 = zext i32 %i.273 to i64
%arrayidx24 = getelementptr inbounds [50000000 x i32], ptr @L, i64 0, i64 %idxprom23
%36 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.074 to i64
%arrayidx26 = getelementptr inbounds [50000000 x i32], ptr @R, i64 0, i64 %idxprom25
%37 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sle i32 %36, %37
%.sink = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc32 = zext i1 %cmp27.not to i32
%i.3 = add nuw nsw i32 %i.273, %inc32
%not.cmp27.not = xor i1 %cmp27.not, true
%inc37 = zext i1 %not.cmp27.not to i32
%j.1 = add nuw nsw i32 %j.074, %inc37
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv83
store i32 %.sink, ptr %38, align 4
%indvars.iv.next84 = add nsw i64 %indvars.iv83, 1
%exitcond87.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count86
br i1 %exitcond87.not, label %for.end40, label %for.body21, !llvm.loop !19
for.end40: ; preds = %for.body21, %for.end14
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 nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%A12 = ptrtoint ptr %A to i64
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right)
%sub.i = sub nsw i32 %div, %left
%sub1.i = sub i32 %right, %div
%cmp67.i = icmp sgt i32 %sub.i, 0
br i1 %cmp67.i, label %for.body.preheader.i, label %for.cond4.preheader.i
for.body.preheader.i: ; preds = %if.then
%0 = sext i32 %left to i64
%wide.trip.count.i = zext i32 %sub.i to i64
%invariant.gep.i = getelementptr i32, ptr %A, i64 %0
%min.iters.check = icmp ult i32 %sub.i, 12
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.body.preheader.i
%1 = shl nsw i64 %0, 2
%2 = add i64 %1, %A12
%3 = sub i64 ptrtoint (ptr @L to i64), %2
%diff.check = icmp ult i64 %3, 32
br i1 %diff.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %wide.trip.count.i, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%4 = getelementptr i32, ptr %invariant.gep.i, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr i32, ptr %4, i64 4
%wide.load13 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds [50000000 x i32], ptr @L, i64 0, i64 %index
store <4 x i32> %wide.load, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> %wide.load13, ptr %7, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %for.cond4.preheader.i, label %for.body.i.preheader
for.body.i.preheader: ; preds = %vector.memcheck, %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%9 = xor i64 %indvars.iv.i.ph, -1
%10 = add nsw i64 %9, %wide.trip.count.i
%xtraiter = and i64 %wide.trip.count.i, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i.prol.loopexit, label %for.body.i.prol
for.body.i.prol: ; preds = %for.body.i.preheader, %for.body.i.prol
%indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body.i.prol ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.i.prol ], [ 0, %for.body.i.preheader ]
%gep.i.prol = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i.prol
%11 = load i32, ptr %gep.i.prol, align 4, !tbaa !5
%arrayidx3.i.prol = getelementptr inbounds [50000000 x i32], ptr @L, i64 0, i64 %indvars.iv.i.prol
store i32 %11, ptr %arrayidx3.i.prol, align 4, !tbaa !5
%indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i.prol.loopexit, label %for.body.i.prol, !llvm.loop !21
for.body.i.prol.loopexit: ; preds = %for.body.i.prol, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body.i.preheader ], [ %indvars.iv.next.i.prol, %for.body.i.prol ]
%12 = icmp ult i64 %10, 3
br i1 %12, label %for.cond4.preheader.i, label %for.body.i
for.cond4.preheader.i: ; preds = %for.body.i.prol.loopexit, %for.body.i, %middle.block, %if.then
%cmp569.i = icmp sgt i32 %sub1.i, 0
br i1 %cmp569.i, label %for.body6.preheader.i, label %for.end14.i
for.body6.preheader.i: ; preds = %for.cond4.preheader.i
%13 = sext i32 %div to i64
%wide.trip.count81.i = zext i32 %sub1.i to i64
%invariant.gep88.i = getelementptr i32, ptr %A, i64 %13
%min.iters.check18 = icmp ult i32 %sub1.i, 12
br i1 %min.iters.check18, label %for.body6.i.preheader, label %vector.memcheck14
vector.memcheck14: ; preds = %for.body6.preheader.i
%14 = shl nsw i64 %13, 2
%15 = add i64 %14, %A12
%16 = sub i64 ptrtoint (ptr @R to i64), %15
%diff.check15 = icmp ult i64 %16, 32
br i1 %diff.check15, label %for.body6.i.preheader, label %vector.ph19
vector.ph19: ; preds = %vector.memcheck14
%n.vec21 = and i64 %wide.trip.count81.i, 4294967288
br label %vector.body24
vector.body24: ; preds = %vector.body24, %vector.ph19
%index25 = phi i64 [ 0, %vector.ph19 ], [ %index.next28, %vector.body24 ]
%17 = getelementptr i32, ptr %invariant.gep88.i, i64 %index25
%wide.load26 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr i32, ptr %17, i64 4
%wide.load27 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = getelementptr inbounds [50000000 x i32], ptr @R, i64 0, i64 %index25
store <4 x i32> %wide.load26, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load27, ptr %20, align 16, !tbaa !5
%index.next28 = add nuw i64 %index25, 8
%21 = icmp eq i64 %index.next28, %n.vec21
br i1 %21, label %middle.block16, label %vector.body24, !llvm.loop !22
middle.block16: ; preds = %vector.body24
%cmp.n23 = icmp eq i64 %n.vec21, %wide.trip.count81.i
br i1 %cmp.n23, label %for.end14.i, label %for.body6.i.preheader
for.body6.i.preheader: ; preds = %vector.memcheck14, %for.body6.preheader.i, %middle.block16
%indvars.iv77.i.ph = phi i64 [ 0, %vector.memcheck14 ], [ 0, %for.body6.preheader.i ], [ %n.vec21, %middle.block16 ]
%22 = xor i64 %indvars.iv77.i.ph, -1
%23 = add nsw i64 %22, %wide.trip.count81.i
%xtraiter29 = and i64 %wide.trip.count81.i, 3
%lcmp.mod30.not = icmp eq i64 %xtraiter29, 0
br i1 %lcmp.mod30.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol
for.body6.i.prol: ; preds = %for.body6.i.preheader, %for.body6.i.prol
%indvars.iv77.i.prol = phi i64 [ %indvars.iv.next78.i.prol, %for.body6.i.prol ], [ %indvars.iv77.i.ph, %for.body6.i.preheader ]
%prol.iter31 = phi i64 [ %prol.iter31.next, %for.body6.i.prol ], [ 0, %for.body6.i.preheader ]
%gep89.i.prol = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv77.i.prol
%24 = load i32, ptr %gep89.i.prol, align 4, !tbaa !5
%arrayidx11.i.prol = getelementptr inbounds [50000000 x i32], ptr @R, i64 0, i64 %indvars.iv77.i.prol
store i32 %24, ptr %arrayidx11.i.prol, align 4, !tbaa !5
%indvars.iv.next78.i.prol = add nuw nsw i64 %indvars.iv77.i.prol, 1
%prol.iter31.next = add i64 %prol.iter31, 1
%prol.iter31.cmp.not = icmp eq i64 %prol.iter31.next, %xtraiter29
br i1 %prol.iter31.cmp.not, label %for.body6.i.prol.loopexit, label %for.body6.i.prol, !llvm.loop !23
for.body6.i.prol.loopexit: ; preds = %for.body6.i.prol, %for.body6.i.preheader
%indvars.iv77.i.unr = phi i64 [ %indvars.iv77.i.ph, %for.body6.i.preheader ], [ %indvars.iv.next78.i.prol, %for.body6.i.prol ]
%25 = icmp ult i64 %23, 3
br i1 %25, label %for.end14.i, label %for.body6.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body.i ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%gep.i = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.i
%26 = load i32, ptr %gep.i, align 4, !tbaa !5
%arrayidx3.i = getelementptr inbounds [50000000 x i32], ptr @L, i64 0, i64 %indvars.iv.i
store i32 %26, ptr %arrayidx3.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%gep.i.1 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i
%27 = load i32, ptr %gep.i.1, align 4, !tbaa !5
%arrayidx3.i.1 = getelementptr inbounds [50000000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i
store i32 %27, ptr %arrayidx3.i.1, align 4, !tbaa !5
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%gep.i.2 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1
%28 = load i32, ptr %gep.i.2, align 4, !tbaa !5
%arrayidx3.i.2 = getelementptr inbounds [50000000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.1
store i32 %28, ptr %arrayidx3.i.2, align 4, !tbaa !5
%indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3
%gep.i.3 = getelementptr i32, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2
%29 = load i32, ptr %gep.i.3, align 4, !tbaa !5
%arrayidx3.i.3 = getelementptr inbounds [50000000 x i32], ptr @L, i64 0, i64 %indvars.iv.next.i.2
store i32 %29, ptr %arrayidx3.i.3, align 4, !tbaa !5
%indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4
%exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i
br i1 %exitcond.not.i.3, label %for.cond4.preheader.i, label %for.body.i, !llvm.loop !24
for.body6.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i
%indvars.iv77.i = phi i64 [ %indvars.iv.next78.i.3, %for.body6.i ], [ %indvars.iv77.i.unr, %for.body6.i.prol.loopexit ]
%gep89.i = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv77.i
%30 = load i32, ptr %gep89.i, align 4, !tbaa !5
%arrayidx11.i = getelementptr inbounds [50000000 x i32], ptr @R, i64 0, i64 %indvars.iv77.i
store i32 %30, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next78.i = add nuw nsw i64 %indvars.iv77.i, 1
%gep89.i.1 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i
%31 = load i32, ptr %gep89.i.1, align 4, !tbaa !5
%arrayidx11.i.1 = getelementptr inbounds [50000000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i
store i32 %31, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next78.i.1 = add nuw nsw i64 %indvars.iv77.i, 2
%gep89.i.2 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i.1
%32 = load i32, ptr %gep89.i.2, align 4, !tbaa !5
%arrayidx11.i.2 = getelementptr inbounds [50000000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i.1
store i32 %32, ptr %arrayidx11.i.2, align 4, !tbaa !5
%indvars.iv.next78.i.2 = add nuw nsw i64 %indvars.iv77.i, 3
%gep89.i.3 = getelementptr i32, ptr %invariant.gep88.i, i64 %indvars.iv.next78.i.2
%33 = load i32, ptr %gep89.i.3, align 4, !tbaa !5
%arrayidx11.i.3 = getelementptr inbounds [50000000 x i32], ptr @R, i64 0, i64 %indvars.iv.next78.i.2
store i32 %33, ptr %arrayidx11.i.3, align 4, !tbaa !5
%indvars.iv.next78.i.3 = add nuw nsw i64 %indvars.iv77.i, 4
%exitcond82.not.i.3 = icmp eq i64 %indvars.iv.next78.i.3, %wide.trip.count81.i
br i1 %exitcond82.not.i.3, label %for.end14.i, label %for.body6.i, !llvm.loop !25
for.end14.i: ; preds = %for.body6.i.prol.loopexit, %for.body6.i, %middle.block16, %for.cond4.preheader.i
%idxprom15.i = sext i32 %sub.i to i64
%arrayidx16.i = getelementptr inbounds [50000000 x i32], ptr @L, i64 0, i64 %idxprom15.i
store i32 1000000000, ptr %arrayidx16.i, align 4, !tbaa !5
%idxprom17.i = sext i32 %sub1.i to i64
%arrayidx18.i = getelementptr inbounds [50000000 x i32], ptr @R, i64 0, i64 %idxprom17.i
store i32 1000000000, ptr %arrayidx18.i, align 4, !tbaa !5
%34 = sext i32 %left to i64
%wide.trip.count86.i = sext i32 %right to i64
br label %for.body21.i
for.body21.i: ; preds = %for.body21.i, %for.end14.i
%indvars.iv83.i = phi i64 [ %34, %for.end14.i ], [ %indvars.iv.next84.i, %for.body21.i ]
%j.074.i = phi i32 [ 0, %for.end14.i ], [ %j.1.i, %for.body21.i ]
%i.273.i = phi i32 [ 0, %for.end14.i ], [ %i.3.i, %for.body21.i ]
%35 = load i32, ptr @count, align 4, !tbaa !5
%inc22.i = add nsw i32 %35, 1
store i32 %inc22.i, ptr @count, align 4, !tbaa !5
%idxprom23.i = zext i32 %i.273.i to i64
%arrayidx24.i = getelementptr inbounds [50000000 x i32], ptr @L, i64 0, i64 %idxprom23.i
%36 = load i32, ptr %arrayidx24.i, align 4, !tbaa !5
%idxprom25.i = zext i32 %j.074.i to i64
%arrayidx26.i = getelementptr inbounds [50000000 x i32], ptr @R, i64 0, i64 %idxprom25.i
%37 = load i32, ptr %arrayidx26.i, align 4, !tbaa !5
%cmp27.not.i = icmp sle i32 %36, %37
%.sink.i = tail call i32 @llvm.smin.i32(i32 %36, i32 %37)
%inc32.i = zext i1 %cmp27.not.i to i32
%i.3.i = add nuw nsw i32 %i.273.i, %inc32.i
%not.cmp27.not.i = xor i1 %cmp27.not.i, true
%inc37.i = zext i1 %not.cmp27.not.i to i32
%j.1.i = add nuw nsw i32 %j.074.i, %inc37.i
%38 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv83.i
store i32 %.sink.i, ptr %38, align 4
%indvars.iv.next84.i = add nsw i64 %indvars.iv83.i, 1
%exitcond87.not.i = icmp eq i64 %indvars.iv.next84.i, %wide.trip.count86.i
br i1 %exitcond87.not.i, label %if.end, label %for.body21.i, !llvm.loop !19
if.end: ; preds = %for.body21.i, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%S = alloca [500000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %S) #6
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !26
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @mergeSort(ptr noundef nonnull %S, i32 noundef 0, i32 noundef %.lcssa)
%3 = load i32, ptr @n, align 4, !tbaa !5
%cmp324 = icmp sgt i32 %3, 1
br i1 %cmp324, label %for.body4, label %for.end11
for.body4: ; preds = %for.end, %for.body4
%indvars.iv29 = phi i64 [ %indvars.iv.next30, %for.body4 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %indvars.iv29
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %4)
%putchar = call i32 @putchar(i32 32)
%indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
%5 = load i32, ptr @n, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%6 = sext i32 %sub to i64
%cmp3 = icmp slt i64 %indvars.iv.next30, %6
br i1 %cmp3, label %for.body4, label %for.end11.loopexit, !llvm.loop !27
for.end11.loopexit: ; preds = %for.body4
%7 = and i64 %indvars.iv.next30, 4294967295
br label %for.end11
for.end11: ; preds = %for.end11.loopexit, %for.end
%i.1.lcssa = phi i64 [ 0, %for.end ], [ %7, %for.end11.loopexit ]
%arrayidx13 = getelementptr inbounds [500000 x i32], ptr %S, i64 0, i64 %i.1.lcssa
%8 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%9 = load i32, ptr @count, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %8, i32 noundef %9)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %S) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) 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 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !10, !11}
!18 = distinct !{!18, !10, !11}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !11, !12}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !10, !11, !12}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !10, !11}
!25 = distinct !{!25, !10, !11}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}
|
#include <stdio.h>
#define MAX 500001
void merge(int A[],int left,int mid,int right, int* count){
int i,j,n1,n2;
int L[MAX];
int R[MAX];
int k;
n1 = mid -left;
n2 = right - mid;
for(i=0;i<n1;i++){
L[i] = A[left+i];
}
for(i=0;i<n2;i++){
R[i]=A[mid+i];
}
L[n1] = 2e9;
R[n2] = 2e9;
i = 0;
j = 0;
for(k=left;k<right;k++){
(*count)++;
if(L[i]<=R[j]){
A[k] = L[i];
i=i+1;
}
else{
A[k] = R[j];
j = j+1;
}
}
return;
}
void mergeSort(int A[],int left,int right,int* count){
int mid;
if(left+1<right){
mid = (left+right)/2;
mergeSort(A,left,mid,count);
mergeSort(A,mid,right,count);
merge(A,left,mid,right,count);
}
return;
}
int main(){
int n,i;
int A[MAX];
int count = 0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
mergeSort(A,0,n,&count);
for(i=0;i<n;i++){
printf("%d",A[i]);
if(i!=n-1){
printf(" ");
}
else {
printf("\n");
}
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148590/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148590/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @merge(ptr nocapture noundef %A, i32 noundef %left, i32 noundef %mid, i32 noundef %right, ptr nocapture noundef %count) local_unnamed_addr #0 {
entry:
%L = alloca [500001 x i32], align 16
%R = alloca [500001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2000004, ptr nonnull %L) #7
call void @llvm.lifetime.start.p0(i64 2000004, ptr nonnull %R) #7
%sub = sub nsw i32 %mid, %left
%sub1 = sub nsw i32 %right, %mid
%cmp67 = icmp sgt i32 %sub, 0
br i1 %cmp67, label %for.body.preheader, label %for.cond4.preheader
for.body.preheader: ; preds = %entry
%0 = sext i32 %left to i64
%1 = shl nsw i64 %0, 2
%scevgep = getelementptr i8, ptr %A, i64 %1
%2 = xor i32 %left, -1
%3 = add i32 %2, %mid
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
%6 = add nuw nsw i64 %5, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %L, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %6, i1 false), !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.body.preheader, %entry
%cmp569 = icmp sgt i32 %sub1, 0
br i1 %cmp569, label %for.body6.preheader, label %for.end14
for.body6.preheader: ; preds = %for.cond4.preheader
%7 = sext i32 %mid to i64
%8 = shl nsw i64 %7, 2
%scevgep77 = getelementptr i8, ptr %A, i64 %8
%9 = xor i32 %mid, -1
%10 = add i32 %9, %right
%11 = zext i32 %10 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = add nuw nsw i64 %12, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %R, ptr noundef nonnull align 4 dereferenceable(1) %scevgep77, i64 %13, i1 false), !tbaa !5
br label %for.end14
for.end14: ; preds = %for.body6.preheader, %for.cond4.preheader
%idxprom15 = sext i32 %sub to i64
%arrayidx16 = getelementptr inbounds [500001 x i32], ptr %L, i64 0, i64 %idxprom15
store i32 2000000000, ptr %arrayidx16, align 4, !tbaa !5
%idxprom17 = sext i32 %sub1 to i64
%arrayidx18 = getelementptr inbounds [500001 x i32], ptr %R, i64 0, i64 %idxprom17
store i32 2000000000, ptr %arrayidx18, align 4, !tbaa !5
%cmp2071 = icmp slt i32 %left, %right
br i1 %cmp2071, label %for.body21.preheader, label %for.end40
for.body21.preheader: ; preds = %for.end14
%14 = sext i32 %left to i64
%wide.trip.count = sext i32 %right to i64
br label %for.body21
for.body21: ; preds = %for.body21.preheader, %for.body21
%indvars.iv = phi i64 [ %14, %for.body21.preheader ], [ %indvars.iv.next, %for.body21 ]
%i.273 = phi i32 [ 0, %for.body21.preheader ], [ %i.3, %for.body21 ]
%j.072 = phi i32 [ 0, %for.body21.preheader ], [ %j.1, %for.body21 ]
%15 = load i32, ptr %count, align 4, !tbaa !5
%inc22 = add nsw i32 %15, 1
store i32 %inc22, ptr %count, align 4, !tbaa !5
%idxprom23 = zext i32 %i.273 to i64
%arrayidx24 = getelementptr inbounds [500001 x i32], ptr %L, i64 0, i64 %idxprom23
%16 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%idxprom25 = zext i32 %j.072 to i64
%arrayidx26 = getelementptr inbounds [500001 x i32], ptr %R, i64 0, i64 %idxprom25
%17 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%cmp27.not = icmp sgt i32 %16, %17
%.sink = tail call i32 @llvm.smin.i32(i32 %16, i32 %17)
%add37 = zext i1 %cmp27.not to i32
%j.1 = add nuw nsw i32 %j.072, %add37
%not.cmp27.not = xor i1 %cmp27.not, true
%add32 = zext i1 %not.cmp27.not to i32
%i.3 = add nuw nsw i32 %i.273, %add32
%18 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
store i32 %.sink, ptr %18, align 4
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end40, label %for.body21, !llvm.loop !9
for.end40: ; preds = %for.body21, %for.end14
call void @llvm.lifetime.end.p0(i64 2000004, ptr nonnull %R) #7
call void @llvm.lifetime.end.p0(i64 2000004, ptr nonnull %L) #7
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %right, ptr noundef %count) local_unnamed_addr #0 {
entry:
%add = add nsw i32 %left, 1
%cmp = icmp slt i32 %add, %right
br i1 %cmp, label %if.then, label %common.ret14
common.ret14: ; preds = %entry, %if.then
ret void
if.then: ; preds = %entry
%add1 = add nsw i32 %right, %left
%div = sdiv i32 %add1, 2
tail call void @mergeSort(ptr noundef %A, i32 noundef %left, i32 noundef %div, ptr noundef %count)
tail call void @mergeSort(ptr noundef %A, i32 noundef %div, i32 noundef %right, ptr noundef %count)
tail call void @merge(ptr noundef %A, i32 noundef %left, i32 noundef %div, i32 noundef %right, ptr noundef %count)
br label %common.ret14
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%A = alloca [500001 x i32], align 16
%count = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 2000004, ptr nonnull %A) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %count) #7
store i32 0, ptr %count, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %0, 0
br i1 %cmp22, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
call void @mergeSort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %0, ptr noundef nonnull %count)
br label %for.end13
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [500001 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body
call void @mergeSort(ptr noundef nonnull %A, i32 noundef 0, i32 noundef %1, ptr noundef nonnull %count)
%cmp324 = icmp sgt i32 %1, 0
br i1 %cmp324, label %for.body4, label %for.end13
for.body4: ; preds = %for.end, %for.body4
%indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.body4 ], [ 0, %for.end ]
%arrayidx6 = getelementptr inbounds [500001 x i32], ptr %A, i64 0, i64 %indvars.iv28
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %3)
%4 = load i32, ptr %n, align 4, !tbaa !5
%sub = add nsw i32 %4, -1
%5 = zext i32 %sub to i64
%cmp8.not = icmp eq i64 %indvars.iv28, %5
%. = select i1 %cmp8.not, i32 10, i32 32
%putchar21 = call i32 @putchar(i32 %.)
%indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next29, %7
br i1 %cmp3, label %for.body4, label %for.end13, !llvm.loop !12
for.end13: ; preds = %for.body4, %for.end.thread, %for.end
%8 = load i32, ptr %count, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %count) #7
call void @llvm.lifetime.end.p0(i64 2000004, ptr nonnull %A) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
; 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) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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}
|
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
int n,m,query,l[200000],r[200000],p[100000],q[100000],arr[501][501]={0},i,j,k,ans;
scanf("%d %d %d",&n,&m,&query);
for ( i = 0; i < m; i++)
{
scanf("%d %d",l+i,r+i);
arr[l[i]][r[i]]++;
}
for ( j = 0; j < query; j++)
{
scanf("%d %d",p+j,q+j);
}
for ( i = 0; i <= 500; i++)
{
for ( j = 1; j <= 500 ; j++)
{
arr[i][j]+=arr[i][j-1];
}
}
for ( k = 0; k < query; k++)
{
ans=0;
for ( i = p[k]; i <= q[k]; i++)
{
ans+=arr[i][q[k]]-arr[i][p[k]-1];
}
printf("%d\n",ans);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148640/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148640/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%n = alloca i32, align 4
%m = alloca i32, align 4
%query = alloca i32, align 4
%l = alloca [200000 x i32], align 16
%r = alloca [200000 x i32], align 16
%p = alloca [100000 x i32], align 16
%q = alloca [100000 x i32], align 16
%arr = alloca [501 x [501 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %query) #4
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %l) #4
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %r) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %p) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 1004004, ptr nonnull %arr) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1004004) %arr, i8 0, i64 1004004, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %query)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp103 = icmp sgt i32 %0, 0
br i1 %cmp103, label %for.body, label %for.cond12.preheader
for.cond12.preheader: ; preds = %for.body, %entry
%1 = load i32, ptr %query, align 4, !tbaa !5
%cmp13105 = icmp sgt i32 %1, 0
br i1 %cmp13105, label %for.body14, label %for.cond25.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %l, i64 %indvars.iv
%add.ptr3 = getelementptr inbounds i32, ptr %r, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr, ptr noundef nonnull %add.ptr3)
%2 = load i32, ptr %add.ptr, align 4, !tbaa !5
%idxprom5 = sext i32 %2 to i64
%3 = load i32, ptr %add.ptr3, align 4, !tbaa !5
%idxprom9 = sext i32 %3 to i64
%arrayidx10 = getelementptr inbounds [501 x [501 x i32]], ptr %arr, i64 0, i64 %idxprom5, i64 %idxprom9
%4 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%inc = add nsw i32 %4, 1
store i32 %inc, ptr %arrayidx10, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %m, 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.cond12.preheader, !llvm.loop !9
for.cond25.preheader.loopexit: ; preds = %for.body14
%7 = icmp sgt i32 %8, 0
br label %for.cond25.preheader
for.cond25.preheader: ; preds = %for.cond25.preheader.loopexit, %for.cond12.preheader
%cmp46112 = phi i1 [ %7, %for.cond25.preheader.loopexit ], [ false, %for.cond12.preheader ]
br label %for.cond28.preheader
for.body14: ; preds = %for.cond12.preheader, %for.body14
%indvars.iv115 = phi i64 [ %indvars.iv.next116, %for.body14 ], [ 0, %for.cond12.preheader ]
%add.ptr17 = getelementptr inbounds i32, ptr %p, i64 %indvars.iv115
%add.ptr20 = getelementptr inbounds i32, ptr %q, i64 %indvars.iv115
%call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr17, ptr noundef nonnull %add.ptr20)
%indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
%8 = load i32, ptr %query, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp13 = icmp slt i64 %indvars.iv.next116, %9
br i1 %cmp13, label %for.body14, label %for.cond25.preheader.loopexit, !llvm.loop !11
for.cond28.preheader: ; preds = %for.cond25.preheader, %for.inc42
%indvars.iv122 = phi i64 [ 0, %for.cond25.preheader ], [ %indvars.iv.next123, %for.inc42 ]
%arrayidx34.phi.trans.insert = getelementptr inbounds [501 x [501 x i32]], ptr %arr, i64 0, i64 %indvars.iv122, i64 0
%.pre = load i32, ptr %arrayidx34.phi.trans.insert, align 4, !tbaa !5
br label %for.body30
for.cond45.preheader: ; preds = %for.inc42
br i1 %cmp46112, label %for.body47, label %for.end76
for.body30: ; preds = %for.body30, %for.cond28.preheader
%10 = phi i32 [ %.pre, %for.cond28.preheader ], [ %add.3, %for.body30 ]
%indvars.iv118 = phi i64 [ 1, %for.cond28.preheader ], [ %indvars.iv.next119.3, %for.body30 ]
%arrayidx38 = getelementptr inbounds [501 x [501 x i32]], ptr %arr, i64 0, i64 %indvars.iv122, i64 %indvars.iv118
%11 = load i32, ptr %arrayidx38, align 4, !tbaa !5
%add = add nsw i32 %11, %10
store i32 %add, ptr %arrayidx38, align 4, !tbaa !5
%indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
%arrayidx38.1 = getelementptr inbounds [501 x [501 x i32]], ptr %arr, i64 0, i64 %indvars.iv122, i64 %indvars.iv.next119
%12 = load i32, ptr %arrayidx38.1, align 4, !tbaa !5
%add.1 = add nsw i32 %12, %add
store i32 %add.1, ptr %arrayidx38.1, align 4, !tbaa !5
%indvars.iv.next119.1 = add nuw nsw i64 %indvars.iv118, 2
%arrayidx38.2 = getelementptr inbounds [501 x [501 x i32]], ptr %arr, i64 0, i64 %indvars.iv122, i64 %indvars.iv.next119.1
%13 = load i32, ptr %arrayidx38.2, align 4, !tbaa !5
%add.2 = add nsw i32 %13, %add.1
store i32 %add.2, ptr %arrayidx38.2, align 4, !tbaa !5
%indvars.iv.next119.2 = add nuw nsw i64 %indvars.iv118, 3
%arrayidx38.3 = getelementptr inbounds [501 x [501 x i32]], ptr %arr, i64 0, i64 %indvars.iv122, i64 %indvars.iv.next119.2
%14 = load i32, ptr %arrayidx38.3, align 4, !tbaa !5
%add.3 = add nsw i32 %14, %add.2
store i32 %add.3, ptr %arrayidx38.3, align 4, !tbaa !5
%indvars.iv.next119.3 = add nuw nsw i64 %indvars.iv118, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next119.3, 501
br i1 %exitcond.not.3, label %for.inc42, label %for.body30, !llvm.loop !12
for.inc42: ; preds = %for.body30
%indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
%exitcond125.not = icmp eq i64 %indvars.iv.next123, 501
br i1 %exitcond125.not, label %for.cond45.preheader, label %for.cond28.preheader, !llvm.loop !13
for.body47: ; preds = %for.cond45.preheader, %for.end72
%indvars.iv130 = phi i64 [ %indvars.iv.next131, %for.end72 ], [ 0, %for.cond45.preheader ]
%arrayidx49 = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %indvars.iv130
%15 = load i32, ptr %arrayidx49, align 4, !tbaa !5
%arrayidx52 = getelementptr inbounds [100000 x i32], ptr %q, i64 0, i64 %indvars.iv130
%16 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%cmp53.not109 = icmp sgt i32 %15, %16
br i1 %cmp53.not109, label %for.end72, label %for.body54.lr.ph
for.body54.lr.ph: ; preds = %for.body47
%idxprom59 = sext i32 %16 to i64
%sub65 = add nsw i32 %15, -1
%idxprom66 = sext i32 %sub65 to i64
%17 = sext i32 %15 to i64
%18 = add i32 %16, 1
%19 = sub i32 %18, %15
%xtraiter = and i32 %19, 1
%20 = icmp eq i32 %16, %15
br i1 %20, label %for.end72.loopexit.unr-lcssa, label %for.body54.lr.ph.new
for.body54.lr.ph.new: ; preds = %for.body54.lr.ph
%unroll_iter = and i32 %19, -2
br label %for.body54
for.body54: ; preds = %for.body54, %for.body54.lr.ph.new
%indvars.iv126 = phi i64 [ %17, %for.body54.lr.ph.new ], [ %indvars.iv.next127.1, %for.body54 ]
%ans.0111 = phi i32 [ 0, %for.body54.lr.ph.new ], [ %add69.1, %for.body54 ]
%niter = phi i32 [ 0, %for.body54.lr.ph.new ], [ %niter.next.1, %for.body54 ]
%arrayidx60 = getelementptr inbounds [501 x [501 x i32]], ptr %arr, i64 0, i64 %indvars.iv126, i64 %idxprom59
%21 = load i32, ptr %arrayidx60, align 4, !tbaa !5
%arrayidx67 = getelementptr inbounds [501 x [501 x i32]], ptr %arr, i64 0, i64 %indvars.iv126, i64 %idxprom66
%22 = load i32, ptr %arrayidx67, align 4, !tbaa !5
%sub68 = add i32 %21, %ans.0111
%indvars.iv.next127 = add nsw i64 %indvars.iv126, 1
%arrayidx60.1 = getelementptr inbounds [501 x [501 x i32]], ptr %arr, i64 0, i64 %indvars.iv.next127, i64 %idxprom59
%23 = load i32, ptr %arrayidx60.1, align 4, !tbaa !5
%arrayidx67.1 = getelementptr inbounds [501 x [501 x i32]], ptr %arr, i64 0, i64 %indvars.iv.next127, i64 %idxprom66
%24 = load i32, ptr %arrayidx67.1, align 4, !tbaa !5
%25 = add i32 %sub68, %23
%26 = add i32 %22, %24
%add69.1 = sub i32 %25, %26
%indvars.iv.next127.1 = add nsw i64 %indvars.iv126, 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.end72.loopexit.unr-lcssa, label %for.body54, !llvm.loop !14
for.end72.loopexit.unr-lcssa: ; preds = %for.body54, %for.body54.lr.ph
%add69.lcssa.ph = phi i32 [ undef, %for.body54.lr.ph ], [ %add69.1, %for.body54 ]
%indvars.iv126.unr = phi i64 [ %17, %for.body54.lr.ph ], [ %indvars.iv.next127.1, %for.body54 ]
%ans.0111.unr = phi i32 [ 0, %for.body54.lr.ph ], [ %add69.1, %for.body54 ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end72, label %for.body54.epil
for.body54.epil: ; preds = %for.end72.loopexit.unr-lcssa
%arrayidx60.epil = getelementptr inbounds [501 x [501 x i32]], ptr %arr, i64 0, i64 %indvars.iv126.unr, i64 %idxprom59
%27 = load i32, ptr %arrayidx60.epil, align 4, !tbaa !5
%arrayidx67.epil = getelementptr inbounds [501 x [501 x i32]], ptr %arr, i64 0, i64 %indvars.iv126.unr, i64 %idxprom66
%28 = load i32, ptr %arrayidx67.epil, align 4, !tbaa !5
%sub68.epil = add i32 %27, %ans.0111.unr
%add69.epil = sub i32 %sub68.epil, %28
br label %for.end72
for.end72: ; preds = %for.body54.epil, %for.end72.loopexit.unr-lcssa, %for.body47
%ans.0.lcssa = phi i32 [ 0, %for.body47 ], [ %add69.lcssa.ph, %for.end72.loopexit.unr-lcssa ], [ %add69.epil, %for.body54.epil ]
%call73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
%indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
%29 = load i32, ptr %query, align 4, !tbaa !5
%30 = sext i32 %29 to i64
%cmp46 = icmp slt i64 %indvars.iv.next131, %30
br i1 %cmp46, label %for.body47, label %for.end76, !llvm.loop !15
for.end76: ; preds = %for.end72, %for.cond45.preheader
call void @llvm.lifetime.end.p0(i64 1004004, ptr nonnull %arr) #4
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %r) #4
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %l) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %query) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int dp[501][501];
int grid[501][501];
int dpdo(int left, int right){
if(dp[left][right]!=-1) return dp[left][right];
if(left==right){
dp[left][right] = grid[left][right];
return dp[left][right];
}
if(right-left==1){
dp[left][right] = dpdo(left, right-1) + dpdo(left+1, right) + grid[left][right];
return dpdo(left, right);
}
else{
dp[left][right] = dpdo(left, right-1) + dpdo(left+1, right) + grid[left][right] - dpdo(left+1, right-1);
return dp[left][right];
}
}
int main()
{
int n, m, q;
scanf("%d%d%d", &n, &m, &q);
int i, j, k;
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
dp[i][j] = -1;
grid[i][j] = 0;
}
}
int l, r;
for(i=1;i<=m;i++){
scanf("%d%d", &l, &r);
grid[l][r]++;
}
dpdo(1,n);
int left, right;
for(i=1;i<=q;i++){
scanf("%d%d", &left, &right);
printf("%d\n", dp[left][right]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148684/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148684/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@dp = dso_local local_unnamed_addr global [501 x [501 x i32]] zeroinitializer, align 16
@grid = dso_local local_unnamed_addr global [501 x [501 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @dpdo(i32 noundef %left, i32 noundef %right) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %left to i64
%idxprom1 = sext i32 %right to i64
%arrayidx2 = getelementptr inbounds [501 x [501 x i32]], ptr @dp, i64 0, i64 %idxprom, i64 %idxprom1
%0 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not101 = icmp eq i32 %0, -1
br i1 %cmp.not101, label %if.end.lr.ph, label %common.ret
if.end.lr.ph: ; preds = %entry
%cmp7 = icmp eq i32 %left, %right
%sub24 = add nsw i32 %right, -1
%add = add nsw i32 %left, 1
%arrayidx30 = getelementptr inbounds [501 x [501 x i32]], ptr @grid, i64 0, i64 %idxprom, i64 %idxprom1
br i1 %cmp7, label %if.then8, label %if.end.lr.ph.split
if.end.lr.ph.split: ; preds = %if.end.lr.ph
%sub = sub nsw i32 %right, %left
%cmp22 = icmp eq i32 %sub, 1
br i1 %cmp22, label %if.end, label %if.else
if.end: ; preds = %if.end.lr.ph.split, %if.end
%call = tail call i32 @dpdo(i32 noundef %left, i32 noundef %sub24)
%call25 = tail call i32 @dpdo(i32 noundef %add, i32 noundef %right)
%add26 = add nsw i32 %call25, %call
%1 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%add31 = add nsw i32 %add26, %1
store i32 %add31, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %add31, -1
br i1 %cmp.not, label %if.end, label %common.ret
if.then8: ; preds = %if.end.lr.ph
%2 = load i32, ptr %arrayidx30, align 4, !tbaa !5
br label %common.ret.sink.split
common.ret.sink.split: ; preds = %if.else, %if.then8
%.sink = phi i32 [ %2, %if.then8 ], [ %sub50, %if.else ]
store i32 %.sink, ptr %arrayidx2, align 4, !tbaa !5
br label %common.ret
common.ret: ; preds = %if.end, %common.ret.sink.split, %entry
%common.ret.op = phi i32 [ %0, %entry ], [ %.sink, %common.ret.sink.split ], [ %add31, %if.end ]
ret i32 %common.ret.op
if.else: ; preds = %if.end.lr.ph.split
%call38 = tail call i32 @dpdo(i32 noundef %left, i32 noundef %sub24)
%call40 = tail call i32 @dpdo(i32 noundef %add, i32 noundef %right)
%add41 = add nsw i32 %call40, %call38
%3 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%add46 = add nsw i32 %add41, %3
%call49 = tail call i32 @dpdo(i32 noundef %add, i32 noundef %sub24)
%sub50 = sub i32 %add46, %call49
br label %common.ret.sink.split
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%q = alloca i32, align 4
%l = alloca i32, align 4
%r = alloca i32, align 4
%left = alloca i32, align 4
%right = 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 %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %q)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not50 = icmp slt i32 %0, 1
br i1 %cmp.not50, label %for.end12, label %for.cond1.preheader.preheader
for.cond1.preheader.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 3
%3 = icmp ult i32 %0, 4
br i1 %3, label %for.end12.loopexit.unr-lcssa, label %for.cond1.preheader.preheader.new
for.cond1.preheader.preheader.new: ; preds = %for.cond1.preheader.preheader
%unroll_iter = and i64 %1, 4294967292
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader, %for.cond1.preheader.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.preheader.new ], [ %indvar.next.3, %for.cond1.preheader ]
%niter = phi i64 [ 0, %for.cond1.preheader.preheader.new ], [ %niter.next.3, %for.cond1.preheader ]
%4 = mul nuw nsw i64 %indvar, 2004
%5 = add nuw nsw i64 %4, 2008
%scevgep56 = getelementptr i8, ptr @grid, i64 %5
%scevgep = getelementptr i8, ptr @dp, i64 %5
call void @llvm.memset.p0.i64(ptr align 8 %scevgep, i8 -1, i64 %2, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr align 8 %scevgep56, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 2004
%7 = add nuw i64 %6, 4012
%scevgep56.1 = getelementptr i8, ptr @grid, i64 %7
%scevgep.1 = getelementptr i8, ptr @dp, i64 %7
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.1, i8 -1, i64 %2, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr align 4 %scevgep56.1, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 2004
%9 = add nuw i64 %8, 6016
%scevgep56.2 = getelementptr i8, ptr @grid, i64 %9
%scevgep.2 = getelementptr i8, ptr @dp, i64 %9
call void @llvm.memset.p0.i64(ptr align 16 %scevgep.2, i8 -1, i64 %2, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr align 16 %scevgep56.2, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 2004
%11 = add nuw i64 %10, 8020
%scevgep56.3 = getelementptr i8, ptr @grid, i64 %11
%scevgep.3 = getelementptr i8, ptr @dp, i64 %11
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.3, i8 -1, i64 %2, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr align 4 %scevgep56.3, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.3 = add nuw nsw i64 %indvar, 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.end12.loopexit.unr-lcssa, label %for.cond1.preheader, !llvm.loop !9
for.end12.loopexit.unr-lcssa: ; preds = %for.cond1.preheader, %for.cond1.preheader.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvar.next.3, %for.cond1.preheader ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end12, label %for.cond1.preheader.epil
for.cond1.preheader.epil: ; preds = %for.end12.loopexit.unr-lcssa, %for.cond1.preheader.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.epil ], [ %indvar.unr, %for.end12.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.epil ], [ 0, %for.end12.loopexit.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 2004
%13 = add nuw nsw i64 %12, 2008
%scevgep56.epil = getelementptr i8, ptr @grid, i64 %13
%scevgep.epil = getelementptr i8, ptr @dp, i64 %13
call void @llvm.memset.p0.i64(ptr align 4 %scevgep.epil, i8 -1, i64 %2, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr align 4 %scevgep56.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.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.end12, label %for.cond1.preheader.epil, !llvm.loop !11
for.end12: ; preds = %for.end12.loopexit.unr-lcssa, %for.cond1.preheader.epil, %entry
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
%14 = load i32, ptr %m, align 4, !tbaa !5
%cmp14.not52 = icmp slt i32 %14, 1
br i1 %cmp14.not52, label %for.end24, label %for.body15
for.body15: ; preds = %for.end12, %for.body15
%i.153 = phi i32 [ %inc23, %for.body15 ], [ 1, %for.end12 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %l, ptr noundef nonnull %r)
%15 = load i32, ptr %l, align 4, !tbaa !5
%idxprom17 = sext i32 %15 to i64
%16 = load i32, ptr %r, align 4, !tbaa !5
%idxprom19 = sext i32 %16 to i64
%arrayidx20 = getelementptr inbounds [501 x [501 x i32]], ptr @grid, i64 0, i64 %idxprom17, i64 %idxprom19
%17 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%inc21 = add nsw i32 %17, 1
store i32 %inc21, ptr %arrayidx20, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %i.153, 1
%18 = load i32, ptr %m, align 4, !tbaa !5
%cmp14.not.not = icmp slt i32 %i.153, %18
br i1 %cmp14.not.not, label %for.body15, label %for.end24.loopexit, !llvm.loop !13
for.end24.loopexit: ; preds = %for.body15
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.end24
for.end24: ; preds = %for.end24.loopexit, %for.end12
%19 = phi i32 [ %.pre, %for.end24.loopexit ], [ %0, %for.end12 ]
%call25 = call i32 @dpdo(i32 noundef 1, i32 noundef %19)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right) #5
%20 = load i32, ptr %q, align 4, !tbaa !5
%cmp27.not54 = icmp slt i32 %20, 1
br i1 %cmp27.not54, label %for.end37, label %for.body28
for.body28: ; preds = %for.end24, %for.body28
%i.255 = phi i32 [ %inc36, %for.body28 ], [ 1, %for.end24 ]
%call29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %left, ptr noundef nonnull %right)
%21 = load i32, ptr %left, align 4, !tbaa !5
%idxprom30 = sext i32 %21 to i64
%22 = load i32, ptr %right, align 4, !tbaa !5
%idxprom32 = sext i32 %22 to i64
%arrayidx33 = getelementptr inbounds [501 x [501 x i32]], ptr @dp, i64 0, i64 %idxprom30, i64 %idxprom32
%23 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %23)
%inc36 = add nuw nsw i32 %i.255, 1
%24 = load i32, ptr %q, align 4, !tbaa !5
%cmp27.not.not = icmp slt i32 %i.255, %24
br i1 %cmp27.not.not, label %for.body28, label %for.end37, !llvm.loop !14
for.end37: ; preds = %for.body28, %for.end24
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}
int main(void)
{
int a,b,ans;
scanf("%d %d",&a,&b);
for(int i=0;i<1009;i++)
{
if(floor(i*0.08)==a&&floor(i*0.1)==b)
{
ans=i;
break;
}
else
ans=-1;
}
printf("%d",ans);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148727/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148727/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %cond
}
; 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:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #6
%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
%conv1 = sitofp i32 %0 to double
%1 = load i32, ptr %b, align 4
%conv6 = sitofp i32 %1 to double
br label %for.body
for.body: ; preds = %if.else.1, %entry
%i.014 = phi i32 [ 0, %entry ], [ %inc.1, %if.else.1 ]
%conv = sitofp i32 %i.014 to double
%mul = fmul double %conv, 8.000000e-02
%2 = call double @llvm.floor.f64(double %mul)
%cmp2 = fcmp oeq double %2, %conv1
br i1 %cmp2, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %for.body
%mul5 = fmul double %conv, 1.000000e-01
%3 = call double @llvm.floor.f64(double %mul5)
%cmp7 = fcmp oeq double %3, %conv6
br i1 %cmp7, label %cleanup, label %if.else
if.else: ; preds = %land.lhs.true, %for.body
%inc = or i32 %i.014, 1
%exitcond.not = icmp eq i32 %inc, 1009
br i1 %exitcond.not, label %cleanup, label %for.body.1, !llvm.loop !9
for.body.1: ; preds = %if.else
%conv.1 = sitofp i32 %inc to double
%mul.1 = fmul double %conv.1, 8.000000e-02
%4 = call double @llvm.floor.f64(double %mul.1)
%cmp2.1 = fcmp oeq double %4, %conv1
br i1 %cmp2.1, label %land.lhs.true.1, label %if.else.1
land.lhs.true.1: ; preds = %for.body.1
%mul5.1 = fmul double %conv.1, 1.000000e-01
%5 = call double @llvm.floor.f64(double %mul5.1)
%cmp7.1 = fcmp oeq double %5, %conv6
br i1 %cmp7.1, label %cleanup, label %if.else.1
if.else.1: ; preds = %land.lhs.true.1, %for.body.1
%inc.1 = add nuw nsw i32 %i.014, 2
br label %for.body
cleanup: ; preds = %land.lhs.true.1, %land.lhs.true, %if.else
%ans.1 = phi i32 [ -1, %if.else ], [ %i.014, %land.lhs.true ], [ %inc, %land.lhs.true.1 ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int a,b,i;
scanf("%d%d",&a,&b);
/*if(a%2==0){
x = 12.5*a;
}else{
x = (12.5*a)+1;
}
for(;(int)(x*0.08)<=a;x++){
//printf("%d",(int)(x*0.1));
if((int)(x*0.1)==b){
printf("%d",x);
return 0;
}
}
printf("-1");*/
for(i=1;i<1010;i++){
if((int)(i*0.08) == a && (int)(i*0.1) ==b){
printf("%d",i);
return 0;
}
}
printf("-1");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148770/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148770/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [3 x i8] c"-1\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
br label %for.body
for.body: ; preds = %for.inc.1, %entry
%i.018 = phi i32 [ 1, %entry ], [ %inc.1, %for.inc.1 ]
%conv = sitofp i32 %i.018 to double
%mul = fmul double %conv, 8.000000e-02
%conv1 = fptosi double %mul to i32
%cmp2 = icmp eq i32 %0, %conv1
br i1 %cmp2, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%mul5 = fmul double %conv, 1.000000e-01
%conv6 = fptosi double %mul5 to i32
%cmp7 = icmp eq i32 %1, %conv6
br i1 %cmp7, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true.1, %land.lhs.true
%i.018.lcssa = phi i32 [ %i.018, %land.lhs.true ], [ %inc, %land.lhs.true.1 ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.018.lcssa)
br label %cleanup
for.inc: ; preds = %for.body, %land.lhs.true
%inc = add nuw nsw i32 %i.018, 1
%exitcond.not = icmp eq i32 %inc, 1010
br i1 %exitcond.not, label %for.end, label %for.body.1, !llvm.loop !9
for.body.1: ; preds = %for.inc
%conv.1 = sitofp i32 %inc to double
%mul.1 = fmul double %conv.1, 8.000000e-02
%conv1.1 = fptosi double %mul.1 to i32
%cmp2.1 = icmp eq i32 %0, %conv1.1
br i1 %cmp2.1, label %land.lhs.true.1, label %for.inc.1
land.lhs.true.1: ; preds = %for.body.1
%mul5.1 = fmul double %conv.1, 1.000000e-01
%conv6.1 = fptosi double %mul5.1 to i32
%cmp7.1 = icmp eq i32 %1, %conv6.1
br i1 %cmp7.1, label %if.then, label %for.inc.1
for.inc.1: ; preds = %land.lhs.true.1, %for.body.1
%inc.1 = add nuw nsw i32 %i.018, 2
br label %for.body
for.end: ; preds = %for.inc
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %cleanup
cleanup: ; preds = %for.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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
int A,B;
int a,b,i;
scanf("%d %d", &A,&B);
for(i=1;i<1010;i++){
a=i*0.08;
b=i*0.1;
if(A==a && B==b){
printf("%d",i);
return 0;
}
}
printf("%d",-1);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148828/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148828/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%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
br label %for.body
for.body: ; preds = %for.inc.1, %entry
%i.020 = phi i32 [ 1, %entry ], [ %inc.1, %for.inc.1 ]
%conv = sitofp i32 %i.020 to double
%mul = fmul double %conv, 8.000000e-02
%conv1 = fptosi double %mul to i32
%cmp5 = icmp eq i32 %0, %conv1
br i1 %cmp5, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%mul3 = fmul double %conv, 1.000000e-01
%conv4 = fptosi double %mul3 to i32
%cmp7 = icmp eq i32 %1, %conv4
br i1 %cmp7, label %cleanup, label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true
%inc = add nuw nsw i32 %i.020, 1
%exitcond.not = icmp eq i32 %inc, 1010
br i1 %exitcond.not, label %cleanup, label %for.body.1, !llvm.loop !9
for.body.1: ; preds = %for.inc
%conv.1 = sitofp i32 %inc to double
%mul.1 = fmul double %conv.1, 8.000000e-02
%conv1.1 = fptosi double %mul.1 to i32
%cmp5.1 = icmp eq i32 %0, %conv1.1
br i1 %cmp5.1, label %land.lhs.true.1, label %for.inc.1
land.lhs.true.1: ; preds = %for.body.1
%mul3.1 = fmul double %conv.1, 1.000000e-01
%conv4.1 = fptosi double %mul3.1 to i32
%cmp7.1 = icmp eq i32 %1, %conv4.1
br i1 %cmp7.1, label %cleanup, label %for.inc.1
for.inc.1: ; preds = %land.lhs.true.1, %for.body.1
%inc.1 = add nuw nsw i32 %i.020, 2
br label %for.body
cleanup: ; preds = %land.lhs.true.1, %for.inc, %land.lhs.true
%.sink = phi i32 [ %i.020, %land.lhs.true ], [ -1, %for.inc ], [ %inc, %land.lhs.true.1 ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @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 <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
//#define MOD (int)(1e5 + 7)
#define MOD (100007)
static inline void done(const char *s)
{
puts(s);
exit(0);
}
#define yes() done("Yes");
#define no() done("No");
#define invalid() done("-1");
static int comp(const void *a, const void *b)
{
int *pa = (int *)a;
int *pb = (int *)b;
return *pa < *pb;
}
static inline int *readNint(int n)
{
int *a = calloc(sizeof(int), n);
for (int i = 0; i < n; i++)
scanf("%d", &a[i]);
return a;
}
static inline long *readNlong(int n)
{
long *a = calloc(sizeof(long), n);
for (int i = 0; i < n; i++)
scanf("%ld", &a[i]);
return a;
}
int main(int argc, char **argv)
{
int A, B;
scanf("%d%d", &A, &B);
for (int x = B * 10; x < B * 20; x++) {
int a = (x * 8) / 100;
int b = x / 10;
fprintf(stderr, "%d %d %d\n", x, a, b);
if (a == A && b == B) {
printf("%d\n", x);
return 0;
}
}
printf("-1\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148871/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148871/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) 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 %B, align 4, !tbaa !5
%mul = mul nsw i32 %0, 10
%mul124 = mul nsw i32 %0, 20
%cmp.not25 = icmp slt i32 %mul, %mul124
br i1 %cmp.not25, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%x.026 = phi i32 [ %inc, %for.inc ], [ %mul, %entry ]
%mul2 = shl nsw i32 %x.026, 3
%div = sdiv i32 %mul2, 100
%div3 = sdiv i32 %x.026, 10
%1 = load ptr, ptr @stderr, align 8, !tbaa !9
%call4 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %1, ptr noundef nonnull @.str.1, i32 noundef %x.026, i32 noundef %div, i32 noundef %div3) #5
%2 = load i32, ptr %A, align 4, !tbaa !5
%cmp5 = icmp eq i32 %div, %2
%3 = load i32, ptr %B, align 4
%cmp6 = icmp eq i32 %div3, %3
%or.cond = select i1 %cmp5, i1 %cmp6, i1 false
br i1 %or.cond, label %if.then, label %for.inc
if.then: ; preds = %for.body
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %x.026)
br label %cleanup12
for.inc: ; preds = %for.body
%inc = add nsw i32 %x.026, 1
%mul1 = mul nsw i32 %3, 20
%cmp.not = icmp slt i32 %inc, %mul1
br i1 %cmp.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.inc, %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup12
cleanup12: ; preds = %if.then, %for.end
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 @fprintf(ptr nocapture noundef, 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 }
attributes #5 = { 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, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int n,a,b;
scanf("%d %d",&a,&b);
for (n=1;n<10*(a+b);n++)
if (n*8/100==a && n/10==b) {
printf("%d\n",n);
return 0;
}
puts("-1");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148914/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148914/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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
%cmp14 = icmp sgt i32 %add, 0
br i1 %cmp14, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%mul = mul i32 %add, 10
%smax = call i32 @llvm.smax.i32(i32 %mul, i32 2)
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%n.015 = phi i32 [ %inc, %for.inc ], [ 1, %for.body.preheader ]
%mul1 = shl nsw i32 %n.015, 3
%div = udiv i32 %mul1, 100
%cmp2 = icmp eq i32 %div, %0
%div3 = udiv i32 %n.015, 10
%cmp4 = icmp eq i32 %div3, %1
%or.cond = and i1 %cmp2, %cmp4
br i1 %or.cond, label %if.then, label %for.inc
if.then: ; preds = %for.body
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %n.015)
br label %cleanup
for.inc: ; preds = %for.body
%inc = add nuw nsw i32 %n.015, 1
%exitcond.not = icmp eq i32 %inc, %smax
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%call6 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %cleanup
cleanup: ; preds = %for.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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
int n;
int a[100005],b[100005];
scanf("%d", &n);
int i=0;
for(i=0;i<n;i++){
scanf("%d", &a[i]);
b[a[i]-1]=i+1;
}
for(int i=0;i<n;i++){
printf("%d ", b[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_148958/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_148958/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [100005 x i32], align 16
%b = alloca [100005 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %0, 0
br i1 %cmp22, label %for.body, label %for.cond.cleanup
for.cond7.preheader: ; preds = %for.body
%1 = icmp sgt i32 %4, 0
br i1 %1, label %for.body9, label %for.cond.cleanup
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100005 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 %arrayidx, align 4, !tbaa !5
%sub = add nsw i32 %2, -1
%idxprom4 = sext i32 %sub to i64
%arrayidx5 = getelementptr inbounds [100005 x i32], ptr %b, i64 0, i64 %idxprom4
%3 = trunc i64 %indvars.iv.next to i32
store i32 %3, ptr %arrayidx5, align 4, !tbaa !5
%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.cond7.preheader, !llvm.loop !9
for.cond.cleanup: ; preds = %for.body9, %entry, %for.cond7.preheader
call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
for.body9: ; preds = %for.cond7.preheader, %for.body9
%indvars.iv27 = phi i64 [ %indvars.iv.next28, %for.body9 ], [ 0, %for.cond7.preheader ]
%arrayidx11 = getelementptr inbounds [100005 x i32], ptr %b, i64 0, i64 %indvars.iv27
%6 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6)
%indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp8 = icmp slt i64 %indvars.iv.next28, %8
br i1 %cmp8, label %for.body9, label %for.cond.cleanup, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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()
{
long long int n,i,f,g,h;
scanf("%lli",&n);
long long int arr[n];
for(i=0;i<n;i++)
{
scanf("%lli",&arr[i]);
}
for(i=0;i<n;i++)
{
f=0;
h=1;
g=arr[i];
while(g>=1)
{
if(g%10!=0)
{
f++;
}
g=g/10;
}
printf("%lli\n",f);
g=arr[i];
while(g>=1)
{
if(g%10!=0)
{
printf("%lli ",g%10*h);
}
g=g/10;
h=h*10;
}
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14900/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14900/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lli\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lli\0A\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lli \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) #5
%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
%cmp41 = icmp sgt i64 %2, 0
br i1 %cmp41, label %for.body, label %for.end26
for.cond2.preheader: ; preds = %for.body
%3 = icmp sgt i64 %4, 0
br i1 %3, label %for.body4, label %for.end26
for.body: ; preds = %entry, %for.body
%i.042 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %i.042
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.042, 1
%4 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %4
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %while.end22
%i.150 = phi i64 [ %inc25, %while.end22 ], [ 0, %for.cond2.preheader ]
%arrayidx5 = getelementptr inbounds i64, ptr %vla, i64 %i.150
%5 = load i64, ptr %arrayidx5, align 8, !tbaa !5
%cmp643 = icmp sgt i64 %5, 0
br i1 %cmp643, label %while.body, label %while.end
while.body: ; preds = %for.body4, %while.body
%g.045 = phi i64 [ %div, %while.body ], [ %5, %for.body4 ]
%f.044 = phi i64 [ %spec.select, %while.body ], [ 0, %for.body4 ]
%rem = urem i64 %g.045, 10
%cmp7.not = icmp ne i64 %rem, 0
%inc8 = zext i1 %cmp7.not to i64
%spec.select = add nuw nsw i64 %f.044, %inc8
%div = udiv i64 %g.045, 10
%cmp6.not = icmp ult i64 %g.045, 10
br i1 %cmp6.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %while.body, %for.body4
%f.0.lcssa = phi i64 [ 0, %for.body4 ], [ %spec.select, %while.body ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %f.0.lcssa)
%6 = load i64, ptr %arrayidx5, align 8, !tbaa !5
%cmp1246 = icmp sgt i64 %6, 0
br i1 %cmp1246, label %while.body13, label %while.end22
while.body13: ; preds = %while.end, %if.end19
%h.048 = phi i64 [ %mul21, %if.end19 ], [ 1, %while.end ]
%g.147 = phi i64 [ %div20, %if.end19 ], [ %6, %while.end ]
%rem14 = urem i64 %g.147, 10
%div20 = udiv i64 %g.147, 10
%cmp15.not = icmp eq i64 %rem14, 0
br i1 %cmp15.not, label %if.end19, label %if.then16
if.then16: ; preds = %while.body13
%mul = mul nsw i64 %rem14, %h.048
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %mul)
br label %if.end19
if.end19: ; preds = %if.then16, %while.body13
%mul21 = mul nsw i64 %h.048, 10
%cmp12.not = icmp ult i64 %g.147, 10
br i1 %cmp12.not, label %while.end22, label %while.body13, !llvm.loop !12
while.end22: ; preds = %if.end19, %while.end
%putchar = call i32 @putchar(i32 10)
%inc25 = add nuw nsw i64 %i.150, 1
%7 = load i64, ptr %n, align 8, !tbaa !5
%cmp3 = icmp slt i64 %inc25, %7
br i1 %cmp3, label %for.body4, label %for.end26, !llvm.loop !13
for.end26: ; preds = %while.end22, %entry, %for.cond2.preheader
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
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 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main()
{
int a[100000]={0},i;
int n,t;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&t);
a[t]=i;
}
for(i=1;i<=n;i++)
printf("%d ",a[i]);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149043/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149043/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%a = alloca [100000 x i32], align 16
%n = alloca i32, align 4
%t = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %a) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400000) %a, i8 0, i64 400000, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, 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
%cmp.not16 = icmp slt i32 %0, 1
br i1 %cmp.not16, label %for.end10, label %for.body
for.cond2.preheader: ; preds = %for.body
%1 = icmp slt i32 %3, 1
br i1 %1, label %for.end10, label %for.body4
for.body: ; preds = %entry, %for.body
%i.017 = phi i32 [ %inc, %for.body ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%2 = load i32, ptr %t, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %idxprom
store i32 %i.017, ptr %arrayidx, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.017, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.017, %3
br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 1, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
%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
%cmp3.not.not = icmp slt i64 %indvars.iv, %6
br i1 %cmp3.not.not, label %for.body4, label %for.end10, !llvm.loop !11
for.end10: ; preds = %for.body4, %entry, %for.cond2.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 400000, 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(void) {
int N;
scanf("%d", &N);
int A[N];
int ans[N];
for(int i = 1; i <= N; ++i) {
scanf("%d", &A[i]);
}
for(int i = 1; i <= N; ++i) {
ans[A[i]] = i;
}
for(int i = 1; i <= N; ++i) {
printf("%d ", ans[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149087/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149087/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%cmp.not33 = icmp slt i32 %3, 1
br i1 %cmp.not33, label %for.cond.cleanup18, label %for.body
for.cond4.preheader: ; preds = %for.body
%cmp5.not35 = icmp slt i32 %9, 1
br i1 %cmp5.not35, label %for.cond.cleanup18, label %for.body7.preheader
for.body7.preheader: ; preds = %for.cond4.preheader
%5 = add nuw i32 %9, 1
%wide.trip.count = zext i32 %5 to i64
%6 = add nsw i64 %wide.trip.count, -1
%7 = add nsw i64 %wide.trip.count, -2
%xtraiter = and i64 %6, 3
%8 = icmp ult i64 %7, 3
br i1 %8, label %for.cond16.preheader.unr-lcssa, label %for.body7.preheader.new
for.body7.preheader.new: ; preds = %for.body7.preheader
%unroll_iter = and i64 %6, -4
br label %for.body7
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = load i32, ptr %N, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %10
br i1 %cmp.not.not, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond16.preheader.unr-lcssa: ; preds = %for.body7, %for.body7.preheader
%indvars.iv41.unr = phi i64 [ 1, %for.body7.preheader ], [ %indvars.iv.next42.3, %for.body7 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond16.preheader, label %for.body7.epil
for.body7.epil: ; preds = %for.cond16.preheader.unr-lcssa, %for.body7.epil
%indvars.iv41.epil = phi i64 [ %indvars.iv.next42.epil, %for.body7.epil ], [ %indvars.iv41.unr, %for.cond16.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body7.epil ], [ 0, %for.cond16.preheader.unr-lcssa ]
%arrayidx9.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv41.epil
%11 = load i32, ptr %arrayidx9.epil, align 4, !tbaa !5
%idxprom10.epil = sext i32 %11 to i64
%arrayidx11.epil = getelementptr inbounds i32, ptr %vla1, i64 %idxprom10.epil
%12 = trunc i64 %indvars.iv41.epil to i32
store i32 %12, ptr %arrayidx11.epil, align 4, !tbaa !5
%indvars.iv.next42.epil = add nuw nsw i64 %indvars.iv41.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.cond16.preheader, label %for.body7.epil, !llvm.loop !11
for.cond16.preheader: ; preds = %for.body7.epil, %for.cond16.preheader.unr-lcssa
br i1 %cmp5.not35, label %for.cond.cleanup18, label %for.body19
for.body7: ; preds = %for.body7, %for.body7.preheader.new
%indvars.iv41 = phi i64 [ 1, %for.body7.preheader.new ], [ %indvars.iv.next42.3, %for.body7 ]
%niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.3, %for.body7 ]
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv41
%13 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%idxprom10 = sext i32 %13 to i64
%arrayidx11 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom10
%14 = trunc i64 %indvars.iv41 to i32
store i32 %14, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%arrayidx9.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next42
%15 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5
%idxprom10.1 = sext i32 %15 to i64
%arrayidx11.1 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom10.1
%16 = trunc i64 %indvars.iv.next42 to i32
store i32 %16, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next42.1 = add nuw nsw i64 %indvars.iv41, 2
%arrayidx9.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next42.1
%17 = load i32, ptr %arrayidx9.2, align 4, !tbaa !5
%idxprom10.2 = sext i32 %17 to i64
%arrayidx11.2 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom10.2
%18 = trunc i64 %indvars.iv.next42.1 to i32
store i32 %18, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next42.2 = add nuw nsw i64 %indvars.iv41, 3
%arrayidx9.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next42.2
%19 = load i32, ptr %arrayidx9.3, align 4, !tbaa !5
%idxprom10.3 = sext i32 %19 to i64
%arrayidx11.3 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom10.3
%20 = trunc i64 %indvars.iv.next42.2 to i32
store i32 %20, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next42.3 = add nuw nsw i64 %indvars.iv41, 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.cond16.preheader.unr-lcssa, label %for.body7, !llvm.loop !13
for.cond.cleanup18: ; preds = %for.body19, %entry, %for.cond4.preheader, %for.cond16.preheader
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
for.body19: ; preds = %for.cond16.preheader, %for.body19
%indvars.iv44 = phi i64 [ %indvars.iv.next45, %for.body19 ], [ 1, %for.cond16.preheader ]
%arrayidx21 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv44
%21 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %21)
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%22 = load i32, ptr %N, align 4, !tbaa !5
%23 = sext i32 %22 to i64
%cmp17.not.not = icmp slt i64 %indvars.iv44, %23
br i1 %cmp17.not.not, label %for.body19, label %for.cond.cleanup18, !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
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#include<math.h>
int main()
{
int t,i,n;
scanf("%d",&t);
for(i=1;i<=t;i++){
int j,k=1,ara[]={0,0,0,0,0},ara2[]={1,10,100,1000,10000};
scanf("%d",&n);
int m,d,a=n;
for(j=4;j>=0;j--){
if(a/ara2[j]!=0){
if((double)a/ara2[j]==1.00){
ara[k-1]=a;
k++;
break;}
d=a/ara2[j];
a=a%ara2[j];
ara[k-1]=d*ara2[j];
k++;
}
}
printf("%d\n",k-1);
for(m=0;ara[m]!=0;m++){
printf("%d ",ara[m]);
}
printf("\n");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14913/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14913/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = 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:
%t = alloca i32, align 4
%n = alloca i32, align 4
%ara = alloca [5 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp.not69 = icmp slt i32 %0, 1
br i1 %cmp.not69, label %for.end44, label %for.body
for.body: ; preds = %entry, %for.end40
%i.070 = phi i32 [ %inc43, %for.end40 ], [ 1, %entry ]
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %ara) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(20) %ara, i8 0, i64 20, i1 false)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%.fr = freeze i32 %1
%.off = add i32 %.fr, 9999
%cmp5.not = icmp ult i32 %.off, 19999
br i1 %cmp5.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%conv = sitofp i32 %.fr to double
%div9 = fdiv double %conv, 1.000000e+04
%cmp10 = fcmp oeq double %div9, 1.000000e+00
br i1 %cmp10, label %for.end.sink.split, label %if.end
if.end: ; preds = %if.then
%rem = srem i32 %.fr, 10000
%2 = srem i32 %.fr, 10000
%mul = sub nsw i32 %.fr, %2
store i32 %mul, ptr %ara, align 16, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.end
%k.1 = phi i32 [ 2, %if.end ], [ 1, %for.body ]
%a.1 = phi i32 [ %rem, %if.end ], [ %.fr, %for.body ]
%a.1.off = add nsw i32 %a.1, 999
%cmp5.not.1 = icmp ult i32 %a.1.off, 1999
br i1 %cmp5.not.1, label %for.inc.1, label %if.then.1
if.then.1: ; preds = %for.inc
%conv.1 = sitofp i32 %a.1 to double
%div9.1 = fdiv double %conv.1, 1.000000e+03
%cmp10.1 = fcmp oeq double %div9.1, 1.000000e+00
br i1 %cmp10.1, label %for.end.sink.split, label %if.end.1
if.end.1: ; preds = %if.then.1
%rem.1.lhs.trunc = trunc i32 %a.1 to i16
%rem.179 = srem i16 %rem.1.lhs.trunc, 1000
%rem.1.sext = sext i16 %rem.179 to i32
%.lhs.trunc80 = trunc i32 %a.1 to i16
%3 = srem i16 %.lhs.trunc80, 1000
%.sext81 = sext i16 %3 to i32
%mul.1 = sub nsw i32 %a.1, %.sext81
%sub22.1 = add nsw i32 %k.1, -1
%idxprom23.1 = zext i32 %sub22.1 to i64
%arrayidx24.1 = getelementptr inbounds [5 x i32], ptr %ara, i64 0, i64 %idxprom23.1
store i32 %mul.1, ptr %arrayidx24.1, align 4, !tbaa !5
%inc25.1 = add nuw nsw i32 %k.1, 1
br label %for.inc.1
for.inc.1: ; preds = %if.end.1, %for.inc
%k.1.1 = phi i32 [ %inc25.1, %if.end.1 ], [ %k.1, %for.inc ]
%a.1.1 = phi i32 [ %rem.1.sext, %if.end.1 ], [ %a.1, %for.inc ]
%a.1.1.off = add nsw i32 %a.1.1, 99
%cmp5.not.2 = icmp ult i32 %a.1.1.off, 199
br i1 %cmp5.not.2, label %for.inc.2, label %if.then.2
if.then.2: ; preds = %for.inc.1
%conv.2 = sitofp i32 %a.1.1 to double
%div9.2 = fdiv double %conv.2, 1.000000e+02
%cmp10.2 = fcmp oeq double %div9.2, 1.000000e+00
br i1 %cmp10.2, label %for.end.sink.split, label %if.end.2
if.end.2: ; preds = %if.then.2
%rem.2.lhs.trunc = trunc i32 %a.1.1 to i16
%rem.276 = srem i16 %rem.2.lhs.trunc, 100
%rem.2.sext = sext i16 %rem.276 to i32
%.lhs.trunc77 = trunc i32 %a.1.1 to i16
%4 = srem i16 %.lhs.trunc77, 100
%.sext78 = sext i16 %4 to i32
%mul.2 = sub nsw i32 %a.1.1, %.sext78
%sub22.2 = add nsw i32 %k.1.1, -1
%idxprom23.2 = zext i32 %sub22.2 to i64
%arrayidx24.2 = getelementptr inbounds [5 x i32], ptr %ara, i64 0, i64 %idxprom23.2
store i32 %mul.2, ptr %arrayidx24.2, align 4, !tbaa !5
%inc25.2 = add nuw nsw i32 %k.1.1, 1
br label %for.inc.2
for.inc.2: ; preds = %if.end.2, %for.inc.1
%k.1.2 = phi i32 [ %inc25.2, %if.end.2 ], [ %k.1.1, %for.inc.1 ]
%a.1.2 = phi i32 [ %rem.2.sext, %if.end.2 ], [ %a.1.1, %for.inc.1 ]
%a.1.2.off = add nsw i32 %a.1.2, 9
%cmp5.not.3 = icmp ult i32 %a.1.2.off, 19
br i1 %cmp5.not.3, label %for.inc.3, label %if.then.3
if.then.3: ; preds = %for.inc.2
%conv.3 = sitofp i32 %a.1.2 to double
%div9.3 = fdiv double %conv.3, 1.000000e+01
%cmp10.3 = fcmp oeq double %div9.3, 1.000000e+00
br i1 %cmp10.3, label %for.end.sink.split, label %if.end.3
if.end.3: ; preds = %if.then.3
%rem.3.lhs.trunc = trunc i32 %a.1.2 to i8
%rem.375 = srem i8 %rem.3.lhs.trunc, 10
%rem.3.sext = sext i8 %rem.375 to i32
%.lhs.trunc = trunc i32 %a.1.2 to i8
%5 = srem i8 %.lhs.trunc, 10
%.sext = sext i8 %5 to i32
%mul.3 = sub nsw i32 %a.1.2, %.sext
%sub22.3 = add nsw i32 %k.1.2, -1
%idxprom23.3 = zext i32 %sub22.3 to i64
%arrayidx24.3 = getelementptr inbounds [5 x i32], ptr %ara, i64 0, i64 %idxprom23.3
store i32 %mul.3, ptr %arrayidx24.3, align 4, !tbaa !5
%inc25.3 = add nuw nsw i32 %k.1.2, 1
br label %for.inc.3
for.inc.3: ; preds = %if.end.3, %for.inc.2
%k.1.3 = phi i32 [ %inc25.3, %if.end.3 ], [ %k.1.2, %for.inc.2 ]
%a.1.3 = phi i32 [ %rem.3.sext, %if.end.3 ], [ %a.1.2, %for.inc.2 ]
%cond = icmp eq i32 %a.1.3, 0
br i1 %cond, label %for.end, label %for.end.sink.split
for.end.sink.split: ; preds = %for.inc.3, %if.then, %if.then.1, %if.then.2, %if.then.3
%k.1.3.sink82 = phi i32 [ 1, %if.then ], [ %k.1, %if.then.1 ], [ %k.1.1, %if.then.2 ], [ %k.1.2, %if.then.3 ], [ %k.1.3, %for.inc.3 ]
%a.1.3.sink = phi i32 [ %.fr, %if.then ], [ %a.1, %if.then.1 ], [ %a.1.1, %if.then.2 ], [ %a.1.2, %if.then.3 ], [ %a.1.3, %for.inc.3 ]
%sub22.4 = add nsw i32 %k.1.3.sink82, -1
%idxprom23.4 = zext i32 %sub22.4 to i64
%arrayidx24.4 = getelementptr inbounds [5 x i32], ptr %ara, i64 0, i64 %idxprom23.4
store i32 %a.1.3.sink, ptr %arrayidx24.4, align 4, !tbaa !5
%inc25.4 = add nuw nsw i32 %k.1.3.sink82, 1
br label %for.end
for.end: ; preds = %for.inc.3, %for.end.sink.split
%k.2 = phi i32 [ %k.1.3, %for.inc.3 ], [ %inc25.4, %for.end.sink.split ]
%sub27 = add nsw i32 %k.2, -1
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub27)
%6 = load i32, ptr %ara, align 16, !tbaa !5
%cmp32.not67 = icmp eq i32 %6, 0
br i1 %cmp32.not67, label %for.end40, label %for.body34
for.body34: ; preds = %for.end, %for.body34
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body34 ], [ 0, %for.end ]
%7 = phi i32 [ %8, %for.body34 ], [ %6, %for.end ]
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx31 = getelementptr inbounds [5 x i32], ptr %ara, i64 0, i64 %indvars.iv.next
%8 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%cmp32.not = icmp eq i32 %8, 0
br i1 %cmp32.not, label %for.end40, label %for.body34, !llvm.loop !9
for.end40: ; preds = %for.body34, %for.end
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %ara) #5
%inc43 = add nuw nsw i32 %i.070, 1
%9 = load i32, ptr %t, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.070, %9
br i1 %cmp.not.not, label %for.body, label %for.end44, !llvm.loop !11
for.end44: ; preds = %for.end40, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(void){
int a;
int ans[100001];
int turn[100001];
int num=1;
int flag=0;
scanf("%d",&a);
for(int i=0;i<a;i++){
scanf("%d",&turn[i]);
}
for(num=1;num<=a;num++){
flag=0;
int n=0;
while(flag==0){
if(turn[n]==num){
ans[num-1]=n+1;
flag=1;
}
n++;
}
}
for(int m=0;m<a-1;m++){
printf("%d ",ans[m]);
}
printf("%d\n",ans[a-1]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149173/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149173/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%ans = alloca [100001 x i32], align 16
%turn = alloca [100001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %ans) #3
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %turn) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.body, label %for.cond15.preheader.for.cond.cleanup18_crit_edge
for.cond2.preheader: ; preds = %for.body
%cmp3.not42 = icmp slt i32 %4, 1
br i1 %cmp3.not42, label %for.cond15.preheader.for.cond.cleanup18_crit_edge, label %while.cond.preheader.preheader
while.cond.preheader.preheader: ; preds = %for.cond2.preheader
%1 = add i32 %4, 1
%wide.trip.count = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %2, 1
%3 = icmp eq i32 %1, 2
br i1 %3, label %for.cond15.preheader.unr-lcssa, label %while.cond.preheader.preheader.new
while.cond.preheader.preheader.new: ; preds = %while.cond.preheader.preheader
%unroll_iter = and i64 %2, -2
br label %while.cond.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100001 x i32], ptr %turn, 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
%4 = load i32, ptr %a, 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.cond2.preheader, !llvm.loop !9
while.cond.preheader: ; preds = %while.end.1, %while.cond.preheader.preheader.new
%indvars.iv55 = phi i64 [ 1, %while.cond.preheader.preheader.new ], [ %indvars.iv.next56.1, %while.end.1 ]
%niter = phi i64 [ 0, %while.cond.preheader.preheader.new ], [ %niter.next.1, %while.end.1 ]
%6 = add nsw i64 %indvars.iv55, -1
%arrayidx10 = getelementptr inbounds [100001 x i32], ptr %ans, i64 0, i64 %6
br label %while.body
for.cond15.preheader.unr-lcssa: ; preds = %while.end.1, %while.cond.preheader.preheader
%indvars.iv55.unr = phi i64 [ 1, %while.cond.preheader.preheader ], [ %indvars.iv.next56.1, %while.end.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond15.preheader, label %while.cond.preheader.epil
while.cond.preheader.epil: ; preds = %for.cond15.preheader.unr-lcssa
%7 = add nsw i64 %indvars.iv55.unr, -1
%arrayidx10.epil = getelementptr inbounds [100001 x i32], ptr %ans, i64 0, i64 %7
br label %while.body.epil
while.body.epil: ; preds = %while.body.epil, %while.cond.preheader.epil
%indvars.iv51.epil = phi i64 [ 0, %while.cond.preheader.epil ], [ %.pre62.epil, %while.body.epil ]
%arrayidx7.epil = getelementptr inbounds [100001 x i32], ptr %turn, i64 0, i64 %indvars.iv51.epil
%8 = load i32, ptr %arrayidx7.epil, align 4, !tbaa !5
%9 = zext i32 %8 to i64
%cmp8.not.epil = icmp eq i64 %indvars.iv55.unr, %9
%.pre62.epil = add nuw i64 %indvars.iv51.epil, 1
br i1 %cmp8.not.epil, label %while.end.epil, label %while.body.epil
while.end.epil: ; preds = %while.body.epil
%10 = trunc i64 %indvars.iv51.epil to i32
%11 = add i32 %10, 1
store i32 %11, ptr %arrayidx10.epil, align 4, !tbaa !5
br label %for.cond15.preheader
for.cond15.preheader: ; preds = %for.cond15.preheader.unr-lcssa, %while.end.epil
%cmp1745 = icmp sgt i32 %4, 1
br i1 %cmp1745, label %for.body19, label %for.cond15.preheader.for.cond.cleanup18_crit_edge
for.cond15.preheader.for.cond.cleanup18_crit_edge: ; preds = %entry, %for.cond2.preheader, %for.cond15.preheader
%12 = phi i32 [ %4, %for.cond15.preheader ], [ %4, %for.cond2.preheader ], [ %0, %entry ]
%sub1644 = add nsw i32 %12, -1
%.pre = sext i32 %sub1644 to i64
br label %for.cond.cleanup18
while.body: ; preds = %while.body, %while.cond.preheader
%indvars.iv51 = phi i64 [ 0, %while.cond.preheader ], [ %.pre62, %while.body ]
%arrayidx7 = getelementptr inbounds [100001 x i32], ptr %turn, i64 0, i64 %indvars.iv51
%13 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%14 = zext i32 %13 to i64
%cmp8.not = icmp eq i64 %indvars.iv55, %14
%.pre62 = add nuw i64 %indvars.iv51, 1
br i1 %cmp8.not, label %while.end, label %while.body
while.end: ; preds = %while.body
%15 = trunc i64 %indvars.iv51 to i32
%16 = add i32 %15, 1
store i32 %16, ptr %arrayidx10, align 4, !tbaa !5
%indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
%arrayidx10.1 = getelementptr inbounds [100001 x i32], ptr %ans, i64 0, i64 %indvars.iv55
br label %while.body.1
while.body.1: ; preds = %while.body.1, %while.end
%indvars.iv51.1 = phi i64 [ 0, %while.end ], [ %.pre62.1, %while.body.1 ]
%arrayidx7.1 = getelementptr inbounds [100001 x i32], ptr %turn, i64 0, i64 %indvars.iv51.1
%17 = load i32, ptr %arrayidx7.1, align 4, !tbaa !5
%18 = zext i32 %17 to i64
%cmp8.not.1 = icmp eq i64 %indvars.iv.next56, %18
%.pre62.1 = add nuw i64 %indvars.iv51.1, 1
br i1 %cmp8.not.1, label %while.end.1, label %while.body.1
while.end.1: ; preds = %while.body.1
%19 = trunc i64 %indvars.iv51.1 to i32
%20 = add i32 %19, 1
store i32 %20, ptr %arrayidx10.1, align 4, !tbaa !5
%indvars.iv.next56.1 = add nuw nsw i64 %indvars.iv55, 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.cond15.preheader.unr-lcssa, label %while.cond.preheader, !llvm.loop !11
for.cond.cleanup18: ; preds = %for.body19, %for.cond15.preheader.for.cond.cleanup18_crit_edge
%idxprom27.pre-phi = phi i64 [ %.pre, %for.cond15.preheader.for.cond.cleanup18_crit_edge ], [ %24, %for.body19 ]
%arrayidx28 = getelementptr inbounds [100001 x i32], ptr %ans, i64 0, i64 %idxprom27.pre-phi
%21 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %turn) #3
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %ans) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
for.body19: ; preds = %for.cond15.preheader, %for.body19
%indvars.iv59 = phi i64 [ %indvars.iv.next60, %for.body19 ], [ 0, %for.cond15.preheader ]
%arrayidx21 = getelementptr inbounds [100001 x i32], ptr %ans, i64 0, i64 %indvars.iv59
%22 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %22)
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%23 = load i32, ptr %a, align 4, !tbaa !5
%sub16 = add nsw i32 %23, -1
%24 = sext i32 %sub16 to i64
%cmp17 = icmp slt i64 %indvars.iv.next60, %24
br i1 %cmp17, label %for.body19, label %for.cond.cleanup18, !llvm.loop !12
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define num_max(p,q)((p)>(q)?(p):(q))
#define num_min(p,q)((p)<(q)?(p):(q))
int cmp(const void *a, const void *b)
{
return *(int*)a - *(int*)b;//昇順
//降順ならreturn *(int*)b - *(int*)a;
}
int main()
{
int N,i;
scanf("%d", &N);
int(*A) = (int(*))malloc(100010 * sizeof(int));
int(*B) = (int(*))malloc(100010 * sizeof(int));
for (i = 1;i <= N;i++)
{
scanf("%d", &A[i]);
B[A[i]] = i;
}
for (i = 1;i <= N;i++)printf("%d ", B[i]);
free(A);
free(B);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149216/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149216/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #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: 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)
%call1 = call noalias dereferenceable_or_null(400040) ptr @malloc(i64 noundef 400040) #7
%call2 = call noalias dereferenceable_or_null(400040) ptr @malloc(i64 noundef 400040) #7
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not28 = icmp slt i32 %0, 1
br i1 %cmp.not28, label %for.end16, label %for.body
for.cond8.preheader: ; preds = %for.body
%1 = icmp slt i32 %4, 1
br i1 %1, label %for.end16, label %for.body10
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom6 = sext i32 %2 to i64
%arrayidx7 = getelementptr inbounds i32, ptr %call2, i64 %idxprom6
%3 = trunc i64 %indvars.iv to i32
store i32 %3, ptr %arrayidx7, align 4, !tbaa !5
%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.cond8.preheader, !llvm.loop !9
for.body10: ; preds = %for.cond8.preheader, %for.body10
%indvars.iv33 = phi i64 [ %indvars.iv.next34, %for.body10 ], [ 1, %for.cond8.preheader ]
%arrayidx12 = getelementptr inbounds i32, ptr %call2, i64 %indvars.iv33
%6 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6)
%indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
%7 = load i32, ptr %N, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp9.not.not = icmp slt i64 %indvars.iv33, %8
br i1 %cmp9.not.not, label %for.body10, label %for.end16, !llvm.loop !11
for.end16: ; preds = %for.body10, %entry, %for.cond8.preheader
call void @free(ptr noundef %call1) #6
call void @free(ptr noundef %call2) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; 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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn 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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main(){
int n, eq=0, eq2=0, eq3=0, eq4=0, eq5=0, eq6=0, eq7=0, eq8=0, cont;
scanf("%d", &n);
int vet[n];
for(int i =0; i<n; ++i){
scanf("%d", &vet[i]);
cont=0;
eq= vet[i]/10000;
eq2= vet[i]%10000;
eq3= eq2/1000;
eq4= eq2%1000;
eq5= eq4/100;
eq6= eq4%100;
eq7= eq6/10;
eq8= eq6%10;
if(eq!=0)
cont++;
if(eq3!=0)
cont++;
if(eq5!=0)
cont++;
if(eq7!=0)
cont++;
if(eq8!=0)
cont++;
printf("%d\n", cont);
if(eq!=0)
printf("%d ", eq*10000);
if(eq3!=0)
printf("%d ", eq3*1000);
if(eq5!=0)
printf("%d ", eq5*100);
if(eq7!=0)
printf("%d ", eq7*10);
if(eq8!=0)
printf("%d ", eq8);
printf("\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14926/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14926/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = 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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp80 = icmp sgt i32 %3, 0
br i1 %cmp80, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %if.end52, %entry
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body: ; preds = %entry, %if.end52
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end52 ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%.fr = freeze i32 %4
%rem = srem i32 %.fr, 10000
%rem7.lhs.trunc = trunc i32 %rem to i16
%rem777 = srem i16 %rem7.lhs.trunc, 1000
%rem7.sext = sext i16 %rem777 to i32
%rem978 = srem i16 %rem777, 100
%rem9.sext = sext i16 %rem978 to i32
%rem11.lhs.trunc = trunc i16 %rem978 to i8
%rem1179 = srem i8 %rem11.lhs.trunc, 10
%rem11.sext = sext i8 %rem1179 to i32
%5 = add i32 %.fr, -10000
%cmp12.not = icmp ult i32 %5, -19999
%spec.select = zext i1 %cmp12.not to i32
%rem.off = add nsw i32 %rem, 999
%cmp13.not = icmp ult i32 %rem.off, 1999
%inc15 = select i1 %cmp12.not, i32 2, i32 1
%cont.1 = select i1 %cmp13.not, i32 %spec.select, i32 %inc15
%6 = add nsw i32 %rem7.sext, -100
%cmp17.not = icmp ult i32 %6, -199
%inc19 = zext i1 %cmp17.not to i32
%cont.2 = add nuw nsw i32 %cont.1, %inc19
%7 = add nsw i32 %rem9.sext, -10
%cmp21.not = icmp ult i32 %7, -19
%inc23 = zext i1 %cmp21.not to i32
%cont.3 = add nuw nsw i32 %cont.2, %inc23
%cmp25.not = icmp ne i8 %rem1179, 0
%inc27 = zext i1 %cmp25.not to i32
%cont.4 = add nuw nsw i32 %cont.3, %inc27
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cont.4)
br i1 %cmp12.not, label %if.then31, label %if.end33
if.then31: ; preds = %for.body
%mul = sub nsw i32 %.fr, %rem
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %mul)
br label %if.end33
if.end33: ; preds = %if.then31, %for.body
br i1 %cmp13.not, label %if.end38, label %if.then35
if.then35: ; preds = %if.end33
%mul36 = sub nsw i32 %rem, %rem7.sext
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %mul36)
br label %if.end38
if.end38: ; preds = %if.then35, %if.end33
br i1 %cmp17.not, label %if.then40, label %if.end43
if.then40: ; preds = %if.end38
%mul41 = sub nsw i32 %rem7.sext, %rem9.sext
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %mul41)
br label %if.end43
if.end43: ; preds = %if.then40, %if.end38
br i1 %cmp21.not, label %if.then45, label %if.end48
if.then45: ; preds = %if.end43
%mul46 = sub nsw i32 %rem9.sext, %rem11.sext
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %mul46)
br label %if.end48
if.end48: ; preds = %if.then45, %if.end43
br i1 %cmp25.not, label %if.then50, label %if.end52
if.then50: ; preds = %if.end48
%call51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %rem11.sext)
br label %if.end52
if.end52: ; preds = %if.then50, %if.end48
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int t,n,i,k=1,div=0,mod=0,c=0,a[10],j;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d",&n);
div=n;
mod=0;
k=1;
c=0;
while(div!=0)
{
mod=div%10;
div=div/10;
if(mod!=0){a[c]=mod*k;
c++;}
k=k*10;
}
printf("%d\n",c);
for(j=0;j<c;j++){printf("%d ",a[j]);}
printf("\n");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_14931/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_14931/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = 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:
%t = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca [10 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp34 = icmp sgt i32 %0, 0
br i1 %cmp34, label %for.body, label %for.end17
for.body: ; preds = %entry, %for.end
%i.035 = phi i32 [ %inc16, %for.end ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp2.not28 = icmp eq i32 %1, 0
br i1 %cmp2.not28, label %while.end.thread, label %while.body
while.end.thread: ; preds = %for.body
%call638 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 0)
br label %for.end
while.body: ; preds = %for.body, %if.end
%c.031 = phi i32 [ %c.1, %if.end ], [ 0, %for.body ]
%div.030 = phi i32 [ %div3, %if.end ], [ %1, %for.body ]
%k.029 = phi i32 [ %mul5, %if.end ], [ 1, %for.body ]
%rem = srem i32 %div.030, 10
%div3 = sdiv i32 %div.030, 10
%cmp4.not = icmp eq i32 %rem, 0
br i1 %cmp4.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul nsw i32 %rem, %k.029
%idxprom = sext i32 %c.031 to i64
%arrayidx = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 %idxprom
store i32 %mul, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %c.031, 1
br label %if.end
if.end: ; preds = %if.then, %while.body
%c.1 = phi i32 [ %inc, %if.then ], [ %c.031, %while.body ]
%mul5 = mul nsw i32 %k.029, 10
%div.030.off = add i32 %div.030, 9
%cmp2.not = icmp ult i32 %div.030.off, 19
br i1 %cmp2.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.1)
%cmp832 = icmp sgt i32 %c.1, 0
br i1 %cmp832, label %for.body9.preheader, label %for.end
for.body9.preheader: ; preds = %while.end
%wide.trip.count = zext i32 %c.1 to i64
br label %for.body9
for.body9: ; preds = %for.body9.preheader, %for.body9
%indvars.iv = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next, %for.body9 ]
%arrayidx11 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 %indvars.iv
%2 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %2)
%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.body9, !llvm.loop !11
for.end: ; preds = %for.body9, %while.end.thread, %while.end
%putchar = call i32 @putchar(i32 10)
%inc16 = add nuw nsw i32 %i.035, 1
%3 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc16, %3
br i1 %cmp, label %for.body, label %for.end17, !llvm.loop !12
for.end17: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 40, 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 %t) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main() {
static char s[4], t[4];
int i, yes;
scanf("%s%s", s, t);
yes = 1;
for (i = 0; i < 3; i++)
if (s[i] != t[2 - i])
yes = 0;
printf(yes ? "YES\n" : "NO\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149353/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149353/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@main.s = internal global [4 x i8] zeroinitializer, align 1
@main.t = internal global [4 x i8] zeroinitializer, align 1
@.str = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"YES\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"NO\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 @main.s, ptr noundef nonnull @main.t)
%0 = load i8, ptr @main.s, align 1, !tbaa !5
%1 = load i8, ptr getelementptr inbounds ([4 x i8], ptr @main.t, i64 0, i64 2), align 1, !tbaa !5
%cmp4.not = icmp ne i8 %0, %1
%2 = load i8, ptr getelementptr inbounds ([4 x i8], ptr @main.s, i64 0, i64 1), align 1, !tbaa !5
%3 = load i8, ptr getelementptr inbounds ([4 x i8], ptr @main.t, i64 0, i64 1), align 1, !tbaa !5
%cmp4.not.1 = icmp ne i8 %2, %3
%4 = load i8, ptr getelementptr inbounds ([4 x i8], ptr @main.s, i64 0, i64 2), align 1, !tbaa !5
%5 = load i8, ptr @main.t, align 1, !tbaa !5
%cmp4.not.2 = icmp ne i8 %4, %5
%.not = select i1 %cmp4.not.2, i1 true, i1 %cmp4.not.1
%narrow14 = select i1 %.not, i1 true, i1 %cmp4.not
%cond = select i1 %narrow14, ptr @.str.2, ptr @.str.1
%call6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
char s[2][4];
scanf("%s%s",s[0],s[1]);
puts((s[0][0]==s[1][2])&&(s[0][1]==s[1][1])&&(s[0][2]==s[1][0])?"YES":"NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_149418/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_149418/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [2 x [4 x i8]], align 1
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %s) #3
%arrayidx1 = getelementptr inbounds [2 x [4 x i8]], ptr %s, i64 0, i64 1
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %arrayidx1)
%0 = load i8, ptr %s, align 1, !tbaa !5
%arrayidx6 = getelementptr inbounds [2 x [4 x i8]], ptr %s, i64 0, i64 1, i64 2
%1 = load i8, ptr %arrayidx6, align 1, !tbaa !5
%cmp = icmp eq i8 %0, %1
br i1 %cmp, label %land.lhs.true, label %land.end
land.lhs.true: ; preds = %entry
%arrayidx10 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 1
%2 = load i8, ptr %arrayidx10, align 1, !tbaa !5
%arrayidx13 = getelementptr inbounds [2 x [4 x i8]], ptr %s, i64 0, i64 1, i64 1
%3 = load i8, ptr %arrayidx13, align 1, !tbaa !5
%cmp15 = icmp eq i8 %2, %3
br i1 %cmp15, label %land.rhs, label %land.end
land.rhs: ; preds = %land.lhs.true
%arrayidx18 = getelementptr inbounds [4 x i8], ptr %s, i64 0, i64 2
%4 = load i8, ptr %arrayidx18, align 1, !tbaa !5
%5 = load i8, ptr %arrayidx1, align 1, !tbaa !5
%cmp23 = icmp eq i8 %4, %5
%6 = select i1 %cmp23, ptr @.str.1, ptr @.str.2
br label %land.end
land.end: ; preds = %land.rhs, %land.lhs.true, %entry
%cond = phi ptr [ @.str.2, %land.lhs.true ], [ @.str.2, %entry ], [ %6, %land.rhs ]
%call25 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %cond)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.