Source_Code
stringlengths 69
484k
| IR_Original
stringlengths 2.05k
17.9M
|
---|---|
#include <stdio.h>
#define abs(a) ((a)<0 ? -(a) : (a))
#define chmin(a,b) ((a)<(b) ? (a) : (b))
int main()
{
int a[200000];
int N;
scanf("%d",&N);
for(int i=0;i<N;i++)
scanf("%d",&a[i]);
int dp[N];
dp[0]=0;
dp[1]=abs(a[1]-a[0]);
for(int i=2;i<N;i++)
dp[i]=chmin(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
printf("%d",dp[N-1]);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_321941/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_321941/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [200000 x i32], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 800000, 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
%cmp178 = icmp sgt i32 %0, 0
br i1 %cmp178, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa177 = phi i32 [ %0, %entry ], [ %6, %for.body ]
%1 = zext i32 %.lcssa177 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
store i32 0, ptr %vla, align 16, !tbaa !5
%arrayidx3 = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 1
%3 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%4 = load i32, ptr %a, align 16, !tbaa !5
%sub = sub nsw i32 %3, %4
%cond = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%arrayidx13 = getelementptr inbounds i32, ptr %vla, i64 1
store i32 %cond, ptr %arrayidx13, align 4, !tbaa !5
%5 = load i32, ptr %N, align 4, !tbaa !5
%cmp16180 = icmp sgt i32 %5, 2
br i1 %cmp16180, label %for.body18.preheader, label %for.cond.cleanup17
for.body18.preheader: ; preds = %for.cond.cleanup
%wide.trip.count = zext i32 %5 to i64
br label %for.body18
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200000 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
%6 = load i32, ptr %N, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond.cleanup17: ; preds = %for.body18, %for.cond.cleanup
%sub140 = add nsw i32 %5, -1
%idxprom141 = sext i32 %sub140 to i64
%arrayidx142 = getelementptr inbounds i32, ptr %vla, i64 %idxprom141
%8 = load i32, ptr %arrayidx142, align 4, !tbaa !5
%call143 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %a) #5
ret i32 0
for.body18: ; preds = %for.body18.preheader, %for.body18
%9 = phi i32 [ %3, %for.body18.preheader ], [ %11, %for.body18 ]
%10 = phi i32 [ %cond, %for.body18.preheader ], [ %spec.select, %for.body18 ]
%indvars.iv184 = phi i64 [ 2, %for.body18.preheader ], [ %indvars.iv.next185, %for.body18 ]
%arrayidx23 = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %indvars.iv184
%11 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%sub27 = sub nsw i32 %11, %9
%cond45 = call i32 @llvm.abs.i32(i32 %sub27, i1 true)
%add = add nsw i32 %cond45, %10
%12 = add nsw i64 %indvars.iv184, -2
%arrayidx48 = getelementptr inbounds i32, ptr %vla, i64 %12
%13 = load i32, ptr %arrayidx48, align 4, !tbaa !5
%arrayidx53 = getelementptr inbounds [200000 x i32], ptr %a, i64 0, i64 %12
%14 = load i32, ptr %arrayidx53, align 4, !tbaa !5
%sub54 = sub nsw i32 %11, %14
%cond72 = call i32 @llvm.abs.i32(i32 %sub54, i1 true)
%add73 = add nsw i32 %cond72, %13
%spec.select = call i32 @llvm.smin.i32(i32 %add, i32 %add73)
%arrayidx136 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv184
store i32 %spec.select, ptr %arrayidx136, align 4, !tbaa !5
%indvars.iv.next185 = add nuw nsw i64 %indvars.iv184, 1
%exitcond.not = icmp eq i64 %indvars.iv.next185, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup17, label %for.body18, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
; 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 = { 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}
|
#include <stdio.h>
#include <stdlib.h>
long long int chmin(long long int a, long long int b)
{
if (a > b)
return b;
else
return a;
}
int main(int argc, char const *argv[])
{
long long int n;
scanf("%lld", &n);
long long int dp[100100];
long long int h[100100];
for (int i = 0; i < n; i++)
{
dp[i] = 1000000;
scanf("%lld", h+i);
}
dp[0] = 0;
dp[1] = llabs(h[1] - h[0]);
for (int i = 2; i < n; ++i)
{
dp[i]=chmin(dp[i - 2] + llabs(h[i] - h[i - 2]), dp[i - 1] + llabs(h[i] - h[i - 1]));
}
printf("%lld", dp[n-1]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_321985/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_321985/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @chmin(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%b.a = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %b.a
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #1 {
entry:
%n = alloca i64, align 8
%dp = alloca [100100 x i64], align 16
%h = alloca [100100 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 800800, ptr nonnull %dp) #6
call void @llvm.lifetime.start.p0(i64 800800, ptr nonnull %h) #6
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp53 = icmp sgt i64 %0, 0
br i1 %cmp53, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
store i64 0, ptr %dp, align 16, !tbaa !5
br label %for.cond.cleanup12
for.cond.cleanup: ; preds = %for.body
%arrayidx4.phi.trans.insert = getelementptr inbounds [100100 x i64], ptr %h, i64 0, i64 1
%.pre = load i64, ptr %arrayidx4.phi.trans.insert, align 8, !tbaa !5
%.pre66 = load i64, ptr %h, align 16, !tbaa !5
store i64 0, ptr %dp, align 16, !tbaa !5
%sub = sub nsw i64 %.pre, %.pre66
%1 = call i64 @llvm.abs.i64(i64 %sub, i1 true)
%arrayidx6 = getelementptr inbounds [100100 x i64], ptr %dp, i64 0, i64 1
store i64 %1, ptr %arrayidx6, align 8, !tbaa !5
%cmp1056 = icmp sgt i64 %2, 2
br i1 %cmp1056, label %for.body13, label %for.cond.cleanup12
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100100 x i64], ptr %dp, i64 0, i64 %indvars.iv
store i64 1000000, ptr %arrayidx, align 8, !tbaa !5
%add.ptr = getelementptr inbounds i64, ptr %h, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp sgt i64 %2, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond.cleanup12: ; preds = %for.body13, %for.cond.cleanup.thread, %for.cond.cleanup
%.lcssa73 = phi i64 [ %0, %for.cond.cleanup.thread ], [ %2, %for.cond.cleanup ], [ %2, %for.body13 ]
%sub39 = add nsw i64 %.lcssa73, -1
%arrayidx40 = getelementptr inbounds [100100 x i64], ptr %dp, i64 0, i64 %sub39
%3 = load i64, ptr %arrayidx40, align 8, !tbaa !5
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %3)
call void @llvm.lifetime.end.p0(i64 800800, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 800800, ptr nonnull %dp) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #6
ret i32 0
for.body13: ; preds = %for.cond.cleanup, %for.body13
%4 = phi i64 [ %8, %for.body13 ], [ %.pre, %for.cond.cleanup ]
%5 = phi i64 [ %b.a.i, %for.body13 ], [ %1, %for.cond.cleanup ]
%6 = phi i64 [ %4, %for.body13 ], [ %.pre66, %for.cond.cleanup ]
%7 = phi i64 [ %5, %for.body13 ], [ 0, %for.cond.cleanup ]
%indvars.iv61 = phi i64 [ %indvars.iv.next62, %for.body13 ], [ 2, %for.cond.cleanup ]
%arrayidx18 = getelementptr inbounds [100100 x i64], ptr %h, i64 0, i64 %indvars.iv61
%8 = load i64, ptr %arrayidx18, align 8, !tbaa !5
%sub22 = sub nsw i64 %8, %6
%9 = call i64 @llvm.abs.i64(i64 %sub22, i1 true)
%add = add nsw i64 %9, %7
%sub31 = sub nsw i64 %8, %4
%10 = call i64 @llvm.abs.i64(i64 %sub31, i1 true)
%add32 = add nsw i64 %10, %5
%b.a.i = call i64 @llvm.smin.i64(i64 %add, i64 %add32)
%arrayidx35 = getelementptr inbounds [100100 x i64], ptr %dp, i64 0, i64 %indvars.iv61
store i64 %b.a.i, ptr %arrayidx35, align 8, !tbaa !5
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%exitcond.not = icmp eq i64 %indvars.iv.next62, %2
br i1 %exitcond.not, label %for.cond.cleanup12, label %for.body13, !llvm.loop !11
}
; 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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main(){
int n,i;
scanf("%d",&n);
int h[n];
int cost[n];
for(i=0;i<n;i++){
scanf("%d",&h[i]);
}
int conpara=0;
cost[0]=0;
for(i=1;i<n;i++){
cost[i]=cost[i-1]+abs(h[i-1]-h[i]);
if(i>=2){
conpara=cost[i-2]+abs(h[i-2]-h[i]);
if(cost[i] >conpara){
cost[i]=conpara;
}
}
//printf("%d; %d\n",i,cost[i]);
}
printf("%d\n",cost[n-1]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322041/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322041/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #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
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%cmp57 = icmp sgt i32 %3, 0
br i1 %cmp57, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
store i32 0, ptr %vla1, align 16, !tbaa !5
br label %for.end37
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
store i32 0, ptr %vla1, align 16, !tbaa !5
%cmp559 = icmp sgt i32 %5, 1
br i1 %cmp559, label %for.inc35.peel, label %for.end37
for.inc35.peel: ; preds = %for.end
%wide.trip.count = zext i32 %5 to i64
%7 = load i32, ptr %vla, align 16, !tbaa !5
%arrayidx13.peel = getelementptr inbounds i32, ptr %vla, i64 1
%8 = load i32, ptr %arrayidx13.peel, align 4, !tbaa !5
%sub14.peel = sub nsw i32 %7, %8
%9 = call i32 @llvm.abs.i32(i32 %sub14.peel, i1 true)
%arrayidx16.peel = getelementptr inbounds i32, ptr %vla1, i64 1
store i32 %9, ptr %arrayidx16.peel, align 4, !tbaa !5
%exitcond.peel.not = icmp eq i32 %5, 2
br i1 %exitcond.peel.not, label %for.end37, label %if.then
if.then: ; preds = %for.inc35.peel, %for.inc35
%10 = phi i32 [ %12, %for.inc35 ], [ %8, %for.inc35.peel ]
%11 = phi i32 [ %18, %for.inc35 ], [ %9, %for.inc35.peel ]
%indvars.iv63 = phi i64 [ %indvars.iv.next64, %for.inc35 ], [ 2, %for.inc35.peel ]
%arrayidx13 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv63
%12 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%sub14 = sub nsw i32 %10, %12
%13 = call i32 @llvm.abs.i32(i32 %sub14, i1 true)
%add = add nsw i32 %13, %11
%arrayidx16 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv63
store i32 %add, ptr %arrayidx16, align 4, !tbaa !5
%14 = add nuw i64 %indvars.iv63, 4294967294
%idxprom19 = and i64 %14, 4294967295
%arrayidx20 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom19
%15 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%arrayidx23 = getelementptr inbounds i32, ptr %vla, i64 %idxprom19
%16 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%sub26 = sub nsw i32 %16, %12
%17 = call i32 @llvm.abs.i32(i32 %sub26, i1 true)
%add27 = add nsw i32 %17, %15
%cmp30 = icmp sgt i32 %add, %add27
br i1 %cmp30, label %if.then31, label %for.inc35
if.then31: ; preds = %if.then
store i32 %add27, ptr %arrayidx16, align 4, !tbaa !5
br label %for.inc35
for.inc35: ; preds = %if.then31, %if.then
%18 = phi i32 [ %add27, %if.then31 ], [ %add, %if.then ]
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%exitcond.not = icmp eq i64 %indvars.iv.next64, %wide.trip.count
br i1 %exitcond.not, label %for.end37, label %if.then, !llvm.loop !11
for.end37: ; preds = %for.inc35, %for.inc35.peel, %for.end.thread, %for.end
%.lcssa71 = phi i32 [ %3, %for.end.thread ], [ %5, %for.end ], [ 2, %for.inc35.peel ], [ %5, %for.inc35 ]
%sub38 = add nsw i32 %.lcssa71, -1
%idxprom39 = sext i32 %sub38 to i64
%arrayidx40 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom39
%19 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %19)
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 speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
int abs(int);
int main(){
long n;
scanf("%ld",&n);
int h[n],dp[n];
for (long i=0;i<n;i++){
scanf("%ld",&h[i]);
}
for (long i=0;i<n;i++){
if (i==0){
dp[i]=0;
// printf("%ld\n",dp[i]);
}
if (i==1){
dp[i]=abs(h[1]-h[0]);
// printf("%ld\n",dp[i]);
}
if (i>1){
if (dp[i-2]+abs(h[i]-h[i-2])<dp[i-1]+abs(h[i]-h[i-1])){
dp[i]=dp[i-2]+abs(h[i]-h[i-2]);
// printf("%ld\n",dp[i]);
}
else {
dp[i]=dp[i-1]+abs(h[i]-h[i-1]);
// printf("%ld\n",dp[i]);
}
}
}
printf("%ld\n",dp[n-1]);
return 0;
}
int abs(int x){
if (x<0){
x=-x;
}
return x;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322092/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322092/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #7
%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 i32, i64 %0, align 16
%2 = load i64, ptr %n, align 8, !tbaa !5
%vla1 = alloca i32, i64 %2, align 16
%cmp80 = icmp sgt i64 %2, 0
br i1 %cmp80, label %for.body, label %for.cond.cleanup6
for.cond4.preheader: ; preds = %for.body
%cmp582 = icmp sgt i64 %3, 0
br i1 %cmp582, label %for.body7.lr.ph, label %for.cond.cleanup6
for.body7.lr.ph: ; preds = %for.cond4.preheader
%arrayidx12 = getelementptr inbounds i32, ptr %vla, i64 1
%arrayidx14 = getelementptr inbounds i32, ptr %vla1, i64 1
br label %for.body7
for.body: ; preds = %entry, %for.body
%i.081 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %i.081
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.081, 1
%3 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %3
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond.cleanup6: ; preds = %for.inc51, %entry, %for.cond4.preheader
%.lcssa87 = phi i64 [ %3, %for.cond4.preheader ], [ %2, %entry ], [ %3, %for.inc51 ]
%4 = getelementptr i32, ptr %vla1, i64 %.lcssa87
%arrayidx55 = getelementptr i32, ptr %4, i64 -1
%5 = load i32, ptr %arrayidx55, align 4, !tbaa !11
%call56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #7
ret i32 0
for.body7: ; preds = %for.body7.lr.ph, %for.inc51
%i3.083 = phi i64 [ 0, %for.body7.lr.ph ], [ %inc52, %for.inc51 ]
switch i64 %i3.083, label %if.then17 [
i64 0, label %if.then
i64 1, label %if.then11
]
if.then: ; preds = %for.body7
store i32 0, ptr %vla1, align 16, !tbaa !11
br label %for.inc51
if.then11: ; preds = %for.body7
%6 = load i32, ptr %arrayidx12, align 4, !tbaa !11
%7 = load i32, ptr %vla, align 16, !tbaa !11
%sub = sub nsw i32 %6, %7
%8 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
store i32 %8, ptr %arrayidx14, align 4, !tbaa !11
br label %for.inc51
if.then17: ; preds = %for.body7
%sub18 = add nsw i64 %i3.083, -2
%arrayidx19 = getelementptr inbounds i32, ptr %vla1, i64 %sub18
%arrayidx20 = getelementptr inbounds i32, ptr %vla, i64 %i3.083
%9 = load i32, ptr %arrayidx20, align 4, !tbaa !11
%arrayidx22 = getelementptr inbounds i32, ptr %vla, i64 %sub18
%10 = load <2 x i32>, ptr %arrayidx19, align 4, !tbaa !11
%11 = load <2 x i32>, ptr %arrayidx22, align 4, !tbaa !11
%12 = insertelement <2 x i32> poison, i32 %9, i64 0
%13 = shufflevector <2 x i32> %12, <2 x i32> poison, <2 x i32> zeroinitializer
%14 = sub nsw <2 x i32> %13, %11
%15 = call <2 x i32> @llvm.abs.v2i32(<2 x i32> %14, i1 true)
%16 = add nsw <2 x i32> %15, %10
%17 = extractelement <2 x i32> %16, i64 0
%18 = extractelement <2 x i32> %16, i64 1
%cmp31 = icmp slt i32 %17, %18
%arrayidx40 = getelementptr inbounds i32, ptr %vla1, i64 %i3.083
br i1 %cmp31, label %if.then32, label %if.else
if.then32: ; preds = %if.then17
store i32 %17, ptr %arrayidx40, align 4, !tbaa !11
br label %for.inc51
if.else: ; preds = %if.then17
store i32 %18, ptr %arrayidx40, align 4, !tbaa !11
br label %for.inc51
for.inc51: ; preds = %if.then11, %if.then, %if.else, %if.then32
%inc52 = add nuw nsw i64 %i3.083, 1
%exitcond.not = icmp eq i64 %inc52, %3
br i1 %exitcond.not, label %for.cond.cleanup6, label %for.body7, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @abs(i32 noundef %x) local_unnamed_addr #5 {
entry:
%spec.select = tail call i32 @llvm.abs.i32(i32 %x, i1 true)
ret i32 %spec.select
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i32> @llvm.abs.v2i32(<2 x i32>, i1 immarg) #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 nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int w,h;
char array[21][21];
int search(int x,int y)
{
if(x<0||y<0||x>=w||y>=h)
return 0;
if(array[x][y]=='#')
return 0;
else{
array[x][y]='#';
return 1+search(x-1,y)+search(x+1,y)+search(x,y-1)+search(x,y+1);
}
}
int main()
{
int i,j;
while(scanf("%d%d",&h,&w)&&w!=0&&h!=0){
for(i=0;i<w;i++)
scanf("%s",array[i]);
for(i=0;i<w;i++)
for(j=0;j<h;j++){
if(array[i][j]=='@')
printf("%d\n",search(i,j));
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322135/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322135/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@w = dso_local global i32 0, align 4
@h = dso_local global i32 0, align 4
@array = dso_local global [21 x [21 x i8]] zeroinitializer, align 16
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [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 @search(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {
entry:
%idxprom = zext i32 %x to i64
%0 = or i32 %y, %x
%or.cond.not39 = icmp sgt i32 %0, -1
%1 = load i32, ptr @w, align 4
%cmp3.not40 = icmp sgt i32 %1, %x
%or.cond41 = select i1 %or.cond.not39, i1 %cmp3.not40, i1 false
%2 = load i32, ptr @h, align 4
%cmp5.not42 = icmp sgt i32 %2, %y
%or.cond3843 = select i1 %or.cond41, i1 %cmp5.not42, i1 false
br i1 %or.cond3843, label %if.end.lr.ph, label %return
if.end.lr.ph: ; preds = %entry
%sub = add nsw i32 %x, -1
%add15 = add nuw nsw i32 %x, 1
%3 = zext i32 %y to i64
br label %if.end
if.end: ; preds = %if.end.lr.ph, %if.else
%indvars.iv = phi i64 [ %3, %if.end.lr.ph ], [ %indvars.iv.next, %if.else ]
%accumulator.tr44 = phi i32 [ 0, %if.end.lr.ph ], [ %add23, %if.else ]
%arrayidx7 = getelementptr inbounds [21 x [21 x i8]], ptr @array, i64 0, i64 %idxprom, i64 %indvars.iv
%4 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%cmp8 = icmp eq i8 %4, 35
br i1 %cmp8, label %return, label %if.else
if.else: ; preds = %if.end
store i8 35, ptr %arrayidx7, align 1, !tbaa !5
%5 = trunc i64 %indvars.iv to i32
%call = tail call i32 @search(i32 noundef %sub, i32 noundef %5)
%call16 = tail call i32 @search(i32 noundef %add15, i32 noundef %5)
%sub18 = add nsw i32 %5, -1
%call19 = tail call i32 @search(i32 noundef %x, i32 noundef %sub18)
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%add = add i32 %accumulator.tr44, 1
%add17 = add i32 %add, %call
%add20 = add i32 %add17, %call16
%add23 = add i32 %add20, %call19
%6 = trunc i64 %indvars.iv.next to i32
%7 = or i32 %6, %x
%or.cond.not = icmp sgt i32 %7, -1
%8 = load i32, ptr @w, align 4
%cmp3.not = icmp sgt i32 %8, %x
%or.cond = select i1 %or.cond.not, i1 %cmp3.not, i1 false
%9 = load i32, ptr @h, align 4
%cmp5.not = icmp sgt i32 %9, %6
%or.cond38 = select i1 %or.cond, i1 %cmp5.not, i1 false
br i1 %or.cond38, label %if.end, label %return
return: ; preds = %if.else, %if.end, %entry
%accumulator.tr.lcssa = phi i32 [ 0, %entry ], [ %accumulator.tr44, %if.end ], [ %add23, %if.else ]
ret i32 %accumulator.tr.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call40 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @h, ptr noundef nonnull @w)
%tobool41 = icmp ne i32 %call40, 0
%0 = load i32, ptr @w, align 4
%cmp42 = icmp ne i32 %0, 0
%or.cond43 = select i1 %tobool41, i1 %cmp42, i1 false
%1 = load i32, ptr @h, align 4
%cmp144 = icmp ne i32 %1, 0
%or.cond2445 = select i1 %or.cond43, i1 %cmp144, i1 false
br i1 %or.cond2445, label %for.cond.preheader, label %while.end
while.cond.loopexit: ; preds = %for.inc21, %for.cond.preheader, %for.cond4.preheader
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @h, ptr noundef nonnull @w)
%tobool = icmp ne i32 %call, 0
%2 = load i32, ptr @w, align 4
%cmp = icmp ne i32 %2, 0
%or.cond = select i1 %tobool, i1 %cmp, i1 false
%3 = load i32, ptr @h, align 4
%cmp1 = icmp ne i32 %3, 0
%or.cond24 = select i1 %or.cond, i1 %cmp1, i1 false
br i1 %or.cond24, label %for.cond.preheader, label %while.end, !llvm.loop !8
for.cond.preheader: ; preds = %entry, %while.cond.loopexit
%4 = phi i32 [ %2, %while.cond.loopexit ], [ %0, %entry ]
%cmp234 = icmp sgt i32 %4, 0
br i1 %cmp234, label %for.body, label %while.cond.loopexit
for.cond4.preheader: ; preds = %for.body
%cmp538 = icmp sgt i32 %7, 0
%5 = load i32, ptr @h, align 4
%6 = icmp sgt i32 %5, 0
%or.cond58 = select i1 %cmp538, i1 %6, i1 false
br i1 %or.cond58, label %for.cond7.preheader, label %while.cond.loopexit
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [21 x [21 x i8]], ptr @array, i64 0, i64 %indvars.iv
%call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr @w, align 4, !tbaa !10
%8 = sext i32 %7 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp2, label %for.body, label %for.cond4.preheader, !llvm.loop !12
for.cond7.preheader: ; preds = %for.cond4.preheader, %for.inc21
%9 = phi i32 [ %18, %for.inc21 ], [ %7, %for.cond4.preheader ]
%10 = phi i32 [ %19, %for.inc21 ], [ %5, %for.cond4.preheader ]
%11 = phi i32 [ %20, %for.inc21 ], [ %5, %for.cond4.preheader ]
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %for.inc21 ], [ 0, %for.cond4.preheader ]
%cmp836 = icmp sgt i32 %11, 0
br i1 %cmp836, label %for.body9.lr.ph, label %for.inc21
for.body9.lr.ph: ; preds = %for.cond7.preheader
%12 = trunc i64 %indvars.iv51 to i32
br label %for.body9
for.body9: ; preds = %for.body9.lr.ph, %for.inc18
%13 = phi i32 [ %10, %for.body9.lr.ph ], [ %16, %for.inc18 ]
%indvars.iv48 = phi i64 [ 0, %for.body9.lr.ph ], [ %indvars.iv.next49, %for.inc18 ]
%arrayidx13 = getelementptr inbounds [21 x [21 x i8]], ptr @array, i64 0, i64 %indvars.iv51, i64 %indvars.iv48
%14 = load i8, ptr %arrayidx13, align 1, !tbaa !5
%cmp14 = icmp eq i8 %14, 64
br i1 %cmp14, label %if.then, label %for.inc18
if.then: ; preds = %for.body9
%15 = trunc i64 %indvars.iv48 to i32
%call16 = tail call i32 @search(i32 noundef %12, i32 noundef %15)
%call17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %call16)
%.pre = load i32, ptr @h, align 4, !tbaa !10
br label %for.inc18
for.inc18: ; preds = %for.body9, %if.then
%16 = phi i32 [ %13, %for.body9 ], [ %.pre, %if.then ]
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%17 = sext i32 %16 to i64
%cmp8 = icmp slt i64 %indvars.iv.next49, %17
br i1 %cmp8, label %for.body9, label %for.inc21.loopexit, !llvm.loop !13
for.inc21.loopexit: ; preds = %for.inc18
%.pre54 = load i32, ptr @w, align 4, !tbaa !10
br label %for.inc21
for.inc21: ; preds = %for.inc21.loopexit, %for.cond7.preheader
%18 = phi i32 [ %.pre54, %for.inc21.loopexit ], [ %9, %for.cond7.preheader ]
%19 = phi i32 [ %16, %for.inc21.loopexit ], [ %10, %for.cond7.preheader ]
%20 = phi i32 [ %16, %for.inc21.loopexit ], [ %11, %for.cond7.preheader ]
%indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
%21 = sext i32 %18 to i64
%cmp5 = icmp slt i64 %indvars.iv.next52, %21
br i1 %cmp5, label %for.cond7.preheader, label %while.cond.loopexit, !llvm.loop !14
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 #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = distinct !{!12, !9}
!13 = distinct !{!13, !9}
!14 = distinct !{!14, !9, !15}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
|
#include<stdio.h>
#include<stdlib.h>
const int INF = 10000000;
int W, H, bx, by;
char tile[22][22];
int d[22][22];
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
void bfs();
void solve();
int main(void){
int i, j;
while(scanf("%d%d", &W, &H) && W && H){
//scanf("%d%d", &W, &H);
for(i = 0 ; i < H; i++){
scanf("%s", tile[i]);
}
for(i = 0; i < W; i++){
for(j = 0; j < H; j++){
if(tile[j][i] == '@'){
bx = i;
by = j;
}
}
}
//printf("%d %d\n", bx, by);
solve();
}
return 0;
}
void bfs(){
struct pair{
int first;
int second;
};
struct queue{
struct pair P[401];
int head;
int tail;
};
struct queue que;
que.head = 0;
que.tail = 0;
int i, j;
for(i = 0; i < W; i++){
for(j = 0; j < H; j++){
d[j][i] = INF;
}
}
que.P[que.tail].first = bx;
que.P[que.tail].second = by;
d[by][bx] = 0;
que.tail++;
//que.head++;
while(que.head < que.tail){
struct pair state;
state.first = que.P[que.head].first;
state.second = que.P[que.head].second;
que.head++;
//printf("%d %d\n" ,que.head, que.tail);
//if(p.first == gx && p.second == gy) break;
for(i = 0; i < 4; i++){
int nx = state.first + dx[i], ny = state.second + dy[i];
if(0 <= nx && nx < W && 0 <= ny && ny < H && tile[ny][nx] != '#' && d[ny][nx] == INF){
que.P[que.tail].first = nx;
que.P[que.tail].second = ny;
que.tail++;
d[ny][nx] = d[state.first][state.second] + 1;
}
}
}
//return d[gx][gy];
}
void solve(){
bfs();
int ans = 0, i, j;
for(i = 0; i < W; i++){
for(j = 0; j < H; j++){
if(d[j][i] != INF) ans++;
}
}
printf("%d\n", ans);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322179/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322179/source.c"
target datalayout = "e-m:e-p270: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.queue = type { [401 x %struct.pair], i32, i32 }
%struct.pair = type { i32, i32 }
@INF = dso_local local_unnamed_addr constant i32 10000000, align 4
@dx = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 0, i32 -1, i32 0], align 16
@dy = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 1, i32 0, i32 -1], align 16
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@W = dso_local global i32 0, align 4
@H = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@tile = dso_local global [22 x [22 x i8]] zeroinitializer, align 16
@bx = dso_local local_unnamed_addr global i32 0, align 4
@by = dso_local local_unnamed_addr global i32 0, align 4
@d = dso_local local_unnamed_addr global [22 x [22 x i32]] zeroinitializer, align 16
@.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:
%call38 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @W, ptr noundef nonnull @H)
%tobool39 = icmp ne i32 %call38, 0
%0 = load i32, ptr @W, align 4
%tobool140 = icmp ne i32 %0, 0
%or.cond41 = select i1 %tobool39, i1 %tobool140, i1 false
%1 = load i32, ptr @H, align 4
%tobool242 = icmp ne i32 %1, 0
%or.cond2243 = select i1 %or.cond41, i1 %tobool242, i1 false
br i1 %or.cond2243, label %for.cond.preheader, label %while.end
for.cond.preheader: ; preds = %entry, %solve.exit
%2 = phi i32 [ %58, %solve.exit ], [ %0, %entry ]
%3 = phi i32 [ %59, %solve.exit ], [ %1, %entry ]
%cmp32 = icmp sgt i32 %3, 0
br i1 %cmp32, label %for.body, label %for.cond4.preheader
for.cond4.preheader.loopexit: ; preds = %for.body
%.pre = load i32, ptr @W, align 4, !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond4.preheader.loopexit, %for.cond.preheader
%4 = phi i32 [ %2, %for.cond.preheader ], [ %.pre, %for.cond4.preheader.loopexit ]
%.lcssa = phi i32 [ %3, %for.cond.preheader ], [ %13, %for.cond4.preheader.loopexit ]
%cmp536 = icmp sgt i32 %4, 0
%cmp834 = icmp sgt i32 %.lcssa, 0
%or.cond56 = and i1 %cmp536, %cmp834
br i1 %or.cond56, label %for.cond7.preheader.us.preheader, label %for.end21
for.cond7.preheader.us.preheader: ; preds = %for.cond4.preheader
%wide.trip.count53 = zext i32 %4 to i64
%wide.trip.count = zext i32 %.lcssa to i64
%xtraiter = and i64 %wide.trip.count, 1
%5 = icmp eq i32 %.lcssa, 1
%unroll_iter = and i64 %wide.trip.count, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond7.preheader.us
for.cond7.preheader.us: ; preds = %for.cond7.preheader.us.preheader, %for.cond7.for.inc19_crit_edge.us
%indvars.iv50 = phi i64 [ 0, %for.cond7.preheader.us.preheader ], [ %indvars.iv.next51, %for.cond7.for.inc19_crit_edge.us ]
%6 = trunc i64 %indvars.iv50 to i32
br i1 %5, label %for.cond7.for.inc19_crit_edge.us.unr-lcssa, label %for.body9.us
for.body9.us: ; preds = %for.cond7.preheader.us, %for.inc16.us.1
%indvars.iv47 = phi i64 [ %indvars.iv.next48.1, %for.inc16.us.1 ], [ 0, %for.cond7.preheader.us ]
%niter = phi i64 [ %niter.next.1, %for.inc16.us.1 ], [ 0, %for.cond7.preheader.us ]
%arrayidx13.us = getelementptr inbounds [22 x [22 x i8]], ptr @tile, i64 0, i64 %indvars.iv47, i64 %indvars.iv50
%7 = load i8, ptr %arrayidx13.us, align 1, !tbaa !9
%cmp14.us = icmp eq i8 %7, 64
br i1 %cmp14.us, label %if.then.us, label %for.inc16.us
if.then.us: ; preds = %for.body9.us
store i32 %6, ptr @bx, align 4, !tbaa !5
%8 = trunc i64 %indvars.iv47 to i32
store i32 %8, ptr @by, align 4, !tbaa !5
br label %for.inc16.us
for.inc16.us: ; preds = %if.then.us, %for.body9.us
%indvars.iv.next48 = or i64 %indvars.iv47, 1
%arrayidx13.us.1 = getelementptr inbounds [22 x [22 x i8]], ptr @tile, i64 0, i64 %indvars.iv.next48, i64 %indvars.iv50
%9 = load i8, ptr %arrayidx13.us.1, align 1, !tbaa !9
%cmp14.us.1 = icmp eq i8 %9, 64
br i1 %cmp14.us.1, label %if.then.us.1, label %for.inc16.us.1
if.then.us.1: ; preds = %for.inc16.us
store i32 %6, ptr @bx, align 4, !tbaa !5
%10 = trunc i64 %indvars.iv.next48 to i32
store i32 %10, ptr @by, align 4, !tbaa !5
br label %for.inc16.us.1
for.inc16.us.1: ; preds = %if.then.us.1, %for.inc16.us
%indvars.iv.next48.1 = add nuw nsw i64 %indvars.iv47, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond7.for.inc19_crit_edge.us.unr-lcssa, label %for.body9.us, !llvm.loop !10
for.cond7.for.inc19_crit_edge.us.unr-lcssa: ; preds = %for.inc16.us.1, %for.cond7.preheader.us
%indvars.iv47.unr = phi i64 [ 0, %for.cond7.preheader.us ], [ %indvars.iv.next48.1, %for.inc16.us.1 ]
br i1 %lcmp.mod.not, label %for.cond7.for.inc19_crit_edge.us, label %for.body9.us.epil
for.body9.us.epil: ; preds = %for.cond7.for.inc19_crit_edge.us.unr-lcssa
%arrayidx13.us.epil = getelementptr inbounds [22 x [22 x i8]], ptr @tile, i64 0, i64 %indvars.iv47.unr, i64 %indvars.iv50
%11 = load i8, ptr %arrayidx13.us.epil, align 1, !tbaa !9
%cmp14.us.epil = icmp eq i8 %11, 64
br i1 %cmp14.us.epil, label %if.then.us.epil, label %for.cond7.for.inc19_crit_edge.us
if.then.us.epil: ; preds = %for.body9.us.epil
store i32 %6, ptr @bx, align 4, !tbaa !5
%12 = trunc i64 %indvars.iv47.unr to i32
store i32 %12, ptr @by, align 4, !tbaa !5
br label %for.cond7.for.inc19_crit_edge.us
for.cond7.for.inc19_crit_edge.us: ; preds = %for.body9.us.epil, %if.then.us.epil, %for.cond7.for.inc19_crit_edge.us.unr-lcssa
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%exitcond54.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count53
br i1 %exitcond54.not, label %for.end21, label %for.cond7.preheader.us, !llvm.loop !12
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [22 x [22 x i8]], ptr @tile, i64 0, i64 %indvars.iv
%call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%13 = load i32, ptr @H, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp = icmp slt i64 %indvars.iv.next, %14
br i1 %cmp, label %for.body, label %for.cond4.preheader.loopexit, !llvm.loop !13
for.end21: ; preds = %for.cond7.for.inc19_crit_edge.us, %for.cond4.preheader
tail call void @bfs()
%15 = load i32, ptr @W, align 4, !tbaa !5
%cmp19.i = icmp sgt i32 %15, 0
br i1 %cmp19.i, label %for.cond1.preheader.lr.ph.i, label %solve.exit
for.cond1.preheader.lr.ph.i: ; preds = %for.end21
%16 = load i32, ptr @H, align 4, !tbaa !5
%cmp216.i = icmp sgt i32 %16, 0
br i1 %cmp216.i, label %for.cond1.preheader.us.preheader.i, label %solve.exit
for.cond1.preheader.us.preheader.i: ; preds = %for.cond1.preheader.lr.ph.i
%wide.trip.count28.i = zext i32 %15 to i64
%wide.trip.count.i = zext i32 %16 to i64
%min.iters.check = icmp ult i32 %16, 8
%n.vec = and i64 %wide.trip.count.i, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br label %for.cond1.preheader.us.i
for.cond1.preheader.us.i: ; preds = %for.cond1.for.inc8_crit_edge.us.i, %for.cond1.preheader.us.preheader.i
%indvars.iv25.i = phi i64 [ 0, %for.cond1.preheader.us.preheader.i ], [ %indvars.iv.next26.i, %for.cond1.for.inc8_crit_edge.us.i ]
%ans.020.us.i = phi i32 [ 0, %for.cond1.preheader.us.preheader.i ], [ %spec.select.us.i.lcssa, %for.cond1.for.inc8_crit_edge.us.i ]
br i1 %min.iters.check, label %for.body3.us.i.preheader, label %vector.ph
vector.ph: ; preds = %for.cond1.preheader.us.i
%17 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %ans.020.us.i, i64 0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %17, %vector.ph ], [ %53, %vector.body ]
%vec.phi58 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %54, %vector.body ]
%18 = or i64 %index, 1
%19 = or i64 %index, 2
%20 = or i64 %index, 3
%21 = or i64 %index, 4
%22 = or i64 %index, 5
%23 = or i64 %index, 6
%24 = or i64 %index, 7
%25 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %index, i64 %indvars.iv25.i
%26 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %18, i64 %indvars.iv25.i
%27 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %19, i64 %indvars.iv25.i
%28 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %20, i64 %indvars.iv25.i
%29 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %21, i64 %indvars.iv25.i
%30 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %22, i64 %indvars.iv25.i
%31 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %23, i64 %indvars.iv25.i
%32 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %24, i64 %indvars.iv25.i
%33 = load i32, ptr %25, align 4, !tbaa !5
%34 = load i32, ptr %26, align 4, !tbaa !5
%35 = load i32, ptr %27, align 4, !tbaa !5
%36 = load i32, ptr %28, align 4, !tbaa !5
%37 = insertelement <4 x i32> poison, i32 %33, i64 0
%38 = insertelement <4 x i32> %37, i32 %34, i64 1
%39 = insertelement <4 x i32> %38, i32 %35, i64 2
%40 = insertelement <4 x i32> %39, i32 %36, i64 3
%41 = load i32, ptr %29, align 4, !tbaa !5
%42 = load i32, ptr %30, align 4, !tbaa !5
%43 = load i32, ptr %31, align 4, !tbaa !5
%44 = load i32, ptr %32, align 4, !tbaa !5
%45 = insertelement <4 x i32> poison, i32 %41, i64 0
%46 = insertelement <4 x i32> %45, i32 %42, i64 1
%47 = insertelement <4 x i32> %46, i32 %43, i64 2
%48 = insertelement <4 x i32> %47, i32 %44, i64 3
%49 = icmp ne <4 x i32> %40, <i32 10000000, i32 10000000, i32 10000000, i32 10000000>
%50 = icmp ne <4 x i32> %48, <i32 10000000, i32 10000000, i32 10000000, i32 10000000>
%51 = zext <4 x i1> %49 to <4 x i32>
%52 = zext <4 x i1> %50 to <4 x i32>
%53 = add <4 x i32> %vec.phi, %51
%54 = add <4 x i32> %vec.phi58, %52
%index.next = add nuw i64 %index, 8
%55 = icmp eq i64 %index.next, %n.vec
br i1 %55, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %54, %53
%56 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond1.for.inc8_crit_edge.us.i, label %for.body3.us.i.preheader
for.body3.us.i.preheader: ; preds = %for.cond1.preheader.us.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %for.cond1.preheader.us.i ], [ %n.vec, %middle.block ]
%ans.117.us.i.ph = phi i32 [ %ans.020.us.i, %for.cond1.preheader.us.i ], [ %56, %middle.block ]
br label %for.body3.us.i
for.body3.us.i: ; preds = %for.body3.us.i.preheader, %for.body3.us.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body3.us.i ], [ %indvars.iv.i.ph, %for.body3.us.i.preheader ]
%ans.117.us.i = phi i32 [ %spec.select.us.i, %for.body3.us.i ], [ %ans.117.us.i.ph, %for.body3.us.i.preheader ]
%arrayidx5.us.i = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %indvars.iv.i, i64 %indvars.iv25.i
%57 = load i32, ptr %arrayidx5.us.i, align 4, !tbaa !5
%cmp6.not.us.i = icmp ne i32 %57, 10000000
%inc.us.i = zext i1 %cmp6.not.us.i to i32
%spec.select.us.i = add nsw i32 %ans.117.us.i, %inc.us.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %for.cond1.for.inc8_crit_edge.us.i, label %for.body3.us.i, !llvm.loop !17
for.cond1.for.inc8_crit_edge.us.i: ; preds = %for.body3.us.i, %middle.block
%spec.select.us.i.lcssa = phi i32 [ %56, %middle.block ], [ %spec.select.us.i, %for.body3.us.i ]
%indvars.iv.next26.i = add nuw nsw i64 %indvars.iv25.i, 1
%exitcond29.not.i = icmp eq i64 %indvars.iv.next26.i, %wide.trip.count28.i
br i1 %exitcond29.not.i, label %solve.exit, label %for.cond1.preheader.us.i, !llvm.loop !18
solve.exit: ; preds = %for.cond1.for.inc8_crit_edge.us.i, %for.end21, %for.cond1.preheader.lr.ph.i
%ans.0.lcssa.i = phi i32 [ 0, %for.end21 ], [ 0, %for.cond1.preheader.lr.ph.i ], [ %spec.select.us.i.lcssa, %for.cond1.for.inc8_crit_edge.us.i ]
%call.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa.i)
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @W, ptr noundef nonnull @H)
%tobool = icmp ne i32 %call, 0
%58 = load i32, ptr @W, align 4
%tobool1 = icmp ne i32 %58, 0
%or.cond = select i1 %tobool, i1 %tobool1, i1 false
%59 = load i32, ptr @H, align 4
%tobool2 = icmp ne i32 %59, 0
%or.cond22 = select i1 %or.cond, i1 %tobool2, i1 false
br i1 %or.cond22, label %for.cond.preheader, label %while.end, !llvm.loop !19
while.end: ; preds = %solve.exit, %entry
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @bfs() local_unnamed_addr #3 {
entry:
%que = alloca %struct.queue, align 4
call void @llvm.lifetime.start.p0(i64 3216, ptr nonnull %que) #5
%0 = load i32, ptr @W, align 4, !tbaa !5
%cmp118 = icmp sgt i32 %0, 0
br i1 %cmp118, label %for.cond1.preheader.lr.ph, label %while.body.lr.ph
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr @H, align 4, !tbaa !5
%cmp2116 = icmp sgt i32 %1, 0
br i1 %cmp2116, label %for.cond1.preheader.us.preheader, label %while.body.lr.ph
for.cond1.preheader.us.preheader: ; preds = %for.cond1.preheader.lr.ph
%wide.trip.count137 = zext i32 %0 to i64
%wide.trip.count = zext i32 %1 to i64
%xtraiter = and i64 %wide.trip.count, 3
%2 = icmp ult i32 %1, 4
%unroll_iter = and i64 %wide.trip.count, 4294967292
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc6_crit_edge.us
%indvars.iv134 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next135, %for.cond1.for.inc6_crit_edge.us ]
br i1 %2, label %for.cond1.for.inc6_crit_edge.us.unr-lcssa, label %for.body3.us
for.body3.us: ; preds = %for.cond1.preheader.us, %for.body3.us
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body3.us ], [ 0, %for.cond1.preheader.us ]
%niter = phi i64 [ %niter.next.3, %for.body3.us ], [ 0, %for.cond1.preheader.us ]
%arrayidx5.us = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %indvars.iv, i64 %indvars.iv134
store i32 10000000, ptr %arrayidx5.us, align 4, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx5.us.1 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %indvars.iv.next, i64 %indvars.iv134
store i32 10000000, ptr %arrayidx5.us.1, align 4, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx5.us.2 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %indvars.iv.next.1, i64 %indvars.iv134
store i32 10000000, ptr %arrayidx5.us.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx5.us.3 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %indvars.iv.next.2, i64 %indvars.iv134
store i32 10000000, ptr %arrayidx5.us.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond1.for.inc6_crit_edge.us.unr-lcssa, label %for.body3.us, !llvm.loop !20
for.cond1.for.inc6_crit_edge.us.unr-lcssa: ; preds = %for.body3.us, %for.cond1.preheader.us
%indvars.iv.unr = phi i64 [ 0, %for.cond1.preheader.us ], [ %indvars.iv.next.3, %for.body3.us ]
br i1 %lcmp.mod.not, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.epil
for.body3.us.epil: ; preds = %for.cond1.for.inc6_crit_edge.us.unr-lcssa, %for.body3.us.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body3.us.epil ], [ %indvars.iv.unr, %for.cond1.for.inc6_crit_edge.us.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body3.us.epil ], [ 0, %for.cond1.for.inc6_crit_edge.us.unr-lcssa ]
%arrayidx5.us.epil = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %indvars.iv.epil, i64 %indvars.iv134
store i32 10000000, ptr %arrayidx5.us.epil, align 4, !tbaa !5
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us.epil, !llvm.loop !21
for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us.epil, %for.cond1.for.inc6_crit_edge.us.unr-lcssa
%indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 1
%exitcond138.not = icmp eq i64 %indvars.iv.next135, %wide.trip.count137
br i1 %exitcond138.not, label %while.body.lr.ph, label %for.cond1.preheader.us, !llvm.loop !23
while.body.lr.ph: ; preds = %for.cond1.for.inc6_crit_edge.us, %entry, %for.cond1.preheader.lr.ph
%3 = load i32, ptr @bx, align 4, !tbaa !5
store i32 %3, ptr %que, align 4, !tbaa !24
%4 = load i32, ptr @by, align 4, !tbaa !5
%second = getelementptr inbounds [401 x %struct.pair], ptr %que, i64 0, i64 0, i32 1
store i32 %4, ptr %second, align 4, !tbaa !26
%idxprom16 = sext i32 %4 to i64
%idxprom18 = sext i32 %3 to i64
%arrayidx19 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %idxprom16, i64 %idxprom18
store i32 0, ptr %arrayidx19, align 4, !tbaa !5
%5 = load i32, ptr @H, align 4
%.pre = load i32, ptr @dx, align 16, !tbaa !5
%.pre146 = load i32, ptr @dy, align 16, !tbaa !5
%6 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 1), align 4, !tbaa !5
%7 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 1), align 4, !tbaa !5
%8 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 2), align 8, !tbaa !5
%9 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 2), align 8, !tbaa !5
%10 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dx, i64 0, i64 3), align 4, !tbaa !5
%11 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @dy, i64 0, i64 3), align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end.3
%indvars.iv143 = phi i64 [ 0, %while.body.lr.ph ], [ %indvars.iv.next144, %if.end.3 ]
%inc80121.lcssa126128 = phi i32 [ 1, %while.body.lr.ph ], [ %inc80120.3, %if.end.3 ]
%arrayidx28 = getelementptr inbounds [401 x %struct.pair], ptr %que, i64 0, i64 %indvars.iv143
%12 = load i32, ptr %arrayidx28, align 4, !tbaa !24
%second35 = getelementptr inbounds [401 x %struct.pair], ptr %que, i64 0, i64 %indvars.iv143, i32 1
%13 = load i32, ptr %second35, align 4, !tbaa !26
%idxprom82 = sext i32 %12 to i64
%idxprom85 = sext i32 %13 to i64
%arrayidx86 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %idxprom82, i64 %idxprom85
%add = add nsw i32 %.pre, %12
%add48 = add nsw i32 %.pre146, %13
%cmp49 = icmp sgt i32 %add, -1
br i1 %cmp49, label %land.lhs.true, label %if.end
land.lhs.true: ; preds = %while.body
%cmp50 = icmp slt i32 %add, %0
%cmp52 = icmp sgt i32 %add48, -1
%or.cond = select i1 %cmp50, i1 %cmp52, i1 false
%cmp54 = icmp slt i32 %add48, %5
%or.cond115 = select i1 %or.cond, i1 %cmp54, i1 false
br i1 %or.cond115, label %land.lhs.true55, label %if.end
land.lhs.true55: ; preds = %land.lhs.true
%idxprom56 = zext i32 %add48 to i64
%idxprom58 = zext i32 %add to i64
%arrayidx59 = getelementptr inbounds [22 x [22 x i8]], ptr @tile, i64 0, i64 %idxprom56, i64 %idxprom58
%14 = load i8, ptr %arrayidx59, align 1, !tbaa !9
%cmp60.not = icmp eq i8 %14, 35
br i1 %cmp60.not, label %if.end, label %land.lhs.true62
land.lhs.true62: ; preds = %land.lhs.true55
%arrayidx66 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %idxprom56, i64 %idxprom58
%15 = load i32, ptr %arrayidx66, align 4, !tbaa !5
%cmp67 = icmp eq i32 %15, 10000000
br i1 %cmp67, label %if.then, label %if.end
if.then: ; preds = %land.lhs.true62
%idxprom71 = sext i32 %inc80121.lcssa126128 to i64
%arrayidx72 = getelementptr inbounds [401 x %struct.pair], ptr %que, i64 0, i64 %idxprom71
store i32 %add, ptr %arrayidx72, align 4, !tbaa !24
%second78 = getelementptr inbounds [401 x %struct.pair], ptr %que, i64 0, i64 %idxprom71, i32 1
store i32 %add48, ptr %second78, align 4, !tbaa !26
%inc80 = add nsw i32 %inc80121.lcssa126128, 1
%16 = load i32, ptr %arrayidx86, align 4, !tbaa !5
%add87 = add nsw i32 %16, 1
store i32 %add87, ptr %arrayidx66, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %land.lhs.true62, %land.lhs.true55, %land.lhs.true, %while.body
%inc80120 = phi i32 [ %inc80, %if.then ], [ %inc80121.lcssa126128, %land.lhs.true62 ], [ %inc80121.lcssa126128, %land.lhs.true55 ], [ %inc80121.lcssa126128, %land.lhs.true ], [ %inc80121.lcssa126128, %while.body ]
%add.1 = add nsw i32 %6, %12
%add48.1 = add nsw i32 %7, %13
%cmp49.1 = icmp sgt i32 %add.1, -1
br i1 %cmp49.1, label %land.lhs.true.1, label %if.end.1
land.lhs.true.1: ; preds = %if.end
%cmp50.1 = icmp slt i32 %add.1, %0
%cmp52.1 = icmp sgt i32 %add48.1, -1
%or.cond.1 = select i1 %cmp50.1, i1 %cmp52.1, i1 false
%cmp54.1 = icmp slt i32 %add48.1, %5
%or.cond115.1 = select i1 %or.cond.1, i1 %cmp54.1, i1 false
br i1 %or.cond115.1, label %land.lhs.true55.1, label %if.end.1
land.lhs.true55.1: ; preds = %land.lhs.true.1
%idxprom56.1 = zext i32 %add48.1 to i64
%idxprom58.1 = zext i32 %add.1 to i64
%arrayidx59.1 = getelementptr inbounds [22 x [22 x i8]], ptr @tile, i64 0, i64 %idxprom56.1, i64 %idxprom58.1
%17 = load i8, ptr %arrayidx59.1, align 1, !tbaa !9
%cmp60.not.1 = icmp eq i8 %17, 35
br i1 %cmp60.not.1, label %if.end.1, label %land.lhs.true62.1
land.lhs.true62.1: ; preds = %land.lhs.true55.1
%arrayidx66.1 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %idxprom56.1, i64 %idxprom58.1
%18 = load i32, ptr %arrayidx66.1, align 4, !tbaa !5
%cmp67.1 = icmp eq i32 %18, 10000000
br i1 %cmp67.1, label %if.then.1, label %if.end.1
if.then.1: ; preds = %land.lhs.true62.1
%idxprom71.1 = sext i32 %inc80120 to i64
%arrayidx72.1 = getelementptr inbounds [401 x %struct.pair], ptr %que, i64 0, i64 %idxprom71.1
store i32 %add.1, ptr %arrayidx72.1, align 4, !tbaa !24
%second78.1 = getelementptr inbounds [401 x %struct.pair], ptr %que, i64 0, i64 %idxprom71.1, i32 1
store i32 %add48.1, ptr %second78.1, align 4, !tbaa !26
%inc80.1 = add nsw i32 %inc80120, 1
%19 = load i32, ptr %arrayidx86, align 4, !tbaa !5
%add87.1 = add nsw i32 %19, 1
store i32 %add87.1, ptr %arrayidx66.1, align 4, !tbaa !5
br label %if.end.1
if.end.1: ; preds = %if.then.1, %land.lhs.true62.1, %land.lhs.true55.1, %land.lhs.true.1, %if.end
%inc80120.1 = phi i32 [ %inc80.1, %if.then.1 ], [ %inc80120, %land.lhs.true62.1 ], [ %inc80120, %land.lhs.true55.1 ], [ %inc80120, %land.lhs.true.1 ], [ %inc80120, %if.end ]
%add.2 = add nsw i32 %8, %12
%add48.2 = add nsw i32 %9, %13
%cmp49.2 = icmp sgt i32 %add.2, -1
br i1 %cmp49.2, label %land.lhs.true.2, label %if.end.2
land.lhs.true.2: ; preds = %if.end.1
%cmp50.2 = icmp slt i32 %add.2, %0
%cmp52.2 = icmp sgt i32 %add48.2, -1
%or.cond.2 = select i1 %cmp50.2, i1 %cmp52.2, i1 false
%cmp54.2 = icmp slt i32 %add48.2, %5
%or.cond115.2 = select i1 %or.cond.2, i1 %cmp54.2, i1 false
br i1 %or.cond115.2, label %land.lhs.true55.2, label %if.end.2
land.lhs.true55.2: ; preds = %land.lhs.true.2
%idxprom56.2 = zext i32 %add48.2 to i64
%idxprom58.2 = zext i32 %add.2 to i64
%arrayidx59.2 = getelementptr inbounds [22 x [22 x i8]], ptr @tile, i64 0, i64 %idxprom56.2, i64 %idxprom58.2
%20 = load i8, ptr %arrayidx59.2, align 1, !tbaa !9
%cmp60.not.2 = icmp eq i8 %20, 35
br i1 %cmp60.not.2, label %if.end.2, label %land.lhs.true62.2
land.lhs.true62.2: ; preds = %land.lhs.true55.2
%arrayidx66.2 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %idxprom56.2, i64 %idxprom58.2
%21 = load i32, ptr %arrayidx66.2, align 4, !tbaa !5
%cmp67.2 = icmp eq i32 %21, 10000000
br i1 %cmp67.2, label %if.then.2, label %if.end.2
if.then.2: ; preds = %land.lhs.true62.2
%idxprom71.2 = sext i32 %inc80120.1 to i64
%arrayidx72.2 = getelementptr inbounds [401 x %struct.pair], ptr %que, i64 0, i64 %idxprom71.2
store i32 %add.2, ptr %arrayidx72.2, align 4, !tbaa !24
%second78.2 = getelementptr inbounds [401 x %struct.pair], ptr %que, i64 0, i64 %idxprom71.2, i32 1
store i32 %add48.2, ptr %second78.2, align 4, !tbaa !26
%inc80.2 = add nsw i32 %inc80120.1, 1
%22 = load i32, ptr %arrayidx86, align 4, !tbaa !5
%add87.2 = add nsw i32 %22, 1
store i32 %add87.2, ptr %arrayidx66.2, align 4, !tbaa !5
br label %if.end.2
if.end.2: ; preds = %if.then.2, %land.lhs.true62.2, %land.lhs.true55.2, %land.lhs.true.2, %if.end.1
%inc80120.2 = phi i32 [ %inc80.2, %if.then.2 ], [ %inc80120.1, %land.lhs.true62.2 ], [ %inc80120.1, %land.lhs.true55.2 ], [ %inc80120.1, %land.lhs.true.2 ], [ %inc80120.1, %if.end.1 ]
%add.3 = add nsw i32 %10, %12
%add48.3 = add nsw i32 %11, %13
%cmp49.3 = icmp sgt i32 %add.3, -1
br i1 %cmp49.3, label %land.lhs.true.3, label %if.end.3
land.lhs.true.3: ; preds = %if.end.2
%cmp50.3 = icmp slt i32 %add.3, %0
%cmp52.3 = icmp sgt i32 %add48.3, -1
%or.cond.3 = select i1 %cmp50.3, i1 %cmp52.3, i1 false
%cmp54.3 = icmp slt i32 %add48.3, %5
%or.cond115.3 = select i1 %or.cond.3, i1 %cmp54.3, i1 false
br i1 %or.cond115.3, label %land.lhs.true55.3, label %if.end.3
land.lhs.true55.3: ; preds = %land.lhs.true.3
%idxprom56.3 = zext i32 %add48.3 to i64
%idxprom58.3 = zext i32 %add.3 to i64
%arrayidx59.3 = getelementptr inbounds [22 x [22 x i8]], ptr @tile, i64 0, i64 %idxprom56.3, i64 %idxprom58.3
%23 = load i8, ptr %arrayidx59.3, align 1, !tbaa !9
%cmp60.not.3 = icmp eq i8 %23, 35
br i1 %cmp60.not.3, label %if.end.3, label %land.lhs.true62.3
land.lhs.true62.3: ; preds = %land.lhs.true55.3
%arrayidx66.3 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %idxprom56.3, i64 %idxprom58.3
%24 = load i32, ptr %arrayidx66.3, align 4, !tbaa !5
%cmp67.3 = icmp eq i32 %24, 10000000
br i1 %cmp67.3, label %if.then.3, label %if.end.3
if.then.3: ; preds = %land.lhs.true62.3
%idxprom71.3 = sext i32 %inc80120.2 to i64
%arrayidx72.3 = getelementptr inbounds [401 x %struct.pair], ptr %que, i64 0, i64 %idxprom71.3
store i32 %add.3, ptr %arrayidx72.3, align 4, !tbaa !24
%second78.3 = getelementptr inbounds [401 x %struct.pair], ptr %que, i64 0, i64 %idxprom71.3, i32 1
store i32 %add48.3, ptr %second78.3, align 4, !tbaa !26
%inc80.3 = add nsw i32 %inc80120.2, 1
%25 = load i32, ptr %arrayidx86, align 4, !tbaa !5
%add87.3 = add nsw i32 %25, 1
store i32 %add87.3, ptr %arrayidx66.3, align 4, !tbaa !5
br label %if.end.3
if.end.3: ; preds = %if.then.3, %land.lhs.true62.3, %land.lhs.true55.3, %land.lhs.true.3, %if.end.2
%inc80120.3 = phi i32 [ %inc80.3, %if.then.3 ], [ %inc80120.2, %land.lhs.true62.3 ], [ %inc80120.2, %land.lhs.true55.3 ], [ %inc80120.2, %land.lhs.true.3 ], [ %inc80120.2, %if.end.2 ]
%indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
%26 = sext i32 %inc80120.3 to i64
%cmp24 = icmp slt i64 %indvars.iv.next144, %26
br i1 %cmp24, label %while.body, label %while.end, !llvm.loop !27
while.end: ; preds = %if.end.3
call void @llvm.lifetime.end.p0(i64 3216, ptr nonnull %que) #5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @solve() local_unnamed_addr #0 {
entry:
tail call void @bfs()
%0 = load i32, ptr @W, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.cond1.preheader.lr.ph, label %for.end10
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr @H, align 4, !tbaa !5
%cmp216 = icmp sgt i32 %1, 0
br i1 %cmp216, label %for.cond1.preheader.us.preheader, label %for.end10
for.cond1.preheader.us.preheader: ; preds = %for.cond1.preheader.lr.ph
%wide.trip.count28 = zext i32 %0 to i64
%wide.trip.count = zext i32 %1 to i64
%min.iters.check = icmp ult i32 %1, 8
%n.vec = and i64 %wide.trip.count, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.cond1.for.inc8_crit_edge.us
%indvars.iv25 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next26, %for.cond1.for.inc8_crit_edge.us ]
%ans.020.us = phi i32 [ 0, %for.cond1.preheader.us.preheader ], [ %spec.select.us.lcssa, %for.cond1.for.inc8_crit_edge.us ]
br i1 %min.iters.check, label %for.body3.us.preheader, label %vector.ph
vector.ph: ; preds = %for.cond1.preheader.us
%2 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %ans.020.us, i64 0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %2, %vector.ph ], [ %38, %vector.body ]
%vec.phi30 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %39, %vector.body ]
%3 = or i64 %index, 1
%4 = or i64 %index, 2
%5 = or i64 %index, 3
%6 = or i64 %index, 4
%7 = or i64 %index, 5
%8 = or i64 %index, 6
%9 = or i64 %index, 7
%10 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %index, i64 %indvars.iv25
%11 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %3, i64 %indvars.iv25
%12 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %4, i64 %indvars.iv25
%13 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %5, i64 %indvars.iv25
%14 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %6, i64 %indvars.iv25
%15 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %7, i64 %indvars.iv25
%16 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %8, i64 %indvars.iv25
%17 = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %9, i64 %indvars.iv25
%18 = load i32, ptr %10, align 4, !tbaa !5
%19 = load i32, ptr %11, align 4, !tbaa !5
%20 = load i32, ptr %12, align 4, !tbaa !5
%21 = load i32, ptr %13, align 4, !tbaa !5
%22 = insertelement <4 x i32> poison, i32 %18, i64 0
%23 = insertelement <4 x i32> %22, i32 %19, i64 1
%24 = insertelement <4 x i32> %23, i32 %20, i64 2
%25 = insertelement <4 x i32> %24, i32 %21, i64 3
%26 = load i32, ptr %14, align 4, !tbaa !5
%27 = load i32, ptr %15, align 4, !tbaa !5
%28 = load i32, ptr %16, align 4, !tbaa !5
%29 = load i32, ptr %17, align 4, !tbaa !5
%30 = insertelement <4 x i32> poison, i32 %26, i64 0
%31 = insertelement <4 x i32> %30, i32 %27, i64 1
%32 = insertelement <4 x i32> %31, i32 %28, i64 2
%33 = insertelement <4 x i32> %32, i32 %29, i64 3
%34 = icmp ne <4 x i32> %25, <i32 10000000, i32 10000000, i32 10000000, i32 10000000>
%35 = icmp ne <4 x i32> %33, <i32 10000000, i32 10000000, i32 10000000, i32 10000000>
%36 = zext <4 x i1> %34 to <4 x i32>
%37 = zext <4 x i1> %35 to <4 x i32>
%38 = add <4 x i32> %vec.phi, %36
%39 = add <4 x i32> %vec.phi30, %37
%index.next = add nuw i64 %index, 8
%40 = icmp eq i64 %index.next, %n.vec
br i1 %40, label %middle.block, label %vector.body, !llvm.loop !28
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %39, %38
%41 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond1.for.inc8_crit_edge.us, label %for.body3.us.preheader
for.body3.us.preheader: ; preds = %for.cond1.preheader.us, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.cond1.preheader.us ], [ %n.vec, %middle.block ]
%ans.117.us.ph = phi i32 [ %ans.020.us, %for.cond1.preheader.us ], [ %41, %middle.block ]
br label %for.body3.us
for.body3.us: ; preds = %for.body3.us.preheader, %for.body3.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3.us ], [ %indvars.iv.ph, %for.body3.us.preheader ]
%ans.117.us = phi i32 [ %spec.select.us, %for.body3.us ], [ %ans.117.us.ph, %for.body3.us.preheader ]
%arrayidx5.us = getelementptr inbounds [22 x [22 x i32]], ptr @d, i64 0, i64 %indvars.iv, i64 %indvars.iv25
%42 = load i32, ptr %arrayidx5.us, align 4, !tbaa !5
%cmp6.not.us = icmp ne i32 %42, 10000000
%inc.us = zext i1 %cmp6.not.us to i32
%spec.select.us = add nsw i32 %ans.117.us, %inc.us
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond1.for.inc8_crit_edge.us, label %for.body3.us, !llvm.loop !29
for.cond1.for.inc8_crit_edge.us: ; preds = %for.body3.us, %middle.block
%spec.select.us.lcssa = phi i32 [ %41, %middle.block ], [ %spec.select.us, %for.body3.us ]
%indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1
%exitcond29.not = icmp eq i64 %indvars.iv.next26, %wide.trip.count28
br i1 %exitcond29.not, label %for.end10, label %for.cond1.preheader.us, !llvm.loop !18
for.end10: ; preds = %for.cond1.for.inc8_crit_edge.us, %for.cond1.preheader.lr.ph, %entry
%ans.0.lcssa = phi i32 [ 0, %entry ], [ 0, %for.cond1.preheader.lr.ph ], [ %spec.select.us.lcssa, %for.cond1.for.inc8_crit_edge.us ]
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
ret void
}
; 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>) #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, 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !11, !16, !15}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.unroll.disable"}
!23 = distinct !{!23, !11}
!24 = !{!25, !6, i64 0}
!25 = !{!"pair", !6, i64 0, !6, i64 4}
!26 = !{!25, !6, i64 4}
!27 = distinct !{!27, !11}
!28 = distinct !{!28, !11, !15, !16}
!29 = distinct !{!29, !11, !16, !15}
|
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
// 内部定数
#define D_MOD 1000000007 // 除数(10の9乗+7)
// 内部変数
static FILE *szpFpI; // 入力
// 内部変数 - テスト用
#ifdef D_TEST
static int siRes;
static FILE *szpFpA;
static int siTNo;
#endif
// 1行出力
int
fOutLine(
char *pcpLine // <I> 1行
)
{
char lc1Buf[1024];
#ifdef D_TEST
lc1Buf[0] = '\0';
fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
if (strcmp(lc1Buf, pcpLine)) {
siRes = -1;
}
#else
printf("%s", pcpLine);
#endif
return 0;
}
// 和 - 取得
int
fGetModSum(
int piVal1 // <I> 値1
, int piVal2 // <I> 値2
)
{
int liSum = piVal1 + piVal2;
if (liSum >= 0) {
return liSum % D_MOD;
}
else {
return liSum + D_MOD;
}
}
// 積 - 取得
int
fGetModMulti(
int piVal1 // <I> 値1
, int piVal2 // <I> 値2
)
{
return (int)((long long)piVal1 * (long long)piVal2 % D_MOD);
}
// べき乗 - 取得
int
fGetModPower(
int piBase // <I> 基数
, int piIdx // <I> 指数
)
{
// 基数
if (piBase == 0) {
return 0;
}
// 平方リスト - 作成
int li1Val[100];
li1Val[0] = piBase;
int liCnt = 1;
int liIdx = 1;
while (piIdx > liIdx) {
li1Val[liCnt] = fGetModMulti(li1Val[liCnt - 1], li1Val[liCnt - 1]);
liCnt++;
liIdx += liIdx;
}
// べき乗 - 取得
int liVal = 1;
while (piIdx > 0) {
if (piIdx >= liIdx) {
piIdx -= liIdx;
liVal = fGetModMulti(liVal, li1Val[liCnt - 1]);
}
liCnt--;
liIdx /= 2;
}
return liVal;
}
// 実行メイン
int
fMain(
)
{
char lc1Buf[1024];
// 配列数 - 取得
int liN;
fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
sscanf(lc1Buf, "%d", &liN);
// 全パターン
int liSum = fGetModPower(10, liN);
// 0なし(9なし)
int liCnt = fGetModPower(9, liN);
liSum = fGetModSum(liSum, -liCnt);
liSum = fGetModSum(liSum, -liCnt);
// 0,9なし
liCnt = fGetModPower(8, liN);
liSum = fGetModSum(liSum, liCnt);
return liSum;
}
// 1回実行
int
fOne(
)
{
int liRet;
char lc1Buf[1024];
// 入力 - セット
#ifdef D_TEST
sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
szpFpI = fopen(lc1Buf, "r");
sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
szpFpA = fopen(lc1Buf, "r");
siRes = 0;
#else
szpFpI = stdin;
#endif
// 実行メイン
liRet = fMain();
// 出力
sprintf(lc1Buf, "%d\n", liRet);
fOutLine(lc1Buf);
// 残データ有無
#ifdef D_TEST
lc1Buf[0] = '\0';
fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
if (strcmp(lc1Buf, "")) {
siRes = -1;
}
#endif
// テストファイルクローズ
#ifdef D_TEST
fclose(szpFpI);
fclose(szpFpA);
#endif
// テスト結果
#ifdef D_TEST
if (siRes == 0) {
printf("OK %d\n", siTNo);
}
else {
printf("NG %d\n", siTNo);
}
#endif
return 0;
}
// プログラム開始
int
main()
{
#ifdef D_TEST
int i;
for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
siTNo = i;
fOne();
}
#else
fOne();
#endif
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322258/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322258/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@szpFpI = internal unnamed_addr global ptr null, align 8
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @fOutLine(ptr noundef %pcpLine) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %pcpLine)
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree 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: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @fGetModSum(i32 noundef %piVal1, i32 noundef %piVal2) local_unnamed_addr #3 {
entry:
%add = add nsw i32 %piVal2, %piVal1
%cmp = icmp sgt i32 %add, -1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%rem = urem i32 %add, 1000000007
br label %cleanup
if.else: ; preds = %entry
%add1 = add nsw i32 %add, 1000000007
br label %cleanup
cleanup: ; preds = %if.else, %if.then
%retval.0 = phi i32 [ %rem, %if.then ], [ %add1, %if.else ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @fGetModMulti(i32 noundef %piVal1, i32 noundef %piVal2) local_unnamed_addr #3 {
entry:
%conv = sext i32 %piVal1 to i64
%conv1 = sext i32 %piVal2 to i64
%mul = mul nsw i64 %conv1, %conv
%rem = srem i64 %mul, 1000000007
%conv2 = trunc i64 %rem to i32
ret i32 %conv2
}
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @fGetModPower(i32 noundef %piBase, i32 noundef %piIdx) local_unnamed_addr #4 {
entry:
%li1Val = alloca [100 x i32], align 16
%cmp = icmp eq i32 %piBase, 0
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %li1Val) #5
store i32 %piBase, ptr %li1Val, align 16, !tbaa !5
%cmp140 = icmp sgt i32 %piIdx, 1
br i1 %cmp140, label %while.body, label %while.cond8.preheader
while.cond8.preheader.loopexit: ; preds = %while.body
%sext = shl i64 %indvars.iv.next, 32
%0 = ashr exact i64 %sext, 32
br label %while.cond8.preheader
while.cond8.preheader: ; preds = %while.cond8.preheader.loopexit, %if.end
%liCnt.0.lcssa = phi i64 [ 1, %if.end ], [ %0, %while.cond8.preheader.loopexit ]
%liIdx.0.lcssa = phi i32 [ 1, %if.end ], [ %add, %while.cond8.preheader.loopexit ]
%cmp944 = icmp sgt i32 %piIdx, 0
br i1 %cmp944, label %while.body10, label %while.end19
while.body: ; preds = %if.end, %while.body
%1 = phi i32 [ %conv2.i, %while.body ], [ %piBase, %if.end ]
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 1, %if.end ]
%liIdx.042 = phi i32 [ %add, %while.body ], [ 1, %if.end ]
%conv.i = sext i32 %1 to i64
%mul.i = mul nsw i64 %conv.i, %conv.i
%rem.i = urem i64 %mul.i, 1000000007
%conv2.i = trunc i64 %rem.i to i32
%arrayidx7 = getelementptr inbounds [100 x i32], ptr %li1Val, i64 0, i64 %indvars.iv
store i32 %conv2.i, ptr %arrayidx7, align 4, !tbaa !5
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%add = shl nsw i32 %liIdx.042, 1
%cmp1 = icmp slt i32 %add, %piIdx
br i1 %cmp1, label %while.body, label %while.cond8.preheader.loopexit, !llvm.loop !9
while.body10: ; preds = %while.cond8.preheader, %if.end18
%indvars.iv52 = phi i64 [ %indvars.iv.next53.pre-phi, %if.end18 ], [ %liCnt.0.lcssa, %while.cond8.preheader ]
%liVal.048 = phi i32 [ %liVal.1, %if.end18 ], [ 1, %while.cond8.preheader ]
%liIdx.147 = phi i32 [ %div, %if.end18 ], [ %liIdx.0.lcssa, %while.cond8.preheader ]
%piIdx.addr.045 = phi i32 [ %piIdx.addr.1, %if.end18 ], [ %piIdx, %while.cond8.preheader ]
%cmp11.not = icmp slt i32 %piIdx.addr.045, %liIdx.147
br i1 %cmp11.not, label %while.body10.if.end18_crit_edge, label %if.then12
while.body10.if.end18_crit_edge: ; preds = %while.body10
%.pre = add i64 %indvars.iv52, -1
br label %if.end18
if.then12: ; preds = %while.body10
%sub13 = sub nsw i32 %piIdx.addr.045, %liIdx.147
%2 = add i64 %indvars.iv52, -1
%arrayidx16 = getelementptr inbounds [100 x i32], ptr %li1Val, i64 0, i64 %2
%3 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%conv.i35 = sext i32 %liVal.048 to i64
%conv1.i36 = sext i32 %3 to i64
%mul.i37 = mul nsw i64 %conv1.i36, %conv.i35
%rem.i38 = srem i64 %mul.i37, 1000000007
%conv2.i39 = trunc i64 %rem.i38 to i32
br label %if.end18
if.end18: ; preds = %while.body10.if.end18_crit_edge, %if.then12
%indvars.iv.next53.pre-phi = phi i64 [ %.pre, %while.body10.if.end18_crit_edge ], [ %2, %if.then12 ]
%piIdx.addr.1 = phi i32 [ %piIdx.addr.045, %while.body10.if.end18_crit_edge ], [ %sub13, %if.then12 ]
%liVal.1 = phi i32 [ %liVal.048, %while.body10.if.end18_crit_edge ], [ %conv2.i39, %if.then12 ]
%div = sdiv i32 %liIdx.147, 2
%cmp9 = icmp sgt i32 %piIdx.addr.1, 0
br i1 %cmp9, label %while.body10, label %while.end19, !llvm.loop !11
while.end19: ; preds = %if.end18, %while.cond8.preheader
%liVal.0.lcssa = phi i32 [ 1, %while.cond8.preheader ], [ %liVal.1, %if.end18 ]
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %li1Val) #5
br label %return
return: ; preds = %entry, %while.end19
%retval.0 = phi i32 [ %liVal.0.lcssa, %while.end19 ], [ 0, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @fMain() local_unnamed_addr #0 {
entry:
%li1Val.i67 = alloca [100 x i32], align 16
%li1Val.i15 = alloca [100 x i32], align 16
%li1Val.i = alloca [100 x i32], align 16
%lc1Buf = alloca [1024 x i8], align 16
%liN = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %lc1Buf) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %liN) #5
%0 = load ptr, ptr @szpFpI, align 8, !tbaa !12
%call = call ptr @fgets(ptr noundef nonnull %lc1Buf, i32 noundef 1024, ptr noundef %0)
%call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %lc1Buf, ptr noundef nonnull @.str.1, ptr noundef nonnull %liN) #5
%1 = load i32, ptr %liN, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %li1Val.i) #5
store i32 10, ptr %li1Val.i, align 16, !tbaa !5
%cmp140.i = icmp sgt i32 %1, 1
br i1 %cmp140.i, label %while.body.i, label %while.cond8.preheader.i
while.cond8.preheader.loopexit.i: ; preds = %while.body.i
%sext.i = shl i64 %indvars.iv.next.i, 32
%2 = ashr exact i64 %sext.i, 32
br label %while.cond8.preheader.i
while.cond8.preheader.i: ; preds = %while.cond8.preheader.loopexit.i, %entry
%liCnt.0.lcssa.i = phi i64 [ 1, %entry ], [ %2, %while.cond8.preheader.loopexit.i ]
%liIdx.0.lcssa.i = phi i32 [ 1, %entry ], [ %add.i, %while.cond8.preheader.loopexit.i ]
%cmp944.i = icmp sgt i32 %1, 0
br i1 %cmp944.i, label %while.body10.i, label %while.cond8.preheader.i17.thread
while.cond8.preheader.i17.thread: ; preds = %while.cond8.preheader.i
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %li1Val.i) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %li1Val.i15) #5
br label %fGetModPower.exit57
while.body.i: ; preds = %entry, %while.body.i
%conv.i.i = phi i64 [ %rem.i.i, %while.body.i ], [ 10, %entry ]
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %while.body.i ], [ 1, %entry ]
%liIdx.042.i = phi i32 [ %add.i, %while.body.i ], [ 1, %entry ]
%mul.i.i = mul nuw nsw i64 %conv.i.i, %conv.i.i
%rem.i.i = urem i64 %mul.i.i, 1000000007
%conv2.i.i = trunc i64 %rem.i.i to i32
%arrayidx7.i = getelementptr inbounds [100 x i32], ptr %li1Val.i, i64 0, i64 %indvars.iv.i
store i32 %conv2.i.i, ptr %arrayidx7.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
%add.i = shl nsw i32 %liIdx.042.i, 1
%cmp1.i = icmp slt i32 %add.i, %1
br i1 %cmp1.i, label %while.body.i, label %while.cond8.preheader.loopexit.i, !llvm.loop !9
while.body10.i: ; preds = %while.cond8.preheader.i, %if.end18.i
%indvars.iv52.i = phi i64 [ %indvars.iv.next53.pre-phi.i, %if.end18.i ], [ %liCnt.0.lcssa.i, %while.cond8.preheader.i ]
%liVal.048.i = phi i32 [ %liVal.1.i, %if.end18.i ], [ 1, %while.cond8.preheader.i ]
%liIdx.147.i = phi i32 [ %div.i, %if.end18.i ], [ %liIdx.0.lcssa.i, %while.cond8.preheader.i ]
%piIdx.addr.045.i = phi i32 [ %piIdx.addr.1.i, %if.end18.i ], [ %1, %while.cond8.preheader.i ]
%cmp11.not.i = icmp slt i32 %piIdx.addr.045.i, %liIdx.147.i
br i1 %cmp11.not.i, label %while.body10.if.end18_crit_edge.i, label %if.then12.i
while.body10.if.end18_crit_edge.i: ; preds = %while.body10.i
%.pre.i = add i64 %indvars.iv52.i, -1
br label %if.end18.i
if.then12.i: ; preds = %while.body10.i
%sub13.i = sub nsw i32 %piIdx.addr.045.i, %liIdx.147.i
%3 = add i64 %indvars.iv52.i, -1
%arrayidx16.i = getelementptr inbounds [100 x i32], ptr %li1Val.i, i64 0, i64 %3
%4 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
%conv.i35.i = sext i32 %liVal.048.i to i64
%conv1.i36.i = sext i32 %4 to i64
%mul.i37.i = mul nsw i64 %conv1.i36.i, %conv.i35.i
%rem.i38.i = srem i64 %mul.i37.i, 1000000007
%conv2.i39.i = trunc i64 %rem.i38.i to i32
br label %if.end18.i
if.end18.i: ; preds = %if.then12.i, %while.body10.if.end18_crit_edge.i
%indvars.iv.next53.pre-phi.i = phi i64 [ %.pre.i, %while.body10.if.end18_crit_edge.i ], [ %3, %if.then12.i ]
%piIdx.addr.1.i = phi i32 [ %piIdx.addr.045.i, %while.body10.if.end18_crit_edge.i ], [ %sub13.i, %if.then12.i ]
%liVal.1.i = phi i32 [ %liVal.048.i, %while.body10.if.end18_crit_edge.i ], [ %conv2.i39.i, %if.then12.i ]
%div.i = sdiv i32 %liIdx.147.i, 2
%cmp9.i = icmp sgt i32 %piIdx.addr.1.i, 0
br i1 %cmp9.i, label %while.body10.i, label %fGetModPower.exit, !llvm.loop !11
fGetModPower.exit: ; preds = %if.end18.i
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %li1Val.i) #5
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %li1Val.i15) #5
store i32 9, ptr %li1Val.i15, align 16, !tbaa !5
br i1 %cmp140.i, label %while.body.i44, label %while.body10.i22.preheader
while.cond8.preheader.loopexit.i55: ; preds = %while.body.i44
%sext.i56 = shl i64 %indvars.iv.next.i52, 32
%5 = ashr exact i64 %sext.i56, 32
br label %while.body10.i22.preheader
while.body10.i22.preheader: ; preds = %fGetModPower.exit, %while.cond8.preheader.loopexit.i55
%indvars.iv52.i23.ph = phi i64 [ %5, %while.cond8.preheader.loopexit.i55 ], [ 1, %fGetModPower.exit ]
%liIdx.147.i25.ph = phi i32 [ %add.i53, %while.cond8.preheader.loopexit.i55 ], [ 1, %fGetModPower.exit ]
br label %while.body10.i22
while.body.i44: ; preds = %fGetModPower.exit, %while.body.i44
%conv.i.i47 = phi i64 [ %rem.i.i49, %while.body.i44 ], [ 9, %fGetModPower.exit ]
%indvars.iv.i45 = phi i64 [ %indvars.iv.next.i52, %while.body.i44 ], [ 1, %fGetModPower.exit ]
%liIdx.042.i46 = phi i32 [ %add.i53, %while.body.i44 ], [ 1, %fGetModPower.exit ]
%mul.i.i48 = mul nuw nsw i64 %conv.i.i47, %conv.i.i47
%rem.i.i49 = urem i64 %mul.i.i48, 1000000007
%conv2.i.i50 = trunc i64 %rem.i.i49 to i32
%arrayidx7.i51 = getelementptr inbounds [100 x i32], ptr %li1Val.i15, i64 0, i64 %indvars.iv.i45
store i32 %conv2.i.i50, ptr %arrayidx7.i51, align 4, !tbaa !5
%indvars.iv.next.i52 = add nuw i64 %indvars.iv.i45, 1
%add.i53 = shl nsw i32 %liIdx.042.i46, 1
%cmp1.i54 = icmp slt i32 %add.i53, %1
br i1 %cmp1.i54, label %while.body.i44, label %while.cond8.preheader.loopexit.i55, !llvm.loop !9
while.body10.i22: ; preds = %while.body10.i22.preheader, %if.end18.i36
%indvars.iv52.i23 = phi i64 [ %indvars.iv.next53.pre-phi.i37, %if.end18.i36 ], [ %indvars.iv52.i23.ph, %while.body10.i22.preheader ]
%liVal.048.i24 = phi i32 [ %liVal.1.i39, %if.end18.i36 ], [ 1, %while.body10.i22.preheader ]
%liIdx.147.i25 = phi i32 [ %div.i40, %if.end18.i36 ], [ %liIdx.147.i25.ph, %while.body10.i22.preheader ]
%piIdx.addr.045.i26 = phi i32 [ %piIdx.addr.1.i38, %if.end18.i36 ], [ %1, %while.body10.i22.preheader ]
%cmp11.not.i27 = icmp slt i32 %piIdx.addr.045.i26, %liIdx.147.i25
br i1 %cmp11.not.i27, label %while.body10.if.end18_crit_edge.i42, label %if.then12.i28
while.body10.if.end18_crit_edge.i42: ; preds = %while.body10.i22
%.pre.i43 = add i64 %indvars.iv52.i23, -1
br label %if.end18.i36
if.then12.i28: ; preds = %while.body10.i22
%sub13.i29 = sub nsw i32 %piIdx.addr.045.i26, %liIdx.147.i25
%6 = add i64 %indvars.iv52.i23, -1
%arrayidx16.i30 = getelementptr inbounds [100 x i32], ptr %li1Val.i15, i64 0, i64 %6
%7 = load i32, ptr %arrayidx16.i30, align 4, !tbaa !5
%conv.i35.i31 = sext i32 %liVal.048.i24 to i64
%conv1.i36.i32 = sext i32 %7 to i64
%mul.i37.i33 = mul nsw i64 %conv1.i36.i32, %conv.i35.i31
%rem.i38.i34 = srem i64 %mul.i37.i33, 1000000007
%conv2.i39.i35 = trunc i64 %rem.i38.i34 to i32
br label %if.end18.i36
if.end18.i36: ; preds = %if.then12.i28, %while.body10.if.end18_crit_edge.i42
%indvars.iv.next53.pre-phi.i37 = phi i64 [ %.pre.i43, %while.body10.if.end18_crit_edge.i42 ], [ %6, %if.then12.i28 ]
%piIdx.addr.1.i38 = phi i32 [ %piIdx.addr.045.i26, %while.body10.if.end18_crit_edge.i42 ], [ %sub13.i29, %if.then12.i28 ]
%liVal.1.i39 = phi i32 [ %liVal.048.i24, %while.body10.if.end18_crit_edge.i42 ], [ %conv2.i39.i35, %if.then12.i28 ]
%div.i40 = sdiv i32 %liIdx.147.i25, 2
%cmp9.i41 = icmp sgt i32 %piIdx.addr.1.i38, 0
br i1 %cmp9.i41, label %while.body10.i22, label %fGetModPower.exit57, !llvm.loop !11
fGetModPower.exit57: ; preds = %if.end18.i36, %while.cond8.preheader.i17.thread
%liVal.0.lcssa.i120124 = phi i32 [ 1, %while.cond8.preheader.i17.thread ], [ %liVal.1.i, %if.end18.i36 ]
%liVal.0.lcssa.i21 = phi i32 [ 1, %while.cond8.preheader.i17.thread ], [ %liVal.1.i39, %if.end18.i36 ]
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %li1Val.i15) #5
%add.i58 = sub nsw i32 %liVal.0.lcssa.i120124, %liVal.0.lcssa.i21
%cmp.i = icmp sgt i32 %add.i58, -1
br i1 %cmp.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %fGetModPower.exit57
%rem.i = urem i32 %add.i58, 1000000007
br label %fGetModSum.exit
if.else.i: ; preds = %fGetModPower.exit57
%add1.i = add nsw i32 %add.i58, 1000000007
br label %fGetModSum.exit
fGetModSum.exit: ; preds = %if.then.i, %if.else.i
%retval.0.i = phi i32 [ %rem.i, %if.then.i ], [ %add1.i, %if.else.i ]
%add.i59 = sub i32 %retval.0.i, %liVal.0.lcssa.i21
%cmp.i60 = icmp sgt i32 %add.i59, -1
br i1 %cmp.i60, label %if.then.i64, label %if.else.i61
if.then.i64: ; preds = %fGetModSum.exit
%rem.i65 = urem i32 %add.i59, 1000000007
br label %fGetModSum.exit66
if.else.i61: ; preds = %fGetModSum.exit
%add1.i62 = add nsw i32 %add.i59, 1000000007
br label %fGetModSum.exit66
fGetModSum.exit66: ; preds = %if.then.i64, %if.else.i61
%retval.0.i63 = phi i32 [ %rem.i65, %if.then.i64 ], [ %add1.i62, %if.else.i61 ]
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %li1Val.i67) #5
store i32 8, ptr %li1Val.i67, align 16, !tbaa !5
br i1 %cmp140.i, label %while.body.i97, label %while.cond8.preheader.i69
while.cond8.preheader.loopexit.i108: ; preds = %while.body.i97
%sext.i109 = shl i64 %indvars.iv.next.i105, 32
%8 = ashr exact i64 %sext.i109, 32
br label %while.cond8.preheader.i69
while.cond8.preheader.i69: ; preds = %while.cond8.preheader.loopexit.i108, %fGetModSum.exit66
%liCnt.0.lcssa.i70 = phi i64 [ 1, %fGetModSum.exit66 ], [ %8, %while.cond8.preheader.loopexit.i108 ]
%liIdx.0.lcssa.i71 = phi i32 [ 1, %fGetModSum.exit66 ], [ %add.i106, %while.cond8.preheader.loopexit.i108 ]
br i1 %cmp944.i, label %while.body10.i75, label %fGetModPower.exit110
while.body.i97: ; preds = %fGetModSum.exit66, %while.body.i97
%conv.i.i100 = phi i64 [ %rem.i.i102, %while.body.i97 ], [ 8, %fGetModSum.exit66 ]
%indvars.iv.i98 = phi i64 [ %indvars.iv.next.i105, %while.body.i97 ], [ 1, %fGetModSum.exit66 ]
%liIdx.042.i99 = phi i32 [ %add.i106, %while.body.i97 ], [ 1, %fGetModSum.exit66 ]
%mul.i.i101 = mul nuw nsw i64 %conv.i.i100, %conv.i.i100
%rem.i.i102 = urem i64 %mul.i.i101, 1000000007
%conv2.i.i103 = trunc i64 %rem.i.i102 to i32
%arrayidx7.i104 = getelementptr inbounds [100 x i32], ptr %li1Val.i67, i64 0, i64 %indvars.iv.i98
store i32 %conv2.i.i103, ptr %arrayidx7.i104, align 4, !tbaa !5
%indvars.iv.next.i105 = add nuw i64 %indvars.iv.i98, 1
%add.i106 = shl nsw i32 %liIdx.042.i99, 1
%cmp1.i107 = icmp slt i32 %add.i106, %1
br i1 %cmp1.i107, label %while.body.i97, label %while.cond8.preheader.loopexit.i108, !llvm.loop !9
while.body10.i75: ; preds = %while.cond8.preheader.i69, %if.end18.i89
%indvars.iv52.i76 = phi i64 [ %indvars.iv.next53.pre-phi.i90, %if.end18.i89 ], [ %liCnt.0.lcssa.i70, %while.cond8.preheader.i69 ]
%liVal.048.i77 = phi i32 [ %liVal.1.i92, %if.end18.i89 ], [ 1, %while.cond8.preheader.i69 ]
%liIdx.147.i78 = phi i32 [ %div.i93, %if.end18.i89 ], [ %liIdx.0.lcssa.i71, %while.cond8.preheader.i69 ]
%piIdx.addr.045.i79 = phi i32 [ %piIdx.addr.1.i91, %if.end18.i89 ], [ %1, %while.cond8.preheader.i69 ]
%cmp11.not.i80 = icmp slt i32 %piIdx.addr.045.i79, %liIdx.147.i78
br i1 %cmp11.not.i80, label %while.body10.if.end18_crit_edge.i95, label %if.then12.i81
while.body10.if.end18_crit_edge.i95: ; preds = %while.body10.i75
%.pre.i96 = add i64 %indvars.iv52.i76, -1
br label %if.end18.i89
if.then12.i81: ; preds = %while.body10.i75
%sub13.i82 = sub nsw i32 %piIdx.addr.045.i79, %liIdx.147.i78
%9 = add i64 %indvars.iv52.i76, -1
%arrayidx16.i83 = getelementptr inbounds [100 x i32], ptr %li1Val.i67, i64 0, i64 %9
%10 = load i32, ptr %arrayidx16.i83, align 4, !tbaa !5
%conv.i35.i84 = sext i32 %liVal.048.i77 to i64
%conv1.i36.i85 = sext i32 %10 to i64
%mul.i37.i86 = mul nsw i64 %conv1.i36.i85, %conv.i35.i84
%rem.i38.i87 = srem i64 %mul.i37.i86, 1000000007
%conv2.i39.i88 = trunc i64 %rem.i38.i87 to i32
br label %if.end18.i89
if.end18.i89: ; preds = %if.then12.i81, %while.body10.if.end18_crit_edge.i95
%indvars.iv.next53.pre-phi.i90 = phi i64 [ %.pre.i96, %while.body10.if.end18_crit_edge.i95 ], [ %9, %if.then12.i81 ]
%piIdx.addr.1.i91 = phi i32 [ %piIdx.addr.045.i79, %while.body10.if.end18_crit_edge.i95 ], [ %sub13.i82, %if.then12.i81 ]
%liVal.1.i92 = phi i32 [ %liVal.048.i77, %while.body10.if.end18_crit_edge.i95 ], [ %conv2.i39.i88, %if.then12.i81 ]
%div.i93 = sdiv i32 %liIdx.147.i78, 2
%cmp9.i94 = icmp sgt i32 %piIdx.addr.1.i91, 0
br i1 %cmp9.i94, label %while.body10.i75, label %fGetModPower.exit110, !llvm.loop !11
fGetModPower.exit110: ; preds = %if.end18.i89, %while.cond8.preheader.i69
%liVal.0.lcssa.i73 = phi i32 [ 1, %while.cond8.preheader.i69 ], [ %liVal.1.i92, %if.end18.i89 ]
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %li1Val.i67) #5
%add.i111 = add nsw i32 %liVal.0.lcssa.i73, %retval.0.i63
%cmp.i112 = icmp sgt i32 %add.i111, -1
br i1 %cmp.i112, label %if.then.i116, label %if.else.i113
if.then.i116: ; preds = %fGetModPower.exit110
%rem.i117 = urem i32 %add.i111, 1000000007
br label %fGetModSum.exit118
if.else.i113: ; preds = %fGetModPower.exit110
%add1.i114 = add nsw i32 %add.i111, 1000000007
br label %fGetModSum.exit118
fGetModSum.exit118: ; preds = %if.then.i116, %if.else.i113
%retval.0.i115 = phi i32 [ %rem.i117, %if.then.i116 ], [ %add1.i114, %if.else.i113 ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %liN) #5
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %lc1Buf) #5
ret i32 %retval.0.i115
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @fOne() local_unnamed_addr #0 {
entry:
%lc1Buf = alloca [1024 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %lc1Buf) #5
%0 = load ptr, ptr @stdin, align 8, !tbaa !12
store ptr %0, ptr @szpFpI, align 8, !tbaa !12
%call = tail call i32 @fMain(), !range !14
%call1 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %lc1Buf, ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %call) #5
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %lc1Buf)
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %lc1Buf) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%lc1Buf.i = alloca [1024 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %lc1Buf.i) #5
%0 = load ptr, ptr @stdin, align 8, !tbaa !12
store ptr %0, ptr @szpFpI, align 8, !tbaa !12
%call.i = tail call i32 @fMain(), !range !14
%call1.i = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %lc1Buf.i, ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %call.i) #5
%call.i.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %lc1Buf.i)
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %lc1Buf.i) #5
ret i32 0
}
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree 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 = { nofree 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 #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{i32 -1147483641, i32 1000000007}
|
#include<stdio.h>
#include<string.h>
#define mod 1000000007
long long int multiple(long long int target, long long int p)
{
long long int curretn_answer = 0;
if (p == 0)
{
return 1;
}
if (p%2 == 0)
{
curretn_answer = multiple(target, (p/2))*multiple(target, (p/2));
curretn_answer %= mod;
} else {
curretn_answer = multiple(target, ((p-1)/2))*multiple(target, ((p-1)/2));
curretn_answer %= mod;
curretn_answer *= target;
curretn_answer %= mod;
}
return curretn_answer;
}
int main()
{
long long int n, answer = 0;
scanf("%lld", &n);
answer = (multiple(10, n) - multiple(9, n) + mod);
answer %= mod;
answer *= 2;
answer -= (multiple(10, n) - multiple(8, n) + mod)%mod;
answer += mod;
answer %= mod;
printf("%lld", answer);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322300/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322300/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 nosync nounwind memory(none) uwtable
define dso_local i64 @multiple(i64 noundef %target, i64 noundef %p) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i64 %p, 0
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%0 = and i64 %p, 1
%cmp1 = icmp eq i64 %0, 0
br i1 %cmp1, label %if.then2, label %if.else
if.then2: ; preds = %if.end
%div = sdiv i64 %p, 2
%call = tail call i64 @multiple(i64 noundef %target, i64 noundef %div), !range !5
%mul = mul nsw i64 %call, %call
br label %if.end15
if.else: ; preds = %if.end
%sub = add nsw i64 %p, -1
%div6 = sdiv i64 %sub, 2
%call7 = tail call i64 @multiple(i64 noundef %target, i64 noundef %div6), !range !5
%mul11 = mul nsw i64 %call7, %call7
%rem12 = urem i64 %mul11, 1000000007
%mul13 = mul nsw i64 %rem12, %target
br label %if.end15
if.end15: ; preds = %if.else, %if.then2
%curretn_answer.0.in = phi i64 [ %mul, %if.then2 ], [ %mul13, %if.else ]
%curretn_answer.0 = srem i64 %curretn_answer.0.in, 1000000007
br label %cleanup
cleanup: ; preds = %entry, %if.end15
%retval.0 = phi i64 [ %curretn_answer.0, %if.end15 ], [ 1, %entry ]
ret i64 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !6
%call1 = call i64 @multiple(i64 noundef 10, i64 noundef %0), !range !5
%call2 = call i64 @multiple(i64 noundef 9, i64 noundef %0), !range !5
%sub = add nsw i64 %call1, 1000000007
%add = sub nsw i64 %sub, %call2
%rem = srem i64 %add, 1000000007
%mul = shl nsw i64 %rem, 1
%call4 = call i64 @multiple(i64 noundef 8, i64 noundef %0), !range !5
%add6 = sub nsw i64 %sub, %call4
%rem7 = srem i64 %add6, 1000000007
%reass.sub = sub nsw i64 %mul, %rem7
%add9 = add nsw i64 %reass.sub, 1000000007
%rem10 = srem i64 %add9, 1000000007
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %rem10)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{i64 -1000000006, i64 1000000007}
!6 = !{!7, !7, i64 0}
!7 = !{!"long long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <string.h>
#define HIGASHI 0
#define KITA 1
int w, h;
int memo[101][101][2][2];
// (i, j), 前回の方向, 曲がったか
int getWay(int i, int j, int d, int turn)
{
int ret = 0;
if (memo[i][j][d][turn] != -1){
return (memo[i][j][d][turn]);
}
if (i == w && j == h){
return (1);
}
// 前回曲がってないなら曲がるのも含める
if (turn == 0){
// 東
if (i + 1 <= w){
ret += (getWay(i + 1, j, HIGASHI, (d != HIGASHI ? 1 : 0)) % 100000);
}
// 北
if (j + 1 <= h){
ret += (getWay(i, j + 1, KITA, (d != KITA ? 1 : 0)) % 100000);
}
}
else {
// まっすぐだけ
if (d == HIGASHI && i + 1 <= w){
ret += (getWay(i + 1, j, HIGASHI, 0) % 100000);
}
else if (d == KITA && j + 1 <= h){
ret += (getWay(i, j + 1, KITA, 0) % 100000);
}
}
return (memo[i][j][d][turn] = (ret % 100000));
}
int main(void)
{
int ret = 0;
scanf("%d%d", &w, &h);
while (w != 0){
memset(memo, -1, sizeof(memo));
ret += (getWay(2, 1, HIGASHI, 0) % 100000);
ret += (getWay(1, 2, KITA, 0) % 100000);
printf("%d\n", ret % 100000);
scanf("%d%d", &w, &h);
ret = 0;
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322344/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322344/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@memo = dso_local local_unnamed_addr global [101 x [101 x [2 x [2 x i32]]]] zeroinitializer, align 16
@w = dso_local global i32 0, align 4
@h = dso_local global i32 0, align 4
@.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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @getWay(i32 noundef %i, i32 noundef %j, i32 noundef %d, i32 noundef %turn) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %i to i64
%idxprom1 = sext i32 %j to i64
%idxprom3 = sext i32 %d to i64
%idxprom5 = sext i32 %turn to i64
%arrayidx6 = getelementptr inbounds [101 x [101 x [2 x [2 x i32]]]], ptr @memo, i64 0, i64 %idxprom, i64 %idxprom1, i64 %idxprom3, i64 %idxprom5
%0 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp.not = icmp eq i32 %0, -1
br i1 %cmp.not, label %if.end, label %cleanup
if.end: ; preds = %entry
%1 = load i32, ptr @w, align 4
%cmp15 = icmp eq i32 %1, %i
%2 = load i32, ptr @h, align 4
%cmp16 = icmp eq i32 %2, %j
%or.cond = select i1 %cmp15, i1 %cmp16, i1 false
br i1 %or.cond, label %cleanup, label %if.end18
if.end18: ; preds = %if.end
%cmp19 = icmp eq i32 %turn, 0
br i1 %cmp19, label %if.then20, label %if.else
if.then20: ; preds = %if.end18
%cmp21.not.not = icmp sgt i32 %1, %i
br i1 %cmp21.not.not, label %if.then22, label %if.end26
if.then22: ; preds = %if.then20
%add = add nsw i32 %i, 1
%cmp24.not = icmp ne i32 %d, 0
%cond = zext i1 %cmp24.not to i32
%call = tail call i32 @getWay(i32 noundef %add, i32 noundef %j, i32 noundef 0, i32 noundef %cond)
%rem = srem i32 %call, 100000
%.pre = load i32, ptr @h, align 4, !tbaa !5
br label %if.end26
if.end26: ; preds = %if.then22, %if.then20
%3 = phi i32 [ %.pre, %if.then22 ], [ %2, %if.then20 ]
%ret.0 = phi i32 [ %rem, %if.then22 ], [ 0, %if.then20 ]
%cmp28.not.not = icmp sgt i32 %3, %j
br i1 %cmp28.not.not, label %if.then29, label %if.end58
if.then29: ; preds = %if.end26
%add27 = add nsw i32 %j, 1
%cmp31.not = icmp ne i32 %d, 1
%cond32 = zext i1 %cmp31.not to i32
%call33 = tail call i32 @getWay(i32 noundef %i, i32 noundef %add27, i32 noundef 1, i32 noundef %cond32)
%rem34 = srem i32 %call33, 100000
%add35 = add nsw i32 %rem34, %ret.0
%4 = srem i32 %add35, 100000
br label %if.end58
if.else: ; preds = %if.end18
%cmp37 = icmp eq i32 %d, 0
%cmp40.not.not = icmp sgt i32 %1, %i
%or.cond99 = and i1 %cmp37, %cmp40.not.not
br i1 %or.cond99, label %if.then41, label %if.else46
if.then41: ; preds = %if.else
%add39 = add nsw i32 %i, 1
%call43 = tail call i32 @getWay(i32 noundef %add39, i32 noundef %j, i32 noundef 0, i32 noundef 0)
%rem44 = srem i32 %call43, 100000
br label %if.end58
if.else46: ; preds = %if.else
%cmp47 = icmp eq i32 %d, 1
%cmp50.not.not = icmp sgt i32 %2, %j
%or.cond100 = select i1 %cmp47, i1 %cmp50.not.not, i1 false
br i1 %or.cond100, label %if.then51, label %if.end58
if.then51: ; preds = %if.else46
%add49 = add nsw i32 %j, 1
%call53 = tail call i32 @getWay(i32 noundef %i, i32 noundef %add49, i32 noundef 1, i32 noundef 0)
%rem54 = srem i32 %call53, 100000
br label %if.end58
if.end58: ; preds = %if.then41, %if.then51, %if.else46, %if.end26, %if.then29
%ret.1 = phi i32 [ %4, %if.then29 ], [ %ret.0, %if.end26 ], [ %rem44, %if.then41 ], [ %rem54, %if.then51 ], [ 0, %if.else46 ]
store i32 %ret.1, ptr %arrayidx6, align 4, !tbaa !5
br label %cleanup
cleanup: ; preds = %if.end, %entry, %if.end58
%retval.0 = phi i32 [ %ret.1, %if.end58 ], [ %0, %entry ], [ 1, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @w, ptr noundef nonnull @h)
%0 = load i32, ptr @w, align 4, !tbaa !5
%cmp.not10 = icmp eq i32 %0, 0
br i1 %cmp.not10, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(163216) @memo, i8 -1, i64 163216, i1 false)
%call1 = tail call i32 @getWay(i32 noundef 2, i32 noundef 1, i32 noundef 0, i32 noundef 0)
%rem = srem i32 %call1, 100000
%call2 = tail call i32 @getWay(i32 noundef 1, i32 noundef 2, i32 noundef 1, i32 noundef 0)
%rem3 = srem i32 %call2, 100000
%add4 = add nsw i32 %rem3, %rem
%rem5 = srem i32 %add4, 100000
%call6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %rem5)
%call7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @w, ptr noundef nonnull @h)
%1 = load i32, ptr @w, align 4, !tbaa !5
%cmp.not = icmp eq i32 %1, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~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 r,d,x,i,s;
scanf("%d%d%d",&r,&d,&x);
s=x;
for(i=0;i<10;i++){
s=r*s-d;
printf("%d\n",s);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322395/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322395/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%r = alloca i32, align 4
%d = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r, ptr noundef nonnull %d, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %r, align 4, !tbaa !5
%mul = mul nsw i32 %1, %0
%2 = load i32, ptr %d, align 4, !tbaa !5
%sub = sub nsw i32 %mul, %2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
%3 = load i32, ptr %r, align 4, !tbaa !5
%mul.1 = mul nsw i32 %3, %sub
%4 = load i32, ptr %d, align 4, !tbaa !5
%sub.1 = sub nsw i32 %mul.1, %4
%call1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.1)
%5 = load i32, ptr %r, align 4, !tbaa !5
%mul.2 = mul nsw i32 %5, %sub.1
%6 = load i32, ptr %d, align 4, !tbaa !5
%sub.2 = sub nsw i32 %mul.2, %6
%call1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.2)
%7 = load i32, ptr %r, align 4, !tbaa !5
%mul.3 = mul nsw i32 %7, %sub.2
%8 = load i32, ptr %d, align 4, !tbaa !5
%sub.3 = sub nsw i32 %mul.3, %8
%call1.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.3)
%9 = load i32, ptr %r, align 4, !tbaa !5
%mul.4 = mul nsw i32 %9, %sub.3
%10 = load i32, ptr %d, align 4, !tbaa !5
%sub.4 = sub nsw i32 %mul.4, %10
%call1.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.4)
%11 = load i32, ptr %r, align 4, !tbaa !5
%mul.5 = mul nsw i32 %11, %sub.4
%12 = load i32, ptr %d, align 4, !tbaa !5
%sub.5 = sub nsw i32 %mul.5, %12
%call1.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.5)
%13 = load i32, ptr %r, align 4, !tbaa !5
%mul.6 = mul nsw i32 %13, %sub.5
%14 = load i32, ptr %d, align 4, !tbaa !5
%sub.6 = sub nsw i32 %mul.6, %14
%call1.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.6)
%15 = load i32, ptr %r, align 4, !tbaa !5
%mul.7 = mul nsw i32 %15, %sub.6
%16 = load i32, ptr %d, align 4, !tbaa !5
%sub.7 = sub nsw i32 %mul.7, %16
%call1.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.7)
%17 = load i32, ptr %r, align 4, !tbaa !5
%mul.8 = mul nsw i32 %17, %sub.7
%18 = load i32, ptr %d, align 4, !tbaa !5
%sub.8 = sub nsw i32 %mul.8, %18
%call1.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.8)
%19 = load i32, ptr %r, align 4, !tbaa !5
%mul.9 = mul nsw i32 %19, %sub.8
%20 = load i32, ptr %d, align 4, !tbaa !5
%sub.9 = sub nsw i32 %mul.9, %20
%call1.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.9)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int r, d, x[100], n;
scanf("%d %d %d", &r, &d, &x[0]);
for (n = 0; n < 10; n++)
{
x[n + 1] = r * x[n] - d;
printf("%d\n", x[n+1]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322438/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322438/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%r = alloca i32, align 4
%d = alloca i32, align 4
%x = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r, ptr noundef nonnull %d, ptr noundef nonnull %x)
%0 = load i32, ptr %r, align 4, !tbaa !5
%1 = load i32, ptr %x, align 16, !tbaa !5
%mul = mul nsw i32 %1, %0
%2 = load i32, ptr %d, align 4, !tbaa !5
%sub = sub nsw i32 %mul, %2
%arrayidx3 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 1
store i32 %sub, ptr %arrayidx3, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
%3 = load i32, ptr %r, align 4, !tbaa !5
%4 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%mul.1 = mul nsw i32 %4, %3
%5 = load i32, ptr %d, align 4, !tbaa !5
%sub.1 = sub nsw i32 %mul.1, %5
%arrayidx3.1 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 2
store i32 %sub.1, ptr %arrayidx3.1, align 8, !tbaa !5
%call7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.1)
%6 = load i32, ptr %r, align 4, !tbaa !5
%7 = load i32, ptr %arrayidx3.1, align 8, !tbaa !5
%mul.2 = mul nsw i32 %7, %6
%8 = load i32, ptr %d, align 4, !tbaa !5
%sub.2 = sub nsw i32 %mul.2, %8
%arrayidx3.2 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 3
store i32 %sub.2, ptr %arrayidx3.2, align 4, !tbaa !5
%call7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.2)
%9 = load i32, ptr %r, align 4, !tbaa !5
%10 = load i32, ptr %arrayidx3.2, align 4, !tbaa !5
%mul.3 = mul nsw i32 %10, %9
%11 = load i32, ptr %d, align 4, !tbaa !5
%sub.3 = sub nsw i32 %mul.3, %11
%arrayidx3.3 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 4
store i32 %sub.3, ptr %arrayidx3.3, align 16, !tbaa !5
%call7.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.3)
%12 = load i32, ptr %r, align 4, !tbaa !5
%13 = load i32, ptr %arrayidx3.3, align 16, !tbaa !5
%mul.4 = mul nsw i32 %13, %12
%14 = load i32, ptr %d, align 4, !tbaa !5
%sub.4 = sub nsw i32 %mul.4, %14
%arrayidx3.4 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 5
store i32 %sub.4, ptr %arrayidx3.4, align 4, !tbaa !5
%call7.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.4)
%15 = load i32, ptr %r, align 4, !tbaa !5
%16 = load i32, ptr %arrayidx3.4, align 4, !tbaa !5
%mul.5 = mul nsw i32 %16, %15
%17 = load i32, ptr %d, align 4, !tbaa !5
%sub.5 = sub nsw i32 %mul.5, %17
%arrayidx3.5 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 6
store i32 %sub.5, ptr %arrayidx3.5, align 8, !tbaa !5
%call7.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.5)
%18 = load i32, ptr %r, align 4, !tbaa !5
%19 = load i32, ptr %arrayidx3.5, align 8, !tbaa !5
%mul.6 = mul nsw i32 %19, %18
%20 = load i32, ptr %d, align 4, !tbaa !5
%sub.6 = sub nsw i32 %mul.6, %20
%arrayidx3.6 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 7
store i32 %sub.6, ptr %arrayidx3.6, align 4, !tbaa !5
%call7.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.6)
%21 = load i32, ptr %r, align 4, !tbaa !5
%22 = load i32, ptr %arrayidx3.6, align 4, !tbaa !5
%mul.7 = mul nsw i32 %22, %21
%23 = load i32, ptr %d, align 4, !tbaa !5
%sub.7 = sub nsw i32 %mul.7, %23
%arrayidx3.7 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 8
store i32 %sub.7, ptr %arrayidx3.7, align 16, !tbaa !5
%call7.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.7)
%24 = load i32, ptr %r, align 4, !tbaa !5
%25 = load i32, ptr %arrayidx3.7, align 16, !tbaa !5
%mul.8 = mul nsw i32 %25, %24
%26 = load i32, ptr %d, align 4, !tbaa !5
%sub.8 = sub nsw i32 %mul.8, %26
%arrayidx3.8 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 9
store i32 %sub.8, ptr %arrayidx3.8, align 4, !tbaa !5
%call7.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.8)
%27 = load i32, ptr %r, align 4, !tbaa !5
%28 = load i32, ptr %arrayidx3.8, align 4, !tbaa !5
%mul.9 = mul nsw i32 %28, %27
%29 = load i32, ptr %d, align 4, !tbaa !5
%sub.9 = sub nsw i32 %mul.9, %29
%arrayidx3.9 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 10
store i32 %sub.9, ptr %arrayidx3.9, align 8, !tbaa !5
%call7.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.9)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int r,D,x, ans;
scanf("%d%d%d",&r,&D,&x);
for(int i = 1;i <= 10;i++){
x = r*x - D;
printf("%d\n",x);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322481/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322481/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%r = alloca i32, align 4
%D = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r, ptr noundef nonnull %D, ptr noundef nonnull %x)
%0 = load i32, ptr %r, align 4, !tbaa !5
%1 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %1, %0
%2 = load i32, ptr %D, align 4, !tbaa !5
%sub = sub nsw i32 %mul, %2
store i32 %sub, ptr %x, align 4, !tbaa !5
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
%3 = load i32, ptr %r, align 4, !tbaa !5
%4 = load i32, ptr %x, align 4, !tbaa !5
%mul.1 = mul nsw i32 %4, %3
%5 = load i32, ptr %D, align 4, !tbaa !5
%sub.1 = sub nsw i32 %mul.1, %5
store i32 %sub.1, ptr %x, align 4, !tbaa !5
%call1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.1)
%6 = load i32, ptr %r, align 4, !tbaa !5
%7 = load i32, ptr %x, align 4, !tbaa !5
%mul.2 = mul nsw i32 %7, %6
%8 = load i32, ptr %D, align 4, !tbaa !5
%sub.2 = sub nsw i32 %mul.2, %8
store i32 %sub.2, ptr %x, align 4, !tbaa !5
%call1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.2)
%9 = load i32, ptr %r, align 4, !tbaa !5
%10 = load i32, ptr %x, align 4, !tbaa !5
%mul.3 = mul nsw i32 %10, %9
%11 = load i32, ptr %D, align 4, !tbaa !5
%sub.3 = sub nsw i32 %mul.3, %11
store i32 %sub.3, ptr %x, align 4, !tbaa !5
%call1.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.3)
%12 = load i32, ptr %r, align 4, !tbaa !5
%13 = load i32, ptr %x, align 4, !tbaa !5
%mul.4 = mul nsw i32 %13, %12
%14 = load i32, ptr %D, align 4, !tbaa !5
%sub.4 = sub nsw i32 %mul.4, %14
store i32 %sub.4, ptr %x, align 4, !tbaa !5
%call1.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.4)
%15 = load i32, ptr %r, align 4, !tbaa !5
%16 = load i32, ptr %x, align 4, !tbaa !5
%mul.5 = mul nsw i32 %16, %15
%17 = load i32, ptr %D, align 4, !tbaa !5
%sub.5 = sub nsw i32 %mul.5, %17
store i32 %sub.5, ptr %x, align 4, !tbaa !5
%call1.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.5)
%18 = load i32, ptr %r, align 4, !tbaa !5
%19 = load i32, ptr %x, align 4, !tbaa !5
%mul.6 = mul nsw i32 %19, %18
%20 = load i32, ptr %D, align 4, !tbaa !5
%sub.6 = sub nsw i32 %mul.6, %20
store i32 %sub.6, ptr %x, align 4, !tbaa !5
%call1.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.6)
%21 = load i32, ptr %r, align 4, !tbaa !5
%22 = load i32, ptr %x, align 4, !tbaa !5
%mul.7 = mul nsw i32 %22, %21
%23 = load i32, ptr %D, align 4, !tbaa !5
%sub.7 = sub nsw i32 %mul.7, %23
store i32 %sub.7, ptr %x, align 4, !tbaa !5
%call1.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.7)
%24 = load i32, ptr %r, align 4, !tbaa !5
%25 = load i32, ptr %x, align 4, !tbaa !5
%mul.8 = mul nsw i32 %25, %24
%26 = load i32, ptr %D, align 4, !tbaa !5
%sub.8 = sub nsw i32 %mul.8, %26
store i32 %sub.8, ptr %x, align 4, !tbaa !5
%call1.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.8)
%27 = load i32, ptr %r, align 4, !tbaa !5
%28 = load i32, ptr %x, align 4, !tbaa !5
%mul.9 = mul nsw i32 %28, %27
%29 = load i32, ptr %D, align 4, !tbaa !5
%sub.9 = sub nsw i32 %mul.9, %29
store i32 %sub.9, ptr %x, align 4, !tbaa !5
%call1.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.9)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!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){
// Your code here!
int r, D;
long x;
scanf("%d %d %ld",&r,&D,&x);
for(int i = 1; i <= 10; i++)
{
x = r*x-D;
printf("%ld\n",x);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322524/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322524/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%d %d %ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%r = alloca i32, align 4
%D = alloca i32, align 4
%x = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r, ptr noundef nonnull %D, ptr noundef nonnull %x)
%0 = load i32, ptr %r, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%1 = load i64, ptr %x, align 8, !tbaa !9
%mul = mul nsw i64 %1, %conv
%2 = load i32, ptr %D, align 4, !tbaa !5
%conv1 = sext i32 %2 to i64
%sub = sub nsw i64 %mul, %conv1
store i64 %sub, ptr %x, align 8, !tbaa !9
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub)
%3 = load i32, ptr %r, align 4, !tbaa !5
%conv.1 = sext i32 %3 to i64
%4 = load i64, ptr %x, align 8, !tbaa !9
%mul.1 = mul nsw i64 %4, %conv.1
%5 = load i32, ptr %D, align 4, !tbaa !5
%conv1.1 = sext i32 %5 to i64
%sub.1 = sub nsw i64 %mul.1, %conv1.1
store i64 %sub.1, ptr %x, align 8, !tbaa !9
%call2.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub.1)
%6 = load i32, ptr %r, align 4, !tbaa !5
%conv.2 = sext i32 %6 to i64
%7 = load i64, ptr %x, align 8, !tbaa !9
%mul.2 = mul nsw i64 %7, %conv.2
%8 = load i32, ptr %D, align 4, !tbaa !5
%conv1.2 = sext i32 %8 to i64
%sub.2 = sub nsw i64 %mul.2, %conv1.2
store i64 %sub.2, ptr %x, align 8, !tbaa !9
%call2.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub.2)
%9 = load i32, ptr %r, align 4, !tbaa !5
%conv.3 = sext i32 %9 to i64
%10 = load i64, ptr %x, align 8, !tbaa !9
%mul.3 = mul nsw i64 %10, %conv.3
%11 = load i32, ptr %D, align 4, !tbaa !5
%conv1.3 = sext i32 %11 to i64
%sub.3 = sub nsw i64 %mul.3, %conv1.3
store i64 %sub.3, ptr %x, align 8, !tbaa !9
%call2.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub.3)
%12 = load i32, ptr %r, align 4, !tbaa !5
%conv.4 = sext i32 %12 to i64
%13 = load i64, ptr %x, align 8, !tbaa !9
%mul.4 = mul nsw i64 %13, %conv.4
%14 = load i32, ptr %D, align 4, !tbaa !5
%conv1.4 = sext i32 %14 to i64
%sub.4 = sub nsw i64 %mul.4, %conv1.4
store i64 %sub.4, ptr %x, align 8, !tbaa !9
%call2.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub.4)
%15 = load i32, ptr %r, align 4, !tbaa !5
%conv.5 = sext i32 %15 to i64
%16 = load i64, ptr %x, align 8, !tbaa !9
%mul.5 = mul nsw i64 %16, %conv.5
%17 = load i32, ptr %D, align 4, !tbaa !5
%conv1.5 = sext i32 %17 to i64
%sub.5 = sub nsw i64 %mul.5, %conv1.5
store i64 %sub.5, ptr %x, align 8, !tbaa !9
%call2.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub.5)
%18 = load i32, ptr %r, align 4, !tbaa !5
%conv.6 = sext i32 %18 to i64
%19 = load i64, ptr %x, align 8, !tbaa !9
%mul.6 = mul nsw i64 %19, %conv.6
%20 = load i32, ptr %D, align 4, !tbaa !5
%conv1.6 = sext i32 %20 to i64
%sub.6 = sub nsw i64 %mul.6, %conv1.6
store i64 %sub.6, ptr %x, align 8, !tbaa !9
%call2.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub.6)
%21 = load i32, ptr %r, align 4, !tbaa !5
%conv.7 = sext i32 %21 to i64
%22 = load i64, ptr %x, align 8, !tbaa !9
%mul.7 = mul nsw i64 %22, %conv.7
%23 = load i32, ptr %D, align 4, !tbaa !5
%conv1.7 = sext i32 %23 to i64
%sub.7 = sub nsw i64 %mul.7, %conv1.7
store i64 %sub.7, ptr %x, align 8, !tbaa !9
%call2.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub.7)
%24 = load i32, ptr %r, align 4, !tbaa !5
%conv.8 = sext i32 %24 to i64
%25 = load i64, ptr %x, align 8, !tbaa !9
%mul.8 = mul nsw i64 %25, %conv.8
%26 = load i32, ptr %D, align 4, !tbaa !5
%conv1.8 = sext i32 %26 to i64
%sub.8 = sub nsw i64 %mul.8, %conv1.8
store i64 %sub.8, ptr %x, align 8, !tbaa !9
%call2.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub.8)
%27 = load i32, ptr %r, align 4, !tbaa !5
%conv.9 = sext i32 %27 to i64
%28 = load i64, ptr %x, align 8, !tbaa !9
%mul.9 = mul nsw i64 %28, %conv.9
%29 = load i32, ptr %D, align 4, !tbaa !5
%conv1.9 = sext i32 %29 to i64
%sub.9 = sub nsw i64 %mul.9, %conv1.9
store i64 %sub.9, ptr %x, align 8, !tbaa !9
%call2.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub.9)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
|
#include<stdio.h>
int main()
{
int x,r, d, i;
scanf("%d%d%d", &r,&d,&x);
if(r>=2&&r<=5&&d>=1&&d<=100)
{
for(i=1;i<=10;i++)
{
x=x*r-d;
printf("%d\n", x);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322568/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322568/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%r = alloca i32, align 4
%d = 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 %r) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r, ptr noundef nonnull %d, ptr noundef nonnull %x)
%0 = load i32, ptr %r, align 4
%1 = add i32 %0, -2
%or.cond = icmp ult i32 %1, 4
%2 = load i32, ptr %d, align 4
%cmp3 = icmp sgt i32 %2, 0
%or.cond8 = select i1 %or.cond, i1 %cmp3, i1 false
%cmp5 = icmp slt i32 %2, 101
%or.cond9 = select i1 %or.cond8, i1 %cmp5, i1 false
br i1 %or.cond9, label %for.body.preheader, label %if.end
for.body.preheader: ; preds = %entry
%3 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %3
%sub = sub nsw i32 %mul, %2
store i32 %sub, ptr %x, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
%4 = load i32, ptr %x, align 4, !tbaa !5
%5 = load i32, ptr %r, align 4, !tbaa !5
%mul.1 = mul nsw i32 %5, %4
%6 = load i32, ptr %d, align 4, !tbaa !5
%sub.1 = sub nsw i32 %mul.1, %6
store i32 %sub.1, ptr %x, align 4, !tbaa !5
%call7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.1)
%7 = load i32, ptr %x, align 4, !tbaa !5
%8 = load i32, ptr %r, align 4, !tbaa !5
%mul.2 = mul nsw i32 %8, %7
%9 = load i32, ptr %d, align 4, !tbaa !5
%sub.2 = sub nsw i32 %mul.2, %9
store i32 %sub.2, ptr %x, align 4, !tbaa !5
%call7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.2)
%10 = load i32, ptr %x, align 4, !tbaa !5
%11 = load i32, ptr %r, align 4, !tbaa !5
%mul.3 = mul nsw i32 %11, %10
%12 = load i32, ptr %d, align 4, !tbaa !5
%sub.3 = sub nsw i32 %mul.3, %12
store i32 %sub.3, ptr %x, align 4, !tbaa !5
%call7.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.3)
%13 = load i32, ptr %x, align 4, !tbaa !5
%14 = load i32, ptr %r, align 4, !tbaa !5
%mul.4 = mul nsw i32 %14, %13
%15 = load i32, ptr %d, align 4, !tbaa !5
%sub.4 = sub nsw i32 %mul.4, %15
store i32 %sub.4, ptr %x, align 4, !tbaa !5
%call7.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.4)
%16 = load i32, ptr %x, align 4, !tbaa !5
%17 = load i32, ptr %r, align 4, !tbaa !5
%mul.5 = mul nsw i32 %17, %16
%18 = load i32, ptr %d, align 4, !tbaa !5
%sub.5 = sub nsw i32 %mul.5, %18
store i32 %sub.5, ptr %x, align 4, !tbaa !5
%call7.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.5)
%19 = load i32, ptr %x, align 4, !tbaa !5
%20 = load i32, ptr %r, align 4, !tbaa !5
%mul.6 = mul nsw i32 %20, %19
%21 = load i32, ptr %d, align 4, !tbaa !5
%sub.6 = sub nsw i32 %mul.6, %21
store i32 %sub.6, ptr %x, align 4, !tbaa !5
%call7.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.6)
%22 = load i32, ptr %x, align 4, !tbaa !5
%23 = load i32, ptr %r, align 4, !tbaa !5
%mul.7 = mul nsw i32 %23, %22
%24 = load i32, ptr %d, align 4, !tbaa !5
%sub.7 = sub nsw i32 %mul.7, %24
store i32 %sub.7, ptr %x, align 4, !tbaa !5
%call7.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.7)
%25 = load i32, ptr %x, align 4, !tbaa !5
%26 = load i32, ptr %r, align 4, !tbaa !5
%mul.8 = mul nsw i32 %26, %25
%27 = load i32, ptr %d, align 4, !tbaa !5
%sub.8 = sub nsw i32 %mul.8, %27
store i32 %sub.8, ptr %x, align 4, !tbaa !5
%call7.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.8)
%28 = load i32, ptr %x, align 4, !tbaa !5
%29 = load i32, ptr %r, align 4, !tbaa !5
%mul.9 = mul nsw i32 %29, %28
%30 = load i32, ptr %d, align 4, !tbaa !5
%sub.9 = sub nsw i32 %mul.9, %30
store i32 %sub.9, ptr %x, align 4, !tbaa !5
%call7.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.9)
br label %if.end
if.end: ; preds = %for.body.preheader, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #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 r, D, x2000[11] = {};
scanf("%d %d %d", &r, &D, &x2000[0]);
for (int i = 1; i < 11; i++)
{
x2000[i] = (r * x2000[i - 1]) - D;
printf("%d\n", x2000[i]);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322610/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322610/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%r = alloca i32, align 4
%D = alloca i32, align 4
%x2000 = alloca [11 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #4
call void @llvm.lifetime.start.p0(i64 44, ptr nonnull %x2000) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(44) %x2000, i8 0, i64 44, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r, ptr noundef nonnull %D, ptr noundef nonnull %x2000)
%0 = load i32, ptr %r, align 4, !tbaa !5
%1 = load i32, ptr %x2000, align 16, !tbaa !5
%mul = mul nsw i32 %1, %0
%2 = load i32, ptr %D, align 4, !tbaa !5
%sub2 = sub nsw i32 %mul, %2
%arrayidx4 = getelementptr inbounds [11 x i32], ptr %x2000, i64 0, i64 1
store i32 %sub2, ptr %arrayidx4, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2)
%3 = load i32, ptr %r, align 4, !tbaa !5
%4 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%mul.1 = mul nsw i32 %4, %3
%5 = load i32, ptr %D, align 4, !tbaa !5
%sub2.1 = sub nsw i32 %mul.1, %5
%arrayidx4.1 = getelementptr inbounds [11 x i32], ptr %x2000, i64 0, i64 2
store i32 %sub2.1, ptr %arrayidx4.1, align 8, !tbaa !5
%call7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.1)
%6 = load i32, ptr %r, align 4, !tbaa !5
%7 = load i32, ptr %arrayidx4.1, align 8, !tbaa !5
%mul.2 = mul nsw i32 %7, %6
%8 = load i32, ptr %D, align 4, !tbaa !5
%sub2.2 = sub nsw i32 %mul.2, %8
%arrayidx4.2 = getelementptr inbounds [11 x i32], ptr %x2000, i64 0, i64 3
store i32 %sub2.2, ptr %arrayidx4.2, align 4, !tbaa !5
%call7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.2)
%9 = load i32, ptr %r, align 4, !tbaa !5
%10 = load i32, ptr %arrayidx4.2, align 4, !tbaa !5
%mul.3 = mul nsw i32 %10, %9
%11 = load i32, ptr %D, align 4, !tbaa !5
%sub2.3 = sub nsw i32 %mul.3, %11
%arrayidx4.3 = getelementptr inbounds [11 x i32], ptr %x2000, i64 0, i64 4
store i32 %sub2.3, ptr %arrayidx4.3, align 16, !tbaa !5
%call7.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.3)
%12 = load i32, ptr %r, align 4, !tbaa !5
%13 = load i32, ptr %arrayidx4.3, align 16, !tbaa !5
%mul.4 = mul nsw i32 %13, %12
%14 = load i32, ptr %D, align 4, !tbaa !5
%sub2.4 = sub nsw i32 %mul.4, %14
%arrayidx4.4 = getelementptr inbounds [11 x i32], ptr %x2000, i64 0, i64 5
store i32 %sub2.4, ptr %arrayidx4.4, align 4, !tbaa !5
%call7.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.4)
%15 = load i32, ptr %r, align 4, !tbaa !5
%16 = load i32, ptr %arrayidx4.4, align 4, !tbaa !5
%mul.5 = mul nsw i32 %16, %15
%17 = load i32, ptr %D, align 4, !tbaa !5
%sub2.5 = sub nsw i32 %mul.5, %17
%arrayidx4.5 = getelementptr inbounds [11 x i32], ptr %x2000, i64 0, i64 6
store i32 %sub2.5, ptr %arrayidx4.5, align 8, !tbaa !5
%call7.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.5)
%18 = load i32, ptr %r, align 4, !tbaa !5
%19 = load i32, ptr %arrayidx4.5, align 8, !tbaa !5
%mul.6 = mul nsw i32 %19, %18
%20 = load i32, ptr %D, align 4, !tbaa !5
%sub2.6 = sub nsw i32 %mul.6, %20
%arrayidx4.6 = getelementptr inbounds [11 x i32], ptr %x2000, i64 0, i64 7
store i32 %sub2.6, ptr %arrayidx4.6, align 4, !tbaa !5
%call7.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.6)
%21 = load i32, ptr %r, align 4, !tbaa !5
%22 = load i32, ptr %arrayidx4.6, align 4, !tbaa !5
%mul.7 = mul nsw i32 %22, %21
%23 = load i32, ptr %D, align 4, !tbaa !5
%sub2.7 = sub nsw i32 %mul.7, %23
%arrayidx4.7 = getelementptr inbounds [11 x i32], ptr %x2000, i64 0, i64 8
store i32 %sub2.7, ptr %arrayidx4.7, align 16, !tbaa !5
%call7.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.7)
%24 = load i32, ptr %r, align 4, !tbaa !5
%25 = load i32, ptr %arrayidx4.7, align 16, !tbaa !5
%mul.8 = mul nsw i32 %25, %24
%26 = load i32, ptr %D, align 4, !tbaa !5
%sub2.8 = sub nsw i32 %mul.8, %26
%arrayidx4.8 = getelementptr inbounds [11 x i32], ptr %x2000, i64 0, i64 9
store i32 %sub2.8, ptr %arrayidx4.8, align 4, !tbaa !5
%call7.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.8)
%27 = load i32, ptr %r, align 4, !tbaa !5
%28 = load i32, ptr %arrayidx4.8, align 4, !tbaa !5
%mul.9 = mul nsw i32 %28, %27
%29 = load i32, ptr %D, align 4, !tbaa !5
%sub2.9 = sub nsw i32 %mul.9, %29
%arrayidx4.9 = getelementptr inbounds [11 x i32], ptr %x2000, i64 0, i64 10
store i32 %sub2.9, ptr %arrayidx4.9, align 8, !tbaa !5
%call7.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.9)
call void @llvm.lifetime.end.p0(i64 44, ptr nonnull %x2000) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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"}
|
#include <stdio.h>
int main(void) {
int X[11] = {0};
int r, D, x_2000;
scanf("%d %d %d", &r, &D, &x_2000);
X[0] = x_2000;
for (int i = 0; i < 10; ++i) {
X[i + 1] = r * X[i] - D;
}
for (int j = 0; j < 10; ++j) {
printf("%d\n", X[j + 1]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322661/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322661/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%r = alloca i32, align 4
%D = alloca i32, align 4
%x_2000 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x_2000) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r, ptr noundef nonnull %D, ptr noundef nonnull %x_2000)
%0 = load i32, ptr %x_2000, align 4, !tbaa !5
%1 = load i32, ptr %r, align 4, !tbaa !5
%2 = load i32, ptr %D, align 4, !tbaa !5
%mul = mul nsw i32 %0, %1
%sub = sub nsw i32 %mul, %2
%mul.1 = mul nsw i32 %sub, %1
%sub.1 = sub nsw i32 %mul.1, %2
%mul.2 = mul nsw i32 %sub.1, %1
%sub.2 = sub nsw i32 %mul.2, %2
%mul.3 = mul nsw i32 %sub.2, %1
%sub.3 = sub nsw i32 %mul.3, %2
%mul.4 = mul nsw i32 %sub.3, %1
%sub.4 = sub nsw i32 %mul.4, %2
%mul.5 = mul nsw i32 %sub.4, %1
%sub.5 = sub nsw i32 %mul.5, %2
%mul.6 = mul nsw i32 %sub.5, %1
%sub.6 = sub nsw i32 %mul.6, %2
%mul.7 = mul nsw i32 %sub.6, %1
%sub.7 = sub nsw i32 %mul.7, %2
%mul.8 = mul nsw i32 %sub.7, %1
%sub.8 = sub nsw i32 %mul.8, %2
%mul.9 = mul nsw i32 %sub.8, %1
%sub.9 = sub nsw i32 %mul.9, %2
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
%call11.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.1)
%call11.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.2)
%call11.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.3)
%call11.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.4)
%call11.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.5)
%call11.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.6)
%call11.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.7)
%call11.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.8)
%call11.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.9)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x_2000) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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>
int main() {
int r,D,x2000,i=0,newx;
scanf("%d%d%d", &r, &D,&x2000);
for(i=0;i<10;i++){
newx=r*x2000-D;
printf("%d\n",newx);
x2000=newx;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322711/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322711/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%r = alloca i32, align 4
%D = alloca i32, align 4
%x2000 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x2000) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r, ptr noundef nonnull %D, ptr noundef nonnull %x2000)
%0 = load i32, ptr %r, align 4, !tbaa !5
%1 = load i32, ptr %x2000, align 4, !tbaa !5
%mul = mul nsw i32 %1, %0
%2 = load i32, ptr %D, align 4, !tbaa !5
%sub = sub nsw i32 %mul, %2
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
store i32 %sub, ptr %x2000, align 4, !tbaa !5
%3 = load i32, ptr %r, align 4, !tbaa !5
%mul.1 = mul nsw i32 %sub, %3
%4 = load i32, ptr %D, align 4, !tbaa !5
%sub.1 = sub nsw i32 %mul.1, %4
%call1.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.1)
store i32 %sub.1, ptr %x2000, align 4, !tbaa !5
%5 = load i32, ptr %r, align 4, !tbaa !5
%mul.2 = mul nsw i32 %sub.1, %5
%6 = load i32, ptr %D, align 4, !tbaa !5
%sub.2 = sub nsw i32 %mul.2, %6
%call1.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.2)
store i32 %sub.2, ptr %x2000, align 4, !tbaa !5
%7 = load i32, ptr %r, align 4, !tbaa !5
%mul.3 = mul nsw i32 %sub.2, %7
%8 = load i32, ptr %D, align 4, !tbaa !5
%sub.3 = sub nsw i32 %mul.3, %8
%call1.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.3)
store i32 %sub.3, ptr %x2000, align 4, !tbaa !5
%9 = load i32, ptr %r, align 4, !tbaa !5
%mul.4 = mul nsw i32 %sub.3, %9
%10 = load i32, ptr %D, align 4, !tbaa !5
%sub.4 = sub nsw i32 %mul.4, %10
%call1.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.4)
store i32 %sub.4, ptr %x2000, align 4, !tbaa !5
%11 = load i32, ptr %r, align 4, !tbaa !5
%mul.5 = mul nsw i32 %sub.4, %11
%12 = load i32, ptr %D, align 4, !tbaa !5
%sub.5 = sub nsw i32 %mul.5, %12
%call1.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.5)
store i32 %sub.5, ptr %x2000, align 4, !tbaa !5
%13 = load i32, ptr %r, align 4, !tbaa !5
%mul.6 = mul nsw i32 %sub.5, %13
%14 = load i32, ptr %D, align 4, !tbaa !5
%sub.6 = sub nsw i32 %mul.6, %14
%call1.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.6)
store i32 %sub.6, ptr %x2000, align 4, !tbaa !5
%15 = load i32, ptr %r, align 4, !tbaa !5
%mul.7 = mul nsw i32 %sub.6, %15
%16 = load i32, ptr %D, align 4, !tbaa !5
%sub.7 = sub nsw i32 %mul.7, %16
%call1.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.7)
store i32 %sub.7, ptr %x2000, align 4, !tbaa !5
%17 = load i32, ptr %r, align 4, !tbaa !5
%mul.8 = mul nsw i32 %sub.7, %17
%18 = load i32, ptr %D, align 4, !tbaa !5
%sub.8 = sub nsw i32 %mul.8, %18
%call1.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.8)
store i32 %sub.8, ptr %x2000, align 4, !tbaa !5
%19 = load i32, ptr %r, align 4, !tbaa !5
%mul.9 = mul nsw i32 %sub.8, %19
%20 = load i32, ptr %D, align 4, !tbaa !5
%sub.9 = sub nsw i32 %mul.9, %20
%call1.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.9)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x2000) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
int main(int argc, char const *argv[])
{
int r,d,x[13];
scanf("%d%d%d",&r,&d,&x[0]);
for (int i = 1; i <= 10; ++i)
{
x[i] = r * x[i - 1] - d;
printf("%d\n", x[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322755/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322755/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%r = alloca i32, align 4
%d = alloca i32, align 4
%x = alloca [13 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.start.p0(i64 52, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %r, ptr noundef nonnull %d, ptr noundef nonnull %x)
%0 = load i32, ptr %r, align 4, !tbaa !5
%1 = load i32, ptr %x, align 16, !tbaa !5
%mul = mul nsw i32 %1, %0
%2 = load i32, ptr %d, align 4, !tbaa !5
%sub2 = sub nsw i32 %mul, %2
%arrayidx4 = getelementptr inbounds [13 x i32], ptr %x, i64 0, i64 1
store i32 %sub2, ptr %arrayidx4, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2)
%3 = load i32, ptr %r, align 4, !tbaa !5
%4 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%mul.1 = mul nsw i32 %4, %3
%5 = load i32, ptr %d, align 4, !tbaa !5
%sub2.1 = sub nsw i32 %mul.1, %5
%arrayidx4.1 = getelementptr inbounds [13 x i32], ptr %x, i64 0, i64 2
store i32 %sub2.1, ptr %arrayidx4.1, align 8, !tbaa !5
%call7.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.1)
%6 = load i32, ptr %r, align 4, !tbaa !5
%7 = load i32, ptr %arrayidx4.1, align 8, !tbaa !5
%mul.2 = mul nsw i32 %7, %6
%8 = load i32, ptr %d, align 4, !tbaa !5
%sub2.2 = sub nsw i32 %mul.2, %8
%arrayidx4.2 = getelementptr inbounds [13 x i32], ptr %x, i64 0, i64 3
store i32 %sub2.2, ptr %arrayidx4.2, align 4, !tbaa !5
%call7.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.2)
%9 = load i32, ptr %r, align 4, !tbaa !5
%10 = load i32, ptr %arrayidx4.2, align 4, !tbaa !5
%mul.3 = mul nsw i32 %10, %9
%11 = load i32, ptr %d, align 4, !tbaa !5
%sub2.3 = sub nsw i32 %mul.3, %11
%arrayidx4.3 = getelementptr inbounds [13 x i32], ptr %x, i64 0, i64 4
store i32 %sub2.3, ptr %arrayidx4.3, align 16, !tbaa !5
%call7.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.3)
%12 = load i32, ptr %r, align 4, !tbaa !5
%13 = load i32, ptr %arrayidx4.3, align 16, !tbaa !5
%mul.4 = mul nsw i32 %13, %12
%14 = load i32, ptr %d, align 4, !tbaa !5
%sub2.4 = sub nsw i32 %mul.4, %14
%arrayidx4.4 = getelementptr inbounds [13 x i32], ptr %x, i64 0, i64 5
store i32 %sub2.4, ptr %arrayidx4.4, align 4, !tbaa !5
%call7.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.4)
%15 = load i32, ptr %r, align 4, !tbaa !5
%16 = load i32, ptr %arrayidx4.4, align 4, !tbaa !5
%mul.5 = mul nsw i32 %16, %15
%17 = load i32, ptr %d, align 4, !tbaa !5
%sub2.5 = sub nsw i32 %mul.5, %17
%arrayidx4.5 = getelementptr inbounds [13 x i32], ptr %x, i64 0, i64 6
store i32 %sub2.5, ptr %arrayidx4.5, align 8, !tbaa !5
%call7.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.5)
%18 = load i32, ptr %r, align 4, !tbaa !5
%19 = load i32, ptr %arrayidx4.5, align 8, !tbaa !5
%mul.6 = mul nsw i32 %19, %18
%20 = load i32, ptr %d, align 4, !tbaa !5
%sub2.6 = sub nsw i32 %mul.6, %20
%arrayidx4.6 = getelementptr inbounds [13 x i32], ptr %x, i64 0, i64 7
store i32 %sub2.6, ptr %arrayidx4.6, align 4, !tbaa !5
%call7.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.6)
%21 = load i32, ptr %r, align 4, !tbaa !5
%22 = load i32, ptr %arrayidx4.6, align 4, !tbaa !5
%mul.7 = mul nsw i32 %22, %21
%23 = load i32, ptr %d, align 4, !tbaa !5
%sub2.7 = sub nsw i32 %mul.7, %23
%arrayidx4.7 = getelementptr inbounds [13 x i32], ptr %x, i64 0, i64 8
store i32 %sub2.7, ptr %arrayidx4.7, align 16, !tbaa !5
%call7.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.7)
%24 = load i32, ptr %r, align 4, !tbaa !5
%25 = load i32, ptr %arrayidx4.7, align 16, !tbaa !5
%mul.8 = mul nsw i32 %25, %24
%26 = load i32, ptr %d, align 4, !tbaa !5
%sub2.8 = sub nsw i32 %mul.8, %26
%arrayidx4.8 = getelementptr inbounds [13 x i32], ptr %x, i64 0, i64 9
store i32 %sub2.8, ptr %arrayidx4.8, align 4, !tbaa !5
%call7.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.8)
%27 = load i32, ptr %r, align 4, !tbaa !5
%28 = load i32, ptr %arrayidx4.8, align 4, !tbaa !5
%mul.9 = mul nsw i32 %28, %27
%29 = load i32, ptr %d, align 4, !tbaa !5
%sub2.9 = sub nsw i32 %mul.9, %29
%arrayidx4.9 = getelementptr inbounds [13 x i32], ptr %x, i64 0, i64 10
store i32 %sub2.9, ptr %arrayidx4.9, align 8, !tbaa !5
%call7.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub2.9)
call void @llvm.lifetime.end.p0(i64 52, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int n,h[101]={};
int max=1,ans=0;
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",&h[i]);
while(max!=0){
max=0;
for(int i=0;i<n;i++)
if (max < h[i])
max=h[i];
for(int j=0;j<n;j++)
if(h[j]==max){
ans++;
if(h[j]==h[j+1])
ans--;
h[j]--;
}
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322805/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322805/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%h = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %h) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) %h, i8 0, i64 404, 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
%cmp56 = icmp sgt i32 %0, 0
br i1 %cmp56, label %for.body, label %while.end
while.cond.preheader: ; preds = %for.body
%cmp1762 = icmp sgt i32 %18, 0
br i1 %cmp1762, label %for.cond4.preheader.us.us.preheader, label %while.end
for.cond4.preheader.us.us.preheader: ; preds = %while.cond.preheader
%wide.trip.count = zext i32 %18 to i64
%min.iters.check = icmp ult i32 %18, 8
%n.vec = and i64 %wide.trip.count, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %18, 1
%unroll_iter = and i64 %wide.trip.count, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond4.preheader.us.us
for.cond4.preheader.us.us: ; preds = %for.cond4.preheader.us.us.preheader, %for.cond16.while.cond.loopexit_crit_edge.us.us
%ans.066.us.us = phi i32 [ %ans.3.us.us.lcssa, %for.cond16.while.cond.loopexit_crit_edge.us.us ], [ 0, %for.cond4.preheader.us.us.preheader ]
br i1 %min.iters.check, label %for.body7.us.us.preheader, label %vector.body
vector.body: ; preds = %for.cond4.preheader.us.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond4.preheader.us.us ]
%vec.phi = phi <4 x i32> [ %4, %vector.body ], [ zeroinitializer, %for.cond4.preheader.us.us ]
%vec.phi98 = phi <4 x i32> [ %5, %vector.body ], [ zeroinitializer, %for.cond4.preheader.us.us ]
%2 = getelementptr inbounds [101 x i32], ptr %h, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
%wide.load99 = load <4 x i32>, ptr %3, align 16, !tbaa !5
%4 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load)
%5 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi98, <4 x i32> %wide.load99)
%index.next = add nuw i64 %index, 8
%6 = icmp eq i64 %index.next, %n.vec
br i1 %6, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %4, <4 x i32> %5)
%7 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
br i1 %cmp.n, label %for.cond4.for.cond16.preheader_crit_edge.us.us, label %for.body7.us.us.preheader
for.body7.us.us.preheader: ; preds = %for.cond4.preheader.us.us, %middle.block
%indvars.iv87.ph = phi i64 [ 0, %for.cond4.preheader.us.us ], [ %n.vec, %middle.block ]
%max.159.us.us.ph = phi i32 [ 0, %for.cond4.preheader.us.us ], [ %7, %middle.block ]
br label %for.body7.us.us
for.body19.us.us: ; preds = %for.cond4.for.cond16.preheader_crit_edge.us.us, %for.inc36.us.us.1
%indvars.iv90 = phi i64 [ %12, %for.inc36.us.us.1 ], [ 0, %for.cond4.for.cond16.preheader_crit_edge.us.us ]
%ans.163.us.us = phi i32 [ %ans.3.us.us.1, %for.inc36.us.us.1 ], [ %ans.066.us.us, %for.cond4.for.cond16.preheader_crit_edge.us.us ]
%niter = phi i64 [ %niter.next.1, %for.inc36.us.us.1 ], [ 0, %for.cond4.for.cond16.preheader_crit_edge.us.us ]
%arrayidx21.us.us = getelementptr inbounds [101 x i32], ptr %h, i64 0, i64 %indvars.iv90
%8 = load i32, ptr %arrayidx21.us.us, align 8, !tbaa !5
%cmp22.us.us = icmp eq i32 %8, %spec.select.us.us.lcssa
%9 = or i64 %indvars.iv90, 1
br i1 %cmp22.us.us, label %if.then23.us.us, label %for.inc36.us.us
if.then23.us.us: ; preds = %for.body19.us.us
%arrayidx28.us.us = getelementptr inbounds [101 x i32], ptr %h, i64 0, i64 %9
%10 = load i32, ptr %arrayidx28.us.us, align 4, !tbaa !5
%cmp29.us.us = icmp ne i32 %spec.select.us.us.lcssa, %10
%inc24.us.us = zext i1 %cmp29.us.us to i32
%spec.select55.us.us = add nsw i32 %ans.163.us.us, %inc24.us.us
store i32 %dec34.us.us, ptr %arrayidx21.us.us, align 8, !tbaa !5
br label %for.inc36.us.us
for.inc36.us.us: ; preds = %for.body19.us.us, %if.then23.us.us
%ans.3.us.us = phi i32 [ %spec.select55.us.us, %if.then23.us.us ], [ %ans.163.us.us, %for.body19.us.us ]
%arrayidx21.us.us.1 = getelementptr inbounds [101 x i32], ptr %h, i64 0, i64 %9
%11 = load i32, ptr %arrayidx21.us.us.1, align 4, !tbaa !5
%cmp22.us.us.1 = icmp eq i32 %11, %spec.select.us.us.lcssa
%12 = add nuw nsw i64 %indvars.iv90, 2
br i1 %cmp22.us.us.1, label %if.then23.us.us.1, label %for.inc36.us.us.1
if.then23.us.us.1: ; preds = %for.inc36.us.us
%arrayidx28.us.us.1 = getelementptr inbounds [101 x i32], ptr %h, i64 0, i64 %12
%13 = load i32, ptr %arrayidx28.us.us.1, align 8, !tbaa !5
%cmp29.us.us.1 = icmp ne i32 %spec.select.us.us.lcssa, %13
%inc24.us.us.1 = zext i1 %cmp29.us.us.1 to i32
%spec.select55.us.us.1 = add nsw i32 %ans.3.us.us, %inc24.us.us.1
store i32 %dec34.us.us, ptr %arrayidx21.us.us.1, align 4, !tbaa !5
br label %for.inc36.us.us.1
for.inc36.us.us.1: ; preds = %if.then23.us.us.1, %for.inc36.us.us
%ans.3.us.us.1 = phi i32 [ %spec.select55.us.us.1, %if.then23.us.us.1 ], [ %ans.3.us.us, %for.inc36.us.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.cond16.while.cond.loopexit_crit_edge.us.us.unr-lcssa, label %for.body19.us.us, !llvm.loop !13
for.body7.us.us: ; preds = %for.body7.us.us.preheader, %for.body7.us.us
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.body7.us.us ], [ %indvars.iv87.ph, %for.body7.us.us.preheader ]
%max.159.us.us = phi i32 [ %spec.select.us.us, %for.body7.us.us ], [ %max.159.us.us.ph, %for.body7.us.us.preheader ]
%arrayidx9.us.us = getelementptr inbounds [101 x i32], ptr %h, i64 0, i64 %indvars.iv87
%14 = load i32, ptr %arrayidx9.us.us, align 4, !tbaa !5
%spec.select.us.us = call i32 @llvm.smax.i32(i32 %max.159.us.us, i32 %14)
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%exitcond.not = icmp eq i64 %indvars.iv.next88, %wide.trip.count
br i1 %exitcond.not, label %for.cond4.for.cond16.preheader_crit_edge.us.us, label %for.body7.us.us, !llvm.loop !14
for.cond4.for.cond16.preheader_crit_edge.us.us: ; preds = %for.body7.us.us, %middle.block
%spec.select.us.us.lcssa = phi i32 [ %7, %middle.block ], [ %spec.select.us.us, %for.body7.us.us ]
%dec34.us.us = add nsw i32 %spec.select.us.us.lcssa, -1
br i1 %1, label %for.cond16.while.cond.loopexit_crit_edge.us.us.unr-lcssa, label %for.body19.us.us
for.cond16.while.cond.loopexit_crit_edge.us.us.unr-lcssa: ; preds = %for.inc36.us.us.1, %for.cond4.for.cond16.preheader_crit_edge.us.us
%ans.3.us.us.lcssa.ph = phi i32 [ undef, %for.cond4.for.cond16.preheader_crit_edge.us.us ], [ %ans.3.us.us.1, %for.inc36.us.us.1 ]
%indvars.iv90.unr = phi i64 [ 0, %for.cond4.for.cond16.preheader_crit_edge.us.us ], [ %12, %for.inc36.us.us.1 ]
%ans.163.us.us.unr = phi i32 [ %ans.066.us.us, %for.cond4.for.cond16.preheader_crit_edge.us.us ], [ %ans.3.us.us.1, %for.inc36.us.us.1 ]
br i1 %lcmp.mod.not, label %for.cond16.while.cond.loopexit_crit_edge.us.us, label %for.body19.us.us.epil
for.body19.us.us.epil: ; preds = %for.cond16.while.cond.loopexit_crit_edge.us.us.unr-lcssa
%arrayidx21.us.us.epil = getelementptr inbounds [101 x i32], ptr %h, i64 0, i64 %indvars.iv90.unr
%15 = load i32, ptr %arrayidx21.us.us.epil, align 4, !tbaa !5
%cmp22.us.us.epil = icmp eq i32 %15, %spec.select.us.us.lcssa
br i1 %cmp22.us.us.epil, label %if.then23.us.us.epil, label %for.cond16.while.cond.loopexit_crit_edge.us.us
if.then23.us.us.epil: ; preds = %for.body19.us.us.epil
%16 = add nuw nsw i64 %indvars.iv90.unr, 1
%arrayidx28.us.us.epil = getelementptr inbounds [101 x i32], ptr %h, i64 0, i64 %16
%17 = load i32, ptr %arrayidx28.us.us.epil, align 4, !tbaa !5
%cmp29.us.us.epil = icmp ne i32 %spec.select.us.us.lcssa, %17
%inc24.us.us.epil = zext i1 %cmp29.us.us.epil to i32
%spec.select55.us.us.epil = add nsw i32 %ans.163.us.us.unr, %inc24.us.us.epil
store i32 %dec34.us.us, ptr %arrayidx21.us.us.epil, align 4, !tbaa !5
br label %for.cond16.while.cond.loopexit_crit_edge.us.us
for.cond16.while.cond.loopexit_crit_edge.us.us: ; preds = %for.body19.us.us.epil, %if.then23.us.us.epil, %for.cond16.while.cond.loopexit_crit_edge.us.us.unr-lcssa
%ans.3.us.us.lcssa = phi i32 [ %ans.3.us.us.lcssa.ph, %for.cond16.while.cond.loopexit_crit_edge.us.us.unr-lcssa ], [ %spec.select55.us.us.epil, %if.then23.us.us.epil ], [ %ans.163.us.us.unr, %for.body19.us.us.epil ]
%cmp2.not.us.us = icmp eq i32 %spec.select.us.us.lcssa, 0
br i1 %cmp2.not.us.us, label %while.end, label %for.cond4.preheader.us.us, !llvm.loop !15
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 x i32], ptr %h, 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
%18 = load i32, ptr %n, align 4, !tbaa !5
%19 = sext i32 %18 to i64
%cmp = icmp slt i64 %indvars.iv.next, %19
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !16
while.end: ; preds = %for.cond16.while.cond.loopexit_crit_edge.us.us, %entry, %while.cond.preheader
%.us-phi = phi i32 [ 0, %while.cond.preheader ], [ 0, %entry ], [ %ans.3.us.us.lcssa, %for.cond16.while.cond.loopexit_crit_edge.us.us ]
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.us-phi)
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
int main(void)
{
int n, h[100], i, ans=0, p, cnt=0;
scanf("%d", &n);
for(i=0;i<n;i++){
scanf("%d", &h[i]);
}
while(1){
p=0;cnt=0;
for(i=0;i<n;i++){
if(h[i] != 0){
p=1;
h[i]=h[i]-1;
}
else if(h[i]==0 && p==1){
break;
}
}
if(p==1) ans++;
for(i=0;i<n;i++){
if(h[i]==0) cnt++;
}
if(cnt==n) break;
}
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322863/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322863/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%h = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %h) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body, label %while.cond.preheader.split.split
while.cond.preheader: ; preds = %for.body
%cmp359 = icmp sgt i32 %13, 0
br i1 %cmp359, label %while.cond.us.us.preheader, label %while.cond.preheader.split.split
while.cond.us.us.preheader: ; preds = %while.cond.preheader
%wide.trip.count = zext i32 %13 to i64
%min.iters.check = icmp ult i32 %13, 8
%n.vec = and i64 %wide.trip.count, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %while.cond.us.us
while.cond.us.us: ; preds = %while.cond.us.us.preheader, %for.cond25.for.end36_crit_edge.us.us
%ans.0.us.us = phi i32 [ %ans.1.us.us, %for.cond25.for.end36_crit_edge.us.us ], [ 0, %while.cond.us.us.preheader ]
br label %for.body4.us.us
for.body4.us.us: ; preds = %for.body4.us.us.backedge, %while.cond.us.us
%indvars.iv92 = phi i64 [ 0, %while.cond.us.us ], [ %indvars.iv92.be, %for.body4.us.us.backedge ]
%cond.us.us = phi i1 [ false, %while.cond.us.us ], [ %cmp7.not.us.us.not, %for.body4.us.us.backedge ]
%arrayidx6.us.us = getelementptr inbounds [100 x i32], ptr %h, i64 0, i64 %indvars.iv92
%1 = load i32, ptr %arrayidx6.us.us, align 4, !tbaa !5
%cmp7.not.us.us.not = icmp ne i32 %1, 0
br i1 %cmp7.not.us.us.not, label %for.inc18.us.us.thread, label %if.else.us.us
if.else.us.us: ; preds = %for.body4.us.us
br i1 %cond.us.us, label %if.then22.us.us, label %for.inc18.us.us
for.inc18.us.us: ; preds = %if.else.us.us
%indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
%exitcond.not = icmp eq i64 %indvars.iv.next93, %wide.trip.count
br i1 %exitcond.not, label %if.end24.us.us, label %for.body4.us.us.backedge
for.body4.us.us.backedge: ; preds = %for.inc18.us.us, %for.inc18.us.us.thread
%indvars.iv92.be = phi i64 [ %indvars.iv.next93, %for.inc18.us.us ], [ %indvars.iv.next93104, %for.inc18.us.us.thread ]
br label %for.body4.us.us, !llvm.loop !9
for.inc18.us.us.thread: ; preds = %for.body4.us.us
%sub.us.us = add nsw i32 %1, -1
store i32 %sub.us.us, ptr %arrayidx6.us.us, align 4, !tbaa !5
%indvars.iv.next93104 = add nuw nsw i64 %indvars.iv92, 1
%exitcond.not105 = icmp eq i64 %indvars.iv.next93104, %wide.trip.count
br i1 %exitcond.not105, label %if.then22.us.us, label %for.body4.us.us.backedge
if.then22.us.us: ; preds = %for.inc18.us.us.thread, %if.else.us.us
%inc23.us.us = add nsw i32 %ans.0.us.us, 1
br label %if.end24.us.us
if.end24.us.us: ; preds = %for.inc18.us.us, %if.then22.us.us
%ans.1.us.us = phi i32 [ %inc23.us.us, %if.then22.us.us ], [ %ans.0.us.us, %for.inc18.us.us ]
br i1 %min.iters.check, label %for.body27.us.us.preheader, label %vector.body
vector.body: ; preds = %if.end24.us.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %if.end24.us.us ]
%vec.phi = phi <4 x i32> [ %8, %vector.body ], [ zeroinitializer, %if.end24.us.us ]
%vec.phi107 = phi <4 x i32> [ %9, %vector.body ], [ zeroinitializer, %if.end24.us.us ]
%2 = getelementptr inbounds [100 x i32], ptr %h, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
%wide.load108 = load <4 x i32>, ptr %3, align 16, !tbaa !5
%4 = icmp eq <4 x i32> %wide.load, zeroinitializer
%5 = icmp eq <4 x i32> %wide.load108, zeroinitializer
%6 = zext <4 x i1> %4 to <4 x i32>
%7 = zext <4 x i1> %5 to <4 x i32>
%8 = add <4 x i32> %vec.phi, %6
%9 = add <4 x i32> %vec.phi107, %7
%index.next = add nuw i64 %index, 8
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %9, %8
%11 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond25.for.end36_crit_edge.us.us, label %for.body27.us.us.preheader
for.body27.us.us.preheader: ; preds = %if.end24.us.us, %middle.block
%indvars.iv95.ph = phi i64 [ 0, %if.end24.us.us ], [ %n.vec, %middle.block ]
%cnt.065.us.us.ph = phi i32 [ 0, %if.end24.us.us ], [ %11, %middle.block ]
br label %for.body27.us.us
for.body27.us.us: ; preds = %for.body27.us.us.preheader, %for.body27.us.us
%indvars.iv95 = phi i64 [ %indvars.iv.next96, %for.body27.us.us ], [ %indvars.iv95.ph, %for.body27.us.us.preheader ]
%cnt.065.us.us = phi i32 [ %spec.select.us.us, %for.body27.us.us ], [ %cnt.065.us.us.ph, %for.body27.us.us.preheader ]
%arrayidx29.us.us = getelementptr inbounds [100 x i32], ptr %h, i64 0, i64 %indvars.iv95
%12 = load i32, ptr %arrayidx29.us.us, align 4, !tbaa !5
%cmp30.us.us = icmp eq i32 %12, 0
%inc32.us.us = zext i1 %cmp30.us.us to i32
%spec.select.us.us = add nuw nsw i32 %cnt.065.us.us, %inc32.us.us
%indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
%exitcond99.not = icmp eq i64 %indvars.iv.next96, %wide.trip.count
br i1 %exitcond99.not, label %for.cond25.for.end36_crit_edge.us.us, label %for.body27.us.us, !llvm.loop !14
for.cond25.for.end36_crit_edge.us.us: ; preds = %for.body27.us.us, %middle.block
%spec.select.us.us.lcssa = phi i32 [ %11, %middle.block ], [ %spec.select.us.us, %for.body27.us.us ]
%cmp37.us.us = icmp eq i32 %spec.select.us.us.lcssa, %13
br i1 %cmp37.us.us, label %while.end, label %while.cond.us.us
while.cond.preheader.split.split: ; preds = %entry, %while.cond.preheader
%.lcssa102 = phi i32 [ %13, %while.cond.preheader ], [ %0, %entry ]
%cmp37 = icmp eq i32 %.lcssa102, 0
br i1 %cmp37, label %while.end, label %while.cond
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %h, 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
%13 = load i32, ptr %n, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp = icmp slt i64 %indvars.iv.next, %14
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !15
while.cond: ; preds = %while.cond.preheader.split.split, %while.cond
br label %while.cond
while.end: ; preds = %for.cond25.for.end36_crit_edge.us.us, %while.cond.preheader.split.split
%.us-phi = phi i32 [ 0, %while.cond.preheader.split.split ], [ %ans.1.us.us, %for.cond25.for.end36_crit_edge.us.us ]
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.us-phi)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %h) #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.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}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
int solve(int data[],int size);
int main()
{
int n,i,j,ans=0,h[110]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&(h[i]));
}
ans=solve(h,n);
printf("%d",ans);
}
int solve(int data[],int size)
{
/*
printf("\nsolve:\ndata:");
int k;
for(k=0;k<size;k++)printf("%d ",data[k]);
printf("\ndatasize:%d\n",size);
*/
if(size==0)return 0;
else if(size==1)return data[0];
else
{
int i,j,min=1000,kari=0;
for(i=0;i<size;i++)
{
if(min>data[i])min=data[i];
}
kari+=min;
//printf("min:%d\n",min);
for(i=0;i<size;i++)
{
data[i]-=min;
//printf("bysolve:data:%d\n",data[i]);
}
int nexts=0;
int nextdata[110]={0};
for(i=0;i<size;i++)
{
nextdata[nexts]=data[i];
if(data[i]==0)
{
kari+=solve(nextdata,nexts);
nexts=0;
}
else nexts++;
}
kari+=solve(nextdata,nexts);
//printf("now:%d\n",kari);
return kari;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322913/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322913/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%h = alloca [110 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 440, ptr nonnull %h) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(440) %h, i8 0, i64 440, 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
%cmp6 = icmp sgt i32 %0, 0
br i1 %cmp6, 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 [110 x i32], ptr %h, 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 ]
%call2 = call i32 @solve(ptr noundef nonnull %h, i32 noundef %.lcssa)
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %call2)
call void @llvm.lifetime.end.p0(i64 440, ptr nonnull %h) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @solve(ptr nocapture noundef %data, i32 noundef %size) local_unnamed_addr #4 {
entry:
%nextdata = alloca [110 x i32], align 16
switch i32 %size, label %for.cond.preheader [
i32 0, label %return
i32 1, label %if.then2
]
for.cond.preheader: ; preds = %entry
%cmp466 = icmp sgt i32 %size, 0
br i1 %cmp466, label %for.body.preheader, label %for.end17.thread
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %size to i64
%min.iters.check = icmp ult i32 %size, 8
br i1 %min.iters.check, label %for.body.preheader107, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1000, i32 1000, i32 1000, i32 1000>, %vector.ph ], [ %2, %vector.body ]
%vec.phi91 = phi <4 x i32> [ <i32 1000, i32 1000, i32 1000, i32 1000>, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i32, ptr %data, i64 %index
%wide.load = load <4 x i32>, ptr %0, align 4, !tbaa !5
%1 = getelementptr inbounds i32, ptr %0, i64 4
%wide.load92 = load <4 x i32>, ptr %1, align 4, !tbaa !5
%2 = tail call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load)
%3 = tail call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi91, <4 x i32> %wide.load92)
%index.next = add nuw i64 %index, 8
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%rdx.minmax = tail call <4 x i32> @llvm.smin.v4i32(<4 x i32> %2, <4 x i32> %3)
%5 = tail call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond10.preheader, label %for.body.preheader107
for.body.preheader107: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%min.068.ph = phi i32 [ 1000, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
if.then2: ; preds = %entry
%6 = load i32, ptr %data, align 4, !tbaa !5
br label %return
for.cond10.preheader: ; preds = %for.body, %middle.block
%spec.select.lcssa = phi i32 [ %5, %middle.block ], [ %spec.select, %for.body ]
br i1 %cmp466, label %for.body12.preheader, label %for.end17.thread
for.body12.preheader: ; preds = %for.cond10.preheader
%wide.trip.count81 = zext i32 %size to i64
%min.iters.check95 = icmp ult i32 %size, 8
br i1 %min.iters.check95, label %for.body12.preheader106, label %vector.ph96
vector.ph96: ; preds = %for.body12.preheader
%n.vec98 = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %spec.select.lcssa, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body101
vector.body101: ; preds = %vector.body101, %vector.ph96
%index102 = phi i64 [ 0, %vector.ph96 ], [ %index.next105, %vector.body101 ]
%7 = getelementptr inbounds i32, ptr %data, i64 %index102
%wide.load103 = load <4 x i32>, ptr %7, align 4, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
%wide.load104 = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = sub nsw <4 x i32> %wide.load103, %broadcast.splat
%10 = sub nsw <4 x i32> %wide.load104, %broadcast.splat
store <4 x i32> %9, ptr %7, align 4, !tbaa !5
store <4 x i32> %10, ptr %8, align 4, !tbaa !5
%index.next105 = add nuw i64 %index102, 8
%11 = icmp eq i64 %index.next105, %n.vec98
br i1 %11, label %middle.block93, label %vector.body101, !llvm.loop !14
middle.block93: ; preds = %vector.body101
%cmp.n100 = icmp eq i64 %n.vec98, %wide.trip.count
br i1 %cmp.n100, label %for.end17, label %for.body12.preheader106
for.body12.preheader106: ; preds = %for.body12.preheader, %middle.block93
%indvars.iv78.ph = phi i64 [ 0, %for.body12.preheader ], [ %n.vec98, %middle.block93 ]
br label %for.body12
for.body: ; preds = %for.body.preheader107, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader107 ]
%min.068 = phi i32 [ %spec.select, %for.body ], [ %min.068.ph, %for.body.preheader107 ]
%arrayidx5 = getelementptr inbounds i32, ptr %data, i64 %indvars.iv
%12 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%spec.select = tail call i32 @llvm.smin.i32(i32 %min.068, i32 %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.cond10.preheader, label %for.body, !llvm.loop !15
for.body12: ; preds = %for.body12.preheader106, %for.body12
%indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.body12 ], [ %indvars.iv78.ph, %for.body12.preheader106 ]
%arrayidx14 = getelementptr inbounds i32, ptr %data, i64 %indvars.iv78
%13 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%sub = sub nsw i32 %13, %spec.select.lcssa
store i32 %sub, ptr %arrayidx14, align 4, !tbaa !5
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%exitcond82.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count81
br i1 %exitcond82.not, label %for.end17, label %for.body12, !llvm.loop !16
for.end17.thread: ; preds = %for.cond10.preheader, %for.cond.preheader
%min.0.lcssa89.ph = phi i32 [ %spec.select.lcssa, %for.cond10.preheader ], [ 1000, %for.cond.preheader ]
call void @llvm.lifetime.start.p0(i64 440, ptr nonnull %nextdata) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(440) %nextdata, i8 0, i64 440, i1 false)
br label %for.end35
for.end17: ; preds = %for.body12, %middle.block93
call void @llvm.lifetime.start.p0(i64 440, ptr nonnull %nextdata) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(440) %nextdata, i8 0, i64 440, i1 false)
br i1 %cmp466, label %for.body20.preheader, label %for.end35
for.body20.preheader: ; preds = %for.end17
%wide.trip.count86 = zext i32 %size to i64
br label %for.body20
for.body20: ; preds = %for.body20.preheader, %for.inc33
%indvars.iv83 = phi i64 [ 0, %for.body20.preheader ], [ %indvars.iv.next84, %for.inc33 ]
%nexts.074 = phi i32 [ 0, %for.body20.preheader ], [ %nexts.1, %for.inc33 ]
%kari.073 = phi i32 [ %spec.select.lcssa, %for.body20.preheader ], [ %kari.1, %for.inc33 ]
%arrayidx22 = getelementptr inbounds i32, ptr %data, i64 %indvars.iv83
%14 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%idxprom23 = sext i32 %nexts.074 to i64
%arrayidx24 = getelementptr inbounds [110 x i32], ptr %nextdata, i64 0, i64 %idxprom23
store i32 %14, ptr %arrayidx24, align 4, !tbaa !5
%cmp27 = icmp eq i32 %14, 0
br i1 %cmp27, label %if.then28, label %if.else30
if.then28: ; preds = %for.body20
%call = call i32 @solve(ptr noundef nonnull %nextdata, i32 noundef %nexts.074)
%add29 = add nsw i32 %call, %kari.073
br label %for.inc33
if.else30: ; preds = %for.body20
%inc31 = add nsw i32 %nexts.074, 1
br label %for.inc33
for.inc33: ; preds = %if.then28, %if.else30
%kari.1 = phi i32 [ %add29, %if.then28 ], [ %kari.073, %if.else30 ]
%nexts.1 = phi i32 [ 0, %if.then28 ], [ %inc31, %if.else30 ]
%indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
%exitcond87.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count86
br i1 %exitcond87.not, label %for.end35, label %for.body20, !llvm.loop !17
for.end35: ; preds = %for.inc33, %for.end17.thread, %for.end17
%kari.0.lcssa = phi i32 [ %spec.select.lcssa, %for.end17 ], [ %min.0.lcssa89.ph, %for.end17.thread ], [ %kari.1, %for.inc33 ]
%nexts.0.lcssa = phi i32 [ 0, %for.end17 ], [ 0, %for.end17.thread ], [ %nexts.1, %for.inc33 ]
%call37 = call i32 @solve(ptr noundef nonnull %nextdata, i32 noundef %nexts.0.lcssa)
%add38 = add nsw i32 %call37, %kari.0.lcssa
call void @llvm.lifetime.end.p0(i64 440, ptr nonnull %nextdata) #6
br label %return
return: ; preds = %entry, %for.end35, %if.then2
%retval.0 = phi i32 [ %6, %if.then2 ], [ %add38, %for.end35 ], [ %size, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smin.v4i32(<4 x i32>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #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, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !12, !13}
!15 = distinct !{!15, !10, !13, !12}
!16 = distinct !{!16, !10, !13, !12}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
int main(void)
{
int w,h,c,i,j;
scanf("%d%d%d",&w,&h,&c);
for(i=1;i<=h||i<=w;i++){
if(w%i==0&&h%i==0){
j=(w/i)*(h/i);
}
}
printf("%d\n",j*c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_322964/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_322964/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%w = alloca i32, align 4
%h = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w, ptr noundef nonnull %h, ptr noundef nonnull %c)
%0 = load i32, ptr %h, align 4, !tbaa !5
%1 = load i32, ptr %w, align 4
%.fr = freeze i32 %1
%invariant.smax = call i32 @llvm.smax.i32(i32 %0, i32 %.fr)
%2 = icmp sgt i32 %invariant.smax, 0
br i1 %2, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%j.015 = phi i32 [ %j.1, %for.inc ], [ undef, %entry ]
%i.014 = phi i32 [ %inc, %for.inc ], [ 1, %entry ]
%rem = srem i32 %.fr, %i.014
%div = sdiv i32 %.fr, %i.014
%cmp2 = icmp eq i32 %rem, 0
br i1 %cmp2, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%rem3 = srem i32 %0, %i.014
%div5 = sdiv i32 %0, %i.014
%cmp4 = icmp eq i32 %rem3, 0
br i1 %cmp4, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true
%mul = mul nsw i32 %div5, %div
br label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true, %if.then
%j.1 = phi i32 [ %mul, %if.then ], [ %j.015, %land.lhs.true ], [ %j.015, %for.body ]
%inc = add nuw i32 %i.014, 1
%exitcond.not = icmp eq i32 %i.014, %invariant.smax
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%j.0.lcssa = phi i32 [ undef, %entry ], [ %j.1, %for.inc ]
%3 = load i32, ptr %c, align 4, !tbaa !5
%mul6 = mul nsw i32 %3, %j.0.lcssa
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul6)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_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(){
int A,B,C,c[3];
while(1){
scanf("%d%d",&A,&B);
if(A == 0 && B == 0)break;
C = B-A;
if(C >= 1000){
c[2] = C / 1000;
C = C - c[2]*1000;
}
else c[2] = 0;
if(C >= 500){
c[1] = C / 500;
C = C - 500;
}
else c[1] = 0;
if(C >= 100){
c[0] = C / 100;
}
else c[0] = 0;
printf("%d %d %d\n",c[0],c[1],c[2]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323013/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323013/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
%call35 = 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
%cmp36 = icmp eq i32 %0, 0
%1 = load i32, ptr %B, align 4
%cmp137 = icmp eq i32 %1, 0
%or.cond38 = select i1 %cmp36, i1 %cmp137, i1 false
br i1 %or.cond38, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end15
%2 = phi i32 [ %5, %if.end15 ], [ %1, %entry ]
%3 = phi i32 [ %4, %if.end15 ], [ %0, %entry ]
%sub = sub nsw i32 %2, %3
%cmp2 = icmp sgt i32 %sub, 999
br i1 %cmp2, label %if.then3, label %if.end7
if.then3: ; preds = %if.end
%div = udiv i32 %sub, 1000
%mul.neg = mul nsw i32 %div, -1000
%sub5 = add nsw i32 %mul.neg, %sub
br label %if.end7
if.end7: ; preds = %if.end, %if.then3
%C.0 = phi i32 [ %sub5, %if.then3 ], [ %sub, %if.end ]
%c.sroa.8.0 = phi i32 [ %div, %if.then3 ], [ 0, %if.end ]
%cmp8 = icmp sgt i32 %C.0, 499
br i1 %cmp8, label %if.then9, label %if.end15
if.then9: ; preds = %if.end7
%div10 = udiv i32 %C.0, 500
%sub12 = add nsw i32 %C.0, -500
br label %if.end15
if.end15: ; preds = %if.end7, %if.then9
%C.1 = phi i32 [ %sub12, %if.then9 ], [ %C.0, %if.end7 ]
%c.sroa.5.0 = phi i32 [ %div10, %if.then9 ], [ 0, %if.end7 ]
%cmp16 = icmp sgt i32 %C.1, 99
%div18 = udiv i32 %C.1, 100
%c.sroa.0.0 = select i1 %cmp16, i32 %div18, i32 0
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.sroa.0.0, i32 noundef %c.sroa.5.0, i32 noundef %c.sroa.8.0)
%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
%cmp = icmp eq i32 %4, 0
%5 = load i32, ptr %B, align 4
%cmp1 = icmp eq i32 %5, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %if.end
while.end: ; preds = %if.end15, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
struct _data{
char hit[10];
int money;
}typedef _data;
_data d[105];
int isHit(char hit[],int n){
int i;
for(i=7;i>=0;i--){
if(d[n].hit[i]=='*')break;
else if(d[n].hit[i]!=hit[i])return 0;
}
return 1;
}
int main(){
int n,m,i,j,money,sum;
char hit[10],num[10];
for(;scanf("%d %d",&n,&m)&&(n||m);){
sum=0;
for(i=0;i<n;i++){
scanf("%s %d",hit,&money);
strcpy(d[i].hit,hit);
d[i].money=money;
}
for(i=0;i<m;i++){
scanf("%s",num);
for(j=0;j<n;j++){
if(isHit(num,j))sum+=d[j].money;
}
}
printf("%d\n",sum);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323064/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323064/source.c"
target datalayout = "e-m:e-p270: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._data = type { [10 x i8], i32 }
@d = dso_local global [105 x %struct._data] zeroinitializer, align 16
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %d\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @isHit(ptr nocapture noundef readonly %hit, i32 noundef %n) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %n to i64
%arrayidx = getelementptr inbounds [105 x %struct._data], ptr @d, i64 0, i64 %idxprom
%arrayidx3 = getelementptr inbounds [10 x i8], ptr %arrayidx, i64 0, i64 7
%0 = load i8, ptr %arrayidx3, align 1, !tbaa !5
%cmp4 = icmp eq i8 %0, 42
br i1 %cmp4, label %cleanup, label %if.else
for.cond: ; preds = %if.else
%arrayidx3.1 = getelementptr inbounds [10 x i8], ptr %arrayidx, i64 0, i64 6
%1 = load i8, ptr %arrayidx3.1, align 2, !tbaa !5
%cmp4.1 = icmp eq i8 %1, 42
br i1 %cmp4.1, label %cleanup, label %if.else.1
if.else.1: ; preds = %for.cond
%arrayidx13.1 = getelementptr inbounds i8, ptr %hit, i64 6
%2 = load i8, ptr %arrayidx13.1, align 1, !tbaa !5
%cmp15.not.1 = icmp eq i8 %1, %2
br i1 %cmp15.not.1, label %for.cond.1, label %cleanup
for.cond.1: ; preds = %if.else.1
%arrayidx3.2 = getelementptr inbounds [10 x i8], ptr %arrayidx, i64 0, i64 5
%3 = load i8, ptr %arrayidx3.2, align 1, !tbaa !5
%cmp4.2 = icmp eq i8 %3, 42
br i1 %cmp4.2, label %cleanup, label %if.else.2
if.else.2: ; preds = %for.cond.1
%arrayidx13.2 = getelementptr inbounds i8, ptr %hit, i64 5
%4 = load i8, ptr %arrayidx13.2, align 1, !tbaa !5
%cmp15.not.2 = icmp eq i8 %3, %4
br i1 %cmp15.not.2, label %for.cond.2, label %cleanup
for.cond.2: ; preds = %if.else.2
%arrayidx3.3 = getelementptr inbounds [10 x i8], ptr %arrayidx, i64 0, i64 4
%5 = load i8, ptr %arrayidx3.3, align 4, !tbaa !5
%cmp4.3 = icmp eq i8 %5, 42
br i1 %cmp4.3, label %cleanup, label %if.else.3
if.else.3: ; preds = %for.cond.2
%arrayidx13.3 = getelementptr inbounds i8, ptr %hit, i64 4
%6 = load i8, ptr %arrayidx13.3, align 1, !tbaa !5
%cmp15.not.3 = icmp eq i8 %5, %6
br i1 %cmp15.not.3, label %for.cond.3, label %cleanup
for.cond.3: ; preds = %if.else.3
%arrayidx3.4 = getelementptr inbounds [10 x i8], ptr %arrayidx, i64 0, i64 3
%7 = load i8, ptr %arrayidx3.4, align 1, !tbaa !5
%cmp4.4 = icmp eq i8 %7, 42
br i1 %cmp4.4, label %cleanup, label %if.else.4
if.else.4: ; preds = %for.cond.3
%arrayidx13.4 = getelementptr inbounds i8, ptr %hit, i64 3
%8 = load i8, ptr %arrayidx13.4, align 1, !tbaa !5
%cmp15.not.4 = icmp eq i8 %7, %8
br i1 %cmp15.not.4, label %for.cond.4, label %cleanup
for.cond.4: ; preds = %if.else.4
%arrayidx3.5 = getelementptr inbounds [10 x i8], ptr %arrayidx, i64 0, i64 2
%9 = load i8, ptr %arrayidx3.5, align 2, !tbaa !5
%cmp4.5 = icmp eq i8 %9, 42
br i1 %cmp4.5, label %cleanup, label %if.else.5
if.else.5: ; preds = %for.cond.4
%arrayidx13.5 = getelementptr inbounds i8, ptr %hit, i64 2
%10 = load i8, ptr %arrayidx13.5, align 1, !tbaa !5
%cmp15.not.5 = icmp eq i8 %9, %10
br i1 %cmp15.not.5, label %for.cond.5, label %cleanup
for.cond.5: ; preds = %if.else.5
%arrayidx3.6 = getelementptr inbounds [10 x i8], ptr %arrayidx, i64 0, i64 1
%11 = load i8, ptr %arrayidx3.6, align 1, !tbaa !5
%cmp4.6 = icmp eq i8 %11, 42
br i1 %cmp4.6, label %cleanup, label %if.else.6
if.else.6: ; preds = %for.cond.5
%arrayidx13.6 = getelementptr inbounds i8, ptr %hit, i64 1
%12 = load i8, ptr %arrayidx13.6, align 1, !tbaa !5
%cmp15.not.6 = icmp eq i8 %11, %12
br i1 %cmp15.not.6, label %for.cond.6, label %cleanup
for.cond.6: ; preds = %if.else.6
%13 = load i8, ptr %arrayidx, align 16, !tbaa !5
%cmp4.7 = icmp eq i8 %13, 42
br i1 %cmp4.7, label %cleanup, label %if.else.7
if.else.7: ; preds = %for.cond.6
%14 = load i8, ptr %hit, align 1, !tbaa !5
%cmp15.not.7 = icmp eq i8 %13, %14
%spec.select = zext i1 %cmp15.not.7 to i32
br label %cleanup
if.else: ; preds = %entry
%arrayidx13 = getelementptr inbounds i8, ptr %hit, i64 7
%15 = load i8, ptr %arrayidx13, align 1, !tbaa !5
%cmp15.not = icmp eq i8 %0, %15
br i1 %cmp15.not, label %for.cond, label %cleanup
cleanup: ; preds = %if.else.7, %for.cond.6, %if.else.6, %for.cond.5, %if.else.5, %for.cond.4, %if.else.4, %for.cond.3, %if.else.3, %for.cond.2, %if.else.2, %for.cond.1, %if.else.1, %for.cond, %entry, %if.else
%retval.0 = phi i32 [ 0, %if.else ], [ 1, %entry ], [ 1, %for.cond ], [ 0, %if.else.1 ], [ 1, %for.cond.1 ], [ 0, %if.else.2 ], [ 1, %for.cond.2 ], [ 0, %if.else.3 ], [ 1, %for.cond.3 ], [ 0, %if.else.4 ], [ 1, %for.cond.4 ], [ 0, %if.else.5 ], [ 1, %for.cond.5 ], [ 0, %if.else.6 ], [ 1, %for.cond.6 ], [ %spec.select, %if.else.7 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%money = alloca i32, align 4
%hit = alloca [10 x i8], align 1
%num = alloca [10 x i8], align 1
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 %money) #5
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %hit) #5
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %num) #5
%call59 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%tobool.not60 = icmp eq i32 %call59, 0
br i1 %tobool.not60, label %for.end34, label %land.rhs.lr.ph
land.rhs.lr.ph: ; preds = %entry
%arrayidx13.i = getelementptr inbounds i8, ptr %num, i64 7
%arrayidx13.1.i = getelementptr inbounds i8, ptr %num, i64 6
%arrayidx13.2.i = getelementptr inbounds i8, ptr %num, i64 5
%arrayidx13.3.i = getelementptr inbounds i8, ptr %num, i64 4
%arrayidx13.4.i = getelementptr inbounds i8, ptr %num, i64 3
%arrayidx13.5.i = getelementptr inbounds i8, ptr %num, i64 2
%arrayidx13.6.i = getelementptr inbounds i8, ptr %num, i64 1
br label %land.rhs
land.rhs: ; preds = %land.rhs.lr.ph, %for.end32
%0 = load i32, ptr %n, align 4, !tbaa !8
%tobool1 = icmp ne i32 %0, 0
%1 = load i32, ptr %m, align 4
%tobool2 = icmp ne i32 %1, 0
%2 = select i1 %tobool1, i1 true, i1 %tobool2
br i1 %2, label %for.cond3.preheader, label %for.end34
for.cond3.preheader: ; preds = %land.rhs
%cmp50 = icmp sgt i32 %0, 0
br i1 %cmp50, label %for.body4, label %for.cond13.preheader
for.cond13.preheader.loopexit: ; preds = %for.body4
%.pre = load i32, ptr %m, align 4, !tbaa !8
br label %for.cond13.preheader
for.cond13.preheader: ; preds = %for.cond13.preheader.loopexit, %for.cond3.preheader
%3 = phi i32 [ %.pre, %for.cond13.preheader.loopexit ], [ %1, %for.cond3.preheader ]
%cmp1455 = icmp sgt i32 %3, 0
br i1 %cmp1455, label %for.body15, label %for.end32
for.body4: ; preds = %for.cond3.preheader, %for.body4
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 0, %for.cond3.preheader ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %hit, ptr noundef nonnull %money)
%arrayidx = getelementptr inbounds [105 x %struct._data], ptr @d, i64 0, i64 %indvars.iv
%call9 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx, ptr noundef nonnull dereferenceable(1) %hit) #5
%4 = load i32, ptr %money, align 4, !tbaa !8
%money12 = getelementptr inbounds [105 x %struct._data], ptr @d, i64 0, i64 %indvars.iv, i32 1
store i32 %4, ptr %money12, align 4, !tbaa !10
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !8
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body4, label %for.cond13.preheader.loopexit, !llvm.loop !12
for.body15: ; preds = %for.cond13.preheader, %for.inc30
%sum.057 = phi i32 [ %sum.1.lcssa, %for.inc30 ], [ 0, %for.cond13.preheader ]
%i.156 = phi i32 [ %inc31, %for.inc30 ], [ 0, %for.cond13.preheader ]
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %num)
%7 = load i32, ptr %n, align 4, !tbaa !8
%cmp1952 = icmp sgt i32 %7, 0
br i1 %cmp1952, label %for.body20.lr.ph, label %for.inc30
for.body20.lr.ph: ; preds = %for.body15
%8 = load i8, ptr %arrayidx13.i, align 1
%9 = load i8, ptr %arrayidx13.1.i, align 1
%10 = load i8, ptr %arrayidx13.2.i, align 1
%11 = load i8, ptr %arrayidx13.3.i, align 1
%12 = load i8, ptr %arrayidx13.4.i, align 1
%13 = load i8, ptr %arrayidx13.5.i, align 1
%14 = load i8, ptr %arrayidx13.6.i, align 1
%15 = load i8, ptr %num, align 1
%wide.trip.count = zext i32 %7 to i64
br label %for.body20
for.body20: ; preds = %for.body20.lr.ph, %for.inc27
%indvars.iv62 = phi i64 [ 0, %for.body20.lr.ph ], [ %indvars.iv.next63, %for.inc27 ]
%sum.154 = phi i32 [ %sum.057, %for.body20.lr.ph ], [ %sum.2, %for.inc27 ]
%arrayidx.i = getelementptr inbounds [105 x %struct._data], ptr @d, i64 0, i64 %indvars.iv62
%arrayidx3.i = getelementptr inbounds [10 x i8], ptr %arrayidx.i, i64 0, i64 7
%16 = load i8, ptr %arrayidx3.i, align 1, !tbaa !5
%cmp4.i = icmp eq i8 %16, 42
br i1 %cmp4.i, label %if.then, label %if.else.i
for.cond.i: ; preds = %if.else.i
%arrayidx3.1.i = getelementptr inbounds [10 x i8], ptr %arrayidx.i, i64 0, i64 6
%17 = load i8, ptr %arrayidx3.1.i, align 2, !tbaa !5
%cmp4.1.i = icmp eq i8 %17, 42
br i1 %cmp4.1.i, label %if.then, label %if.else.1.i
if.else.1.i: ; preds = %for.cond.i
%cmp15.not.1.i = icmp eq i8 %17, %9
br i1 %cmp15.not.1.i, label %for.cond.1.i, label %for.inc27
for.cond.1.i: ; preds = %if.else.1.i
%arrayidx3.2.i = getelementptr inbounds [10 x i8], ptr %arrayidx.i, i64 0, i64 5
%18 = load i8, ptr %arrayidx3.2.i, align 1, !tbaa !5
%cmp4.2.i = icmp eq i8 %18, 42
br i1 %cmp4.2.i, label %if.then, label %if.else.2.i
if.else.2.i: ; preds = %for.cond.1.i
%cmp15.not.2.i = icmp eq i8 %18, %10
br i1 %cmp15.not.2.i, label %for.cond.2.i, label %for.inc27
for.cond.2.i: ; preds = %if.else.2.i
%arrayidx3.3.i = getelementptr inbounds [10 x i8], ptr %arrayidx.i, i64 0, i64 4
%19 = load i8, ptr %arrayidx3.3.i, align 4, !tbaa !5
%cmp4.3.i = icmp eq i8 %19, 42
br i1 %cmp4.3.i, label %if.then, label %if.else.3.i
if.else.3.i: ; preds = %for.cond.2.i
%cmp15.not.3.i = icmp eq i8 %19, %11
br i1 %cmp15.not.3.i, label %for.cond.3.i, label %for.inc27
for.cond.3.i: ; preds = %if.else.3.i
%arrayidx3.4.i = getelementptr inbounds [10 x i8], ptr %arrayidx.i, i64 0, i64 3
%20 = load i8, ptr %arrayidx3.4.i, align 1, !tbaa !5
%cmp4.4.i = icmp eq i8 %20, 42
br i1 %cmp4.4.i, label %if.then, label %if.else.4.i
if.else.4.i: ; preds = %for.cond.3.i
%cmp15.not.4.i = icmp eq i8 %20, %12
br i1 %cmp15.not.4.i, label %for.cond.4.i, label %for.inc27
for.cond.4.i: ; preds = %if.else.4.i
%arrayidx3.5.i = getelementptr inbounds [10 x i8], ptr %arrayidx.i, i64 0, i64 2
%21 = load i8, ptr %arrayidx3.5.i, align 2, !tbaa !5
%cmp4.5.i = icmp eq i8 %21, 42
br i1 %cmp4.5.i, label %if.then, label %if.else.5.i
if.else.5.i: ; preds = %for.cond.4.i
%cmp15.not.5.i = icmp eq i8 %21, %13
br i1 %cmp15.not.5.i, label %for.cond.5.i, label %for.inc27
for.cond.5.i: ; preds = %if.else.5.i
%arrayidx3.6.i = getelementptr inbounds [10 x i8], ptr %arrayidx.i, i64 0, i64 1
%22 = load i8, ptr %arrayidx3.6.i, align 1, !tbaa !5
%cmp4.6.i = icmp eq i8 %22, 42
br i1 %cmp4.6.i, label %if.then, label %if.else.6.i
if.else.6.i: ; preds = %for.cond.5.i
%cmp15.not.6.i = icmp eq i8 %22, %14
br i1 %cmp15.not.6.i, label %for.cond.6.i, label %for.inc27
for.cond.6.i: ; preds = %if.else.6.i
%23 = load i8, ptr %arrayidx.i, align 16, !tbaa !5
%cmp4.7.i = icmp eq i8 %23, 42
%cmp15.not.7.i.not = icmp eq i8 %23, %15
%or.cond = select i1 %cmp4.7.i, i1 true, i1 %cmp15.not.7.i.not
br i1 %or.cond, label %if.then, label %for.inc27
if.else.i: ; preds = %for.body20
%cmp15.not.i = icmp eq i8 %16, %8
br i1 %cmp15.not.i, label %for.cond.i, label %for.inc27
if.then: ; preds = %for.cond.6.i, %for.cond.5.i, %for.cond.4.i, %for.cond.3.i, %for.cond.2.i, %for.cond.1.i, %for.cond.i, %for.body20
%money26 = getelementptr inbounds [105 x %struct._data], ptr @d, i64 0, i64 %indvars.iv62, i32 1
%24 = load i32, ptr %money26, align 4, !tbaa !10
%add = add nsw i32 %24, %sum.154
br label %for.inc27
for.inc27: ; preds = %for.cond.6.i, %if.else.6.i, %if.else.5.i, %if.else.4.i, %if.else.3.i, %if.else.2.i, %if.else.1.i, %if.else.i, %if.then
%sum.2 = phi i32 [ %add, %if.then ], [ %sum.154, %if.else.i ], [ %sum.154, %if.else.1.i ], [ %sum.154, %if.else.2.i ], [ %sum.154, %if.else.3.i ], [ %sum.154, %if.else.4.i ], [ %sum.154, %if.else.5.i ], [ %sum.154, %if.else.6.i ], [ %sum.154, %for.cond.6.i ]
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%exitcond.not = icmp eq i64 %indvars.iv.next63, %wide.trip.count
br i1 %exitcond.not, label %for.inc30, label %for.body20, !llvm.loop !14
for.inc30: ; preds = %for.inc27, %for.body15
%sum.1.lcssa = phi i32 [ %sum.057, %for.body15 ], [ %sum.2, %for.inc27 ]
%inc31 = add nuw nsw i32 %i.156, 1
%25 = load i32, ptr %m, align 4, !tbaa !8
%cmp14 = icmp slt i32 %inc31, %25
br i1 %cmp14, label %for.body15, label %for.end32, !llvm.loop !15
for.end32: ; preds = %for.inc30, %for.cond13.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond13.preheader ], [ %sum.1.lcssa, %for.inc30 ]
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %sum.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%tobool.not = icmp eq i32 %call, 0
br i1 %tobool.not, label %for.end34, label %land.rhs, !llvm.loop !16
for.end34: ; preds = %land.rhs, %for.end32, %entry
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %num) #5
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %hit) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %money) #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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !9, i64 12}
!11 = !{!"_data", !6, i64 0, !9, i64 12}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
|
#include <stdio.h>
typedef long long ll;
int main() {
ll a, b, x;
scanf("%lld%lld%lld", &a, &b, &x);
if (a == 0)
printf("%lld\n", b / x + 1);
else
printf("%lld\n", (b / x + 1) - ((a - 1) / x + 1));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323114/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323114/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%x = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %x)
%0 = load i64, ptr %a, align 8, !tbaa !5
%cmp = icmp eq i64 %0, 0
%1 = load i64, ptr %b, align 8, !tbaa !5
%2 = load i64, ptr %x, align 8, !tbaa !5
%div = sdiv i64 %1, %2
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%add = add nsw i64 %div, 1
br label %if.end
if.else: ; preds = %entry
%sub = add nsw i64 %0, -1
%div4 = sdiv i64 %sub, %2
%sub6 = sub i64 %div, %div4
br label %if.end
if.end: ; preds = %if.else, %if.then
%sub6.sink = phi i64 [ %sub6, %if.else ], [ %add, %if.then ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub6.sink)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(int argc, char const *argv[]) {
unsigned long a, b, x;
unsigned long i, numa,numb;
unsigned long count=0;
scanf("%lu %lu %lu",&a, &b, &x );
numa = a / x + 1;//+1は0の分
numb = b / x + 1;
//printf("%lu %lu\n", numa,numb);
count = numb - numa;
if(a % x == 0)count++;
printf("%lu\n", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323158/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323158/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lu %lu %lu\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lu\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%x = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %x)
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %x, align 8, !tbaa !5
%div = udiv i64 %0, %1
%2 = load i64, ptr %b, align 8, !tbaa !5
%div1 = udiv i64 %2, %1
%sub = sub i64 %div1, %div
%rem = urem i64 %0, %1
%cmp = icmp eq i64 %rem, 0
%inc = zext i1 %cmp to i64
%spec.select = add i64 %sub, %inc
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %spec.select)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <stdbool.h>
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool _Bool
const int mod = (int)1e09 + 7;
//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY
int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }
void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }
int main() {
ll A, B, X;
ll ans = 0;
ll cnt = 0;
scanf("%lld%lld%lld", &A, &B, &X);
cnt = B / X - A / X;
if (A%X == 0) {
cnt ++;
}
ans = cnt;
printf("%lld\n", ans);
#ifdef DEBUGF
getch();
#endif
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323200/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323200/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@mod = dso_local local_unnamed_addr constant i32 1000000007, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.5 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.6 = private unnamed_addr constant [7 x i8] c"%.10f\0A\00", align 1
@.str.7 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@.str.8 = private unnamed_addr constant [13 x i8] c"%lld%lld%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #0 {
entry:
%i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%0 = load i32, ptr %i, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #10
ret i32 %0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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 uwtable
define dso_local i64 @llin() local_unnamed_addr #0 {
entry:
%i = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %i)
%0 = load i64, ptr %i, align 8, !tbaa !9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i) #10
ret i64 %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local double @din() local_unnamed_addr #0 {
entry:
%i = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %i)
%0 = load double, ptr %i, align 8, !tbaa !11
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i) #10
ret double %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @chin(ptr noundef %s) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef %s)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(i32 noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %a)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @llprint(i64 noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %a)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @dprint(double noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, double noundef %a)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print2(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %a, i32 noundef %b)
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @Max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @Min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmax(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmin(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dmax(double noundef %a, double noundef %b) local_unnamed_addr #4 {
entry:
%cmp = fcmp ogt double %a, %b
%cond = select i1 %cmp, double %a, double %b
ret double %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dmin(double noundef %a, double noundef %b) local_unnamed_addr #4 {
entry:
%cmp = fcmp olt double %a, %b
%cond = select i1 %cmp, double %a, double %b
ret double %cond
}
; 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 #5 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !9
%1 = load i64, ptr %b, align 8, !tbaa !9
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp_r(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i64, ptr %b, align 8, !tbaa !9
%1 = load i64, ptr %a, align 8, !tbaa !9
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @char_cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #11
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 nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @char_cmp_r(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #11
ret i32 %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #8 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i64, align 8
%B = alloca i64, align 8
%X = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %A) #10
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %B) #10
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %X) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.8, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %X)
%0 = load i64, ptr %B, align 8, !tbaa !9
%1 = load i64, ptr %X, align 8, !tbaa !9
%div = sdiv i64 %0, %1
%2 = load i64, ptr %A, align 8, !tbaa !9
%div1 = sdiv i64 %2, %1
%sub = sub i64 %div, %div1
%rem = srem i64 %2, %1
%cmp = icmp eq i64 %rem, 0
%inc = zext i1 %cmp to i64
%spec.select = add nsw i64 %sub, %inc
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %spec.select)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %X) #10
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #10
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #10
ret i32 0
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #9
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #9
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #9
; 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 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #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(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nounwind willreturn 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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
|
#include <stdio.h>
int main(void)
{
unsigned long long int a,b,x;
scanf("%llu%llu%llu",&a,&b,&x);
int i=0;
if(a%x==0) i=1;
printf("%llu\n",b/x-a/x+i);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323244/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323244/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%llu%llu%llu\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%llu\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%x = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %x)
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %x, align 8, !tbaa !5
%rem = urem i64 %0, %1
%cmp = icmp eq i64 %rem, 0
%2 = load i64, ptr %b, align 8, !tbaa !5
%div = udiv i64 %2, %1
%div1 = udiv i64 %0, %1
%conv = zext i1 %cmp to i64
%sub = add i64 %div, %conv
%add = sub i64 %sub, %div1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int n,a[10000],b[10000],k,t,i,l,m;
scanf("%d %d",&n,&m);
for(t=0;t<2*n;t++){
a[t]=t+1;
}
for(i=0;i<m;i++){
scanf("%d",&k);
if(k==0){
for(t=0;t<n;t++){
b[2*t]=a[t];
}
for(t=n;t<2*n;t++){
b[2*(t-n)+1]=a[t];
}
for(t=0;t<2*n;t++){
a[t]=b[t];
}
}
else{
for(t=0;t<k;t++){
b[2*n-k+t]=a[t];
}
for(t=0;t<2*n-k;t++){
b[t]=a[t+k];
}
for(t=0;t<2*n;t++){
a[t]=b[t];
}
}
}
for(t=0;t<2*n;t++){
printf("%d\n",a[t]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323288/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323288/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [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 [10000 x i32], align 16
%b = alloca [10000 x i32], align 16
%k = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp124 = icmp sgt i32 %0, 0
br i1 %cmp124, label %for.body.preheader, label %for.cond1.preheader
for.body.preheader: ; preds = %entry
%mul = shl nuw i32 %0, 1
%smax = call i32 @llvm.smax.i32(i32 %mul, i32 1)
%wide.trip.count = zext i32 %smax to i64
%min.iters.check = icmp ult i32 %smax, 8
br i1 %min.iters.check, label %for.body.preheader194, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 2147483640
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%1 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %index
%2 = trunc <4 x i64> %vec.ind to <4 x i32>
%3 = add <4 x i32> %2, <i32 1, i32 1, i32 1, i32 1>
%4 = trunc <4 x i64> %vec.ind to <4 x i32>
%5 = add <4 x i32> %4, <i32 5, i32 5, i32 5, i32 5>
store <4 x i32> %3, ptr %1, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> %5, ptr %6, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader194
for.body.preheader194: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond1.preheader: ; preds = %for.body, %middle.block, %entry
%8 = load i32, ptr %m, align 4, !tbaa !5
%cmp2140 = icmp sgt i32 %8, 0
br i1 %cmp2140, label %for.body3.preheader, label %for.cond81.preheader
for.body3.preheader: ; preds = %for.cond1.preheader
%arrayidx26.prol = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 1
br label %for.body3
for.body: ; preds = %for.body.preheader194, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader194 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv
%9 = trunc i64 %indvars.iv.next to i32
store i32 %9, ptr %arrayidx, align 4, !tbaa !5
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond1.preheader, label %for.body, !llvm.loop !13
for.cond81.preheader: ; preds = %for.inc78, %for.cond1.preheader
%10 = phi i32 [ %0, %for.cond1.preheader ], [ %69, %for.inc78 ]
%cmp83143 = icmp sgt i32 %10, 0
br i1 %cmp83143, label %for.body84, label %for.end90
for.body3: ; preds = %for.body3.preheader, %for.inc78
%i.0141 = phi i32 [ %inc79, %for.inc78 ], [ 0, %for.body3.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %k)
%11 = load i32, ptr %k, align 4, !tbaa !5
%cmp5 = icmp eq i32 %11, 0
br i1 %cmp5, label %for.cond6.preheader, label %for.cond41.preheader
for.cond41.preheader: ; preds = %for.body3
%cmp42126 = icmp sgt i32 %11, 0
%.pre = load i32, ptr %n, align 4, !tbaa !5
%mul46 = shl i32 %.pre, 1
br i1 %cmp42126, label %for.body43.lr.ph, label %for.cond54.preheader
for.body43.lr.ph: ; preds = %for.cond41.preheader
%wide.trip.count150 = zext i32 %11 to i64
%min.iters.check184 = icmp ult i32 %11, 12
br i1 %min.iters.check184, label %for.body43.preheader, label %vector.scevcheck
vector.scevcheck: ; preds = %for.body43.lr.ph
%12 = add nsw i64 %wide.trip.count150, -1
%13 = sub i32 %mul46, %11
%14 = trunc i64 %12 to i32
%15 = add i32 %13, %14
%16 = icmp slt i32 %15, %13
%17 = icmp ugt i64 %12, 4294967295
%18 = or i1 %16, %17
br i1 %18, label %for.body43.preheader, label %vector.ph185
vector.ph185: ; preds = %vector.scevcheck
%n.vec187 = and i64 %wide.trip.count150, 4294967288
br label %vector.body190
vector.body190: ; preds = %vector.body190, %vector.ph185
%offset.idx = phi i64 [ 0, %vector.ph185 ], [ %index.next193, %vector.body190 ]
%19 = trunc i64 %offset.idx to i32
%20 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %20, align 16, !tbaa !5
%21 = getelementptr inbounds i32, ptr %20, i64 4
%wide.load192 = load <4 x i32>, ptr %21, align 16, !tbaa !5
%22 = sub i32 %19, %11
%23 = add i32 %22, %mul46
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %24
store <4 x i32> %wide.load, ptr %25, align 4, !tbaa !5
%26 = getelementptr inbounds i32, ptr %25, i64 4
store <4 x i32> %wide.load192, ptr %26, align 4, !tbaa !5
%index.next193 = add nuw i64 %offset.idx, 8
%27 = icmp eq i64 %index.next193, %n.vec187
br i1 %27, label %middle.block182, label %vector.body190, !llvm.loop !14
middle.block182: ; preds = %vector.body190
%cmp.n189 = icmp eq i64 %n.vec187, %wide.trip.count150
br i1 %cmp.n189, label %for.cond54.preheader, label %for.body43.preheader
for.body43.preheader: ; preds = %vector.scevcheck, %for.body43.lr.ph, %middle.block182
%indvars.iv147.ph = phi i64 [ 0, %vector.scevcheck ], [ 0, %for.body43.lr.ph ], [ %n.vec187, %middle.block182 ]
%xtraiter = and i64 %wide.trip.count150, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body43.prol.loopexit, label %for.body43.prol
for.body43.prol: ; preds = %for.body43.preheader
%arrayidx45.prol = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv147.ph
%28 = load i32, ptr %arrayidx45.prol, align 16, !tbaa !5
%29 = trunc i64 %indvars.iv147.ph to i32
%sub47.prol = sub i32 %29, %11
%add48.prol = add i32 %sub47.prol, %mul46
%idxprom49.prol = sext i32 %add48.prol to i64
%arrayidx50.prol = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %idxprom49.prol
store i32 %28, ptr %arrayidx50.prol, align 4, !tbaa !5
%indvars.iv.next148.prol = or i64 %indvars.iv147.ph, 1
br label %for.body43.prol.loopexit
for.body43.prol.loopexit: ; preds = %for.body43.prol, %for.body43.preheader
%indvars.iv147.unr = phi i64 [ %indvars.iv147.ph, %for.body43.preheader ], [ %indvars.iv.next148.prol, %for.body43.prol ]
%30 = sub nsw i64 0, %wide.trip.count150
%31 = xor i64 %indvars.iv147.ph, %30
%32 = icmp eq i64 %31, -1
br i1 %32, label %for.cond54.preheader, label %for.body43
for.cond6.preheader: ; preds = %for.body3
%33 = load i32, ptr %n, align 4, !tbaa !5
%cmp7132 = icmp sgt i32 %33, 0
br i1 %cmp7132, label %for.body8.preheader, label %for.cond17.preheader
for.body8.preheader: ; preds = %for.cond6.preheader
%wide.trip.count164 = zext i32 %33 to i64
%xtraiter195 = and i64 %wide.trip.count164, 3
%34 = icmp ult i32 %33, 4
br i1 %34, label %for.cond17.preheader.loopexit.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %wide.trip.count164, 4294967292
br label %for.body8
for.cond17.preheader.loopexit.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%indvars.iv160.unr = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next161.3, %for.body8 ]
%lcmp.mod196.not = icmp eq i64 %xtraiter195, 0
br i1 %lcmp.mod196.not, label %for.cond17.preheader, label %for.body8.epil
for.body8.epil: ; preds = %for.cond17.preheader.loopexit.unr-lcssa, %for.body8.epil
%indvars.iv160.epil = phi i64 [ %indvars.iv.next161.epil, %for.body8.epil ], [ %indvars.iv160.unr, %for.cond17.preheader.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body8.epil ], [ 0, %for.cond17.preheader.loopexit.unr-lcssa ]
%arrayidx10.epil = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv160.epil
%35 = load i32, ptr %arrayidx10.epil, align 4, !tbaa !5
%36 = shl nuw nsw i64 %indvars.iv160.epil, 1
%arrayidx13.epil = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %36
store i32 %35, ptr %arrayidx13.epil, align 8, !tbaa !5
%indvars.iv.next161.epil = add nuw nsw i64 %indvars.iv160.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter195
br i1 %epil.iter.cmp.not, label %for.cond17.preheader, label %for.body8.epil, !llvm.loop !15
for.cond17.preheader: ; preds = %for.cond17.preheader.loopexit.unr-lcssa, %for.body8.epil, %for.cond6.preheader
%mul18 = shl nsw i32 %33, 1
%cmp19135 = icmp slt i32 %33, %mul18
br i1 %cmp19135, label %for.body20.preheader, label %for.cond30.preheader
for.body20.preheader: ; preds = %for.cond17.preheader
%37 = sext i32 %33 to i64
%wide.trip.count170 = sext i32 %mul18 to i64
%xtraiter197 = and i64 %37, 1
%lcmp.mod198.not = icmp eq i64 %xtraiter197, 0
br i1 %lcmp.mod198.not, label %for.body20.prol.loopexit, label %for.body20.prol
for.body20.prol: ; preds = %for.body20.preheader
%arrayidx22.prol = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %37
%38 = load i32, ptr %arrayidx22.prol, align 4, !tbaa !5
store i32 %38, ptr %arrayidx26.prol, align 4, !tbaa !5
%indvars.iv.next167.prol = add nsw i64 %37, 1
br label %for.body20.prol.loopexit
for.body20.prol.loopexit: ; preds = %for.body20.prol, %for.body20.preheader
%indvars.iv166.unr = phi i64 [ %37, %for.body20.preheader ], [ %indvars.iv.next167.prol, %for.body20.prol ]
%39 = sub nsw i64 0, %wide.trip.count170
%40 = xor i64 %37, %39
%41 = icmp eq i64 %40, -1
br i1 %41, label %for.cond30.preheader, label %for.body20
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%indvars.iv160 = phi i64 [ 0, %for.body8.preheader.new ], [ %indvars.iv.next161.3, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.3, %for.body8 ]
%arrayidx10 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv160
%42 = load i32, ptr %arrayidx10, align 16, !tbaa !5
%43 = shl nuw nsw i64 %indvars.iv160, 1
%arrayidx13 = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %43
store i32 %42, ptr %arrayidx13, align 16, !tbaa !5
%indvars.iv.next161 = or i64 %indvars.iv160, 1
%arrayidx10.1 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv.next161
%44 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%45 = shl nuw nsw i64 %indvars.iv.next161, 1
%arrayidx13.1 = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %45
store i32 %44, ptr %arrayidx13.1, align 8, !tbaa !5
%indvars.iv.next161.1 = or i64 %indvars.iv160, 2
%arrayidx10.2 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv.next161.1
%46 = load i32, ptr %arrayidx10.2, align 8, !tbaa !5
%47 = shl nuw nsw i64 %indvars.iv.next161.1, 1
%arrayidx13.2 = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %47
store i32 %46, ptr %arrayidx13.2, align 16, !tbaa !5
%indvars.iv.next161.2 = or i64 %indvars.iv160, 3
%arrayidx10.3 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv.next161.2
%48 = load i32, ptr %arrayidx10.3, align 4, !tbaa !5
%49 = shl nuw nsw i64 %indvars.iv.next161.2, 1
%arrayidx13.3 = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %49
store i32 %48, ptr %arrayidx13.3, align 8, !tbaa !5
%indvars.iv.next161.3 = add nuw nsw i64 %indvars.iv160, 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.cond17.preheader.loopexit.unr-lcssa, label %for.body8, !llvm.loop !17
for.cond30.preheader: ; preds = %for.body20.prol.loopexit, %for.body20, %for.cond17.preheader
br i1 %cmp7132, label %for.inc78.sink.split, label %for.inc78
for.body20: ; preds = %for.body20.prol.loopexit, %for.body20
%indvars.iv166 = phi i64 [ %indvars.iv.next167.1, %for.body20 ], [ %indvars.iv166.unr, %for.body20.prol.loopexit ]
%arrayidx22 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv166
%50 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%51 = trunc i64 %indvars.iv166 to i32
%52 = sub i32 %51, %33
%mul23 = shl nsw i32 %52, 1
%add24 = or i32 %mul23, 1
%idxprom25 = sext i32 %add24 to i64
%arrayidx26 = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %idxprom25
store i32 %50, ptr %arrayidx26, align 4, !tbaa !5
%indvars.iv.next167 = add nsw i64 %indvars.iv166, 1
%arrayidx22.1 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv.next167
%53 = load i32, ptr %arrayidx22.1, align 4, !tbaa !5
%54 = trunc i64 %indvars.iv.next167 to i32
%55 = sub i32 %54, %33
%mul23.1 = shl nsw i32 %55, 1
%add24.1 = or i32 %mul23.1, 1
%idxprom25.1 = sext i32 %add24.1 to i64
%arrayidx26.1 = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %idxprom25.1
store i32 %53, ptr %arrayidx26.1, align 4, !tbaa !5
%indvars.iv.next167.1 = add nsw i64 %indvars.iv166, 2
%exitcond171.not.1 = icmp eq i64 %indvars.iv.next167.1, %wide.trip.count170
br i1 %exitcond171.not.1, label %for.cond30.preheader, label %for.body20, !llvm.loop !18
for.cond54.preheader: ; preds = %for.body43.prol.loopexit, %for.body43, %middle.block182, %for.cond41.preheader
%cmp57128 = icmp sgt i32 %mul46, %11
br i1 %cmp57128, label %for.body58.preheader, label %for.cond67.preheader
for.body58.preheader: ; preds = %for.cond54.preheader
%56 = sext i32 %11 to i64
%57 = shl nsw i64 %56, 2
%scevgep = getelementptr i8, ptr %a, i64 %57
%58 = xor i32 %11, -1
%59 = add i32 %mul46, %58
%60 = zext i32 %59 to i64
%61 = shl nuw nsw i64 %60, 2
%62 = add nuw nsw i64 %61, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %b, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %62, i1 false), !tbaa !5
br label %for.cond67.preheader
for.body43: ; preds = %for.body43.prol.loopexit, %for.body43
%indvars.iv147 = phi i64 [ %indvars.iv.next148.1, %for.body43 ], [ %indvars.iv147.unr, %for.body43.prol.loopexit ]
%arrayidx45 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv147
%63 = load i32, ptr %arrayidx45, align 4, !tbaa !5
%64 = trunc i64 %indvars.iv147 to i32
%sub47 = sub i32 %64, %11
%add48 = add i32 %sub47, %mul46
%idxprom49 = sext i32 %add48 to i64
%arrayidx50 = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %idxprom49
store i32 %63, ptr %arrayidx50, align 4, !tbaa !5
%indvars.iv.next148 = add nuw nsw i64 %indvars.iv147, 1
%arrayidx45.1 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv.next148
%65 = load i32, ptr %arrayidx45.1, align 4, !tbaa !5
%66 = trunc i64 %indvars.iv.next148 to i32
%sub47.1 = sub i32 %66, %11
%add48.1 = add i32 %sub47.1, %mul46
%idxprom49.1 = sext i32 %add48.1 to i64
%arrayidx50.1 = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %idxprom49.1
store i32 %65, ptr %arrayidx50.1, align 4, !tbaa !5
%indvars.iv.next148.1 = add nuw nsw i64 %indvars.iv147, 2
%exitcond151.not.1 = icmp eq i64 %indvars.iv.next148.1, %wide.trip.count150
br i1 %exitcond151.not.1, label %for.cond54.preheader, label %for.body43, !llvm.loop !19
for.cond67.preheader: ; preds = %for.body58.preheader, %for.cond54.preheader
%cmp69130 = icmp sgt i32 %.pre, 0
br i1 %cmp69130, label %for.inc78.sink.split, label %for.inc78
for.inc78.sink.split: ; preds = %for.cond67.preheader, %for.cond30.preheader
%mul55.pre-phi.sink = phi i32 [ %mul18, %for.cond30.preheader ], [ %mul46, %for.cond67.preheader ]
%.ph = phi i32 [ %33, %for.cond30.preheader ], [ %.pre, %for.cond67.preheader ]
%smax156 = call i32 @llvm.smax.i32(i32 %mul55.pre-phi.sink, i32 1)
%67 = zext i32 %smax156 to i64
%68 = shl nuw nsw i64 %67, 2
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %a, ptr noundef nonnull align 16 dereferenceable(1) %b, i64 %68, i1 false), !tbaa !5
br label %for.inc78
for.inc78: ; preds = %for.inc78.sink.split, %for.cond67.preheader, %for.cond30.preheader
%69 = phi i32 [ %.pre, %for.cond67.preheader ], [ %33, %for.cond30.preheader ], [ %.ph, %for.inc78.sink.split ]
%inc79 = add nuw nsw i32 %i.0141, 1
%70 = load i32, ptr %m, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc79, %70
br i1 %cmp2, label %for.body3, label %for.cond81.preheader, !llvm.loop !20
for.body84: ; preds = %for.cond81.preheader, %for.body84
%indvars.iv176 = phi i64 [ %indvars.iv.next177, %for.body84 ], [ 0, %for.cond81.preheader ]
%arrayidx86 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv176
%71 = load i32, ptr %arrayidx86, align 4, !tbaa !5
%call87 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %71)
%indvars.iv.next177 = add nuw nsw i64 %indvars.iv176, 1
%72 = load i32, ptr %n, align 4, !tbaa !5
%mul82 = shl nsw i32 %72, 1
%73 = sext i32 %mul82 to i64
%cmp83 = icmp slt i64 %indvars.iv.next177, %73
br i1 %cmp83, label %for.body84, label %for.end90, !llvm.loop !21
for.end90: ; preds = %for.body84, %for.cond81.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
; Function Attrs: nocallback nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !11}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
|
#include <stdio.h>
#define MAX 201
int a[MAX];
int n;
void init(int n){
int i;
for(i=0;i<2*n;i++){
a[i]=i+1;
}
}
void shaffle(){
int i;
int temp[MAX];
for(i=0;i<n;i++){
temp[i*2]=a[i];
}
for(i=0;i<n;i++){
temp[i*2+1]=a[n+i];
}
for(i=0;i<2*n;i++){
a[i]=temp[i];
}
}
void cut(int k){
int i;
int temp[MAX];
for(i=0;i<2*n-k;i++){
temp[i]=a[k+i];
}
for(i=0;i<k;i++){
temp[2*n-k+i]=a[i];
}
for(i=0;i<2*n;i++){
a[i]=temp[i];
}
}
int main(void)
{
int m,k;
int i;
scanf("%d",&n);
init(n);
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d",&k);
if(k==0){
shaffle();
}
else{
cut(k);
}
}
for(i=0;i<2*n;i++){
printf("%d\n",a[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323330/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323330/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@a = dso_local local_unnamed_addr global [201 x i32] zeroinitializer, align 16
@n = dso_local 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\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @init(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp4 = icmp sgt i32 %n, 0
br i1 %cmp4, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%mul = shl nuw i32 %n, 1
%smax = tail call i32 @llvm.smax.i32(i32 %mul, i32 1)
%wide.trip.count = zext i32 %smax to i64
%min.iters.check = icmp ult i32 %smax, 8
br i1 %min.iters.check, label %for.body.preheader8, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 2147483640
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%0 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %index
%1 = trunc <4 x i64> %vec.ind to <4 x i32>
%2 = add <4 x i32> %1, <i32 1, i32 1, i32 1, i32 1>
%3 = trunc <4 x i64> %vec.ind to <4 x i32>
%4 = add <4 x i32> %3, <i32 5, i32 5, i32 5, i32 5>
store <4 x i32> %2, ptr %0, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %4, ptr %5, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%6 = icmp eq i64 %index.next, %n.vec
br i1 %6, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader8
for.body.preheader8: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader8, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader8 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv
%7 = trunc i64 %indvars.iv.next to i32
store i32 %7, ptr %arrayidx, align 4, !tbaa !5
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
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, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @shaffle() local_unnamed_addr #2 {
entry:
%temp = alloca [201 x i32], align 16
call void @llvm.lifetime.start.p0(i64 804, ptr nonnull %temp) #7
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp37 = icmp sgt i32 %0, 0
br i1 %cmp37, label %for.body.preheader, label %for.end25
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %0, 4
br i1 %1, label %for.cond3.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond3.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond3.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond3.preheader.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond3.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond3.preheader.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv.epil
%2 = load i32, ptr %arrayidx.epil, align 4, !tbaa !5
%3 = shl nuw nsw i64 %indvars.iv.epil, 1
%arrayidx2.epil = getelementptr inbounds [201 x i32], ptr %temp, i64 0, i64 %3
store i32 %2, ptr %arrayidx2.epil, align 8, !tbaa !5
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond3.preheader, label %for.body.epil, !llvm.loop !14
for.cond3.preheader: ; preds = %for.body.epil, %for.cond3.preheader.unr-lcssa
br i1 %cmp37, label %for.body5.preheader, label %for.end25
for.body5.preheader: ; preds = %for.cond3.preheader
%4 = zext i32 %0 to i64
%xtraiter56 = and i64 %wide.trip.count, 1
%5 = icmp eq i32 %0, 1
br i1 %5, label %for.cond15.preheader.unr-lcssa, label %for.body5.preheader.new
for.body5.preheader.new: ; preds = %for.body5.preheader
%unroll_iter59 = and i64 %wide.trip.count, 4294967294
br label %for.body5
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv
%6 = load i32, ptr %arrayidx, align 16, !tbaa !5
%7 = shl nuw nsw i64 %indvars.iv, 1
%arrayidx2 = getelementptr inbounds [201 x i32], ptr %temp, i64 0, i64 %7
store i32 %6, ptr %arrayidx2, align 16, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv.next
%8 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%9 = shl nuw nsw i64 %indvars.iv.next, 1
%arrayidx2.1 = getelementptr inbounds [201 x i32], ptr %temp, i64 0, i64 %9
store i32 %8, ptr %arrayidx2.1, align 8, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv.next.1
%10 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%11 = shl nuw nsw i64 %indvars.iv.next.1, 1
%arrayidx2.2 = getelementptr inbounds [201 x i32], ptr %temp, i64 0, i64 %11
store i32 %10, ptr %arrayidx2.2, align 16, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv.next.2
%12 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%13 = shl nuw nsw i64 %indvars.iv.next.2, 1
%arrayidx2.3 = getelementptr inbounds [201 x i32], ptr %temp, i64 0, i64 %13
store i32 %12, ptr %arrayidx2.3, align 8, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add nuw i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond3.preheader.unr-lcssa, label %for.body, !llvm.loop !16
for.cond15.preheader.unr-lcssa: ; preds = %for.body5, %for.body5.preheader
%indvars.iv45.unr = phi i64 [ 0, %for.body5.preheader ], [ %indvars.iv.next46.1, %for.body5 ]
%lcmp.mod58.not = icmp eq i64 %xtraiter56, 0
br i1 %lcmp.mod58.not, label %for.cond15.preheader, label %for.body5.epil
for.body5.epil: ; preds = %for.cond15.preheader.unr-lcssa
%14 = add nuw nsw i64 %indvars.iv45.unr, %4
%arrayidx7.epil = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %14
%15 = load i32, ptr %arrayidx7.epil, align 4, !tbaa !5
%16 = shl nuw nsw i64 %indvars.iv45.unr, 1
%17 = or i64 %16, 1
%arrayidx11.epil = getelementptr inbounds [201 x i32], ptr %temp, i64 0, i64 %17
store i32 %15, ptr %arrayidx11.epil, align 4, !tbaa !5
br label %for.cond15.preheader
for.cond15.preheader: ; preds = %for.cond15.preheader.unr-lcssa, %for.body5.epil
br i1 %cmp37, label %for.body18.preheader, label %for.end25
for.body18.preheader: ; preds = %for.cond15.preheader
%mul16 = shl nuw i32 %0, 1
%smax = tail call i32 @llvm.smax.i32(i32 %mul16, i32 1)
%18 = zext i32 %smax to i64
%19 = shl nuw nsw i64 %18, 2
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @a, ptr noundef nonnull align 16 dereferenceable(1) %temp, i64 %19, i1 false), !tbaa !5
br label %for.end25
for.body5: ; preds = %for.body5, %for.body5.preheader.new
%indvars.iv45 = phi i64 [ 0, %for.body5.preheader.new ], [ %indvars.iv.next46.1, %for.body5 ]
%niter60 = phi i64 [ 0, %for.body5.preheader.new ], [ %niter60.next.1, %for.body5 ]
%20 = add nuw nsw i64 %indvars.iv45, %4
%arrayidx7 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %20
%21 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%22 = shl nuw nsw i64 %indvars.iv45, 1
%23 = or i64 %22, 1
%arrayidx11 = getelementptr inbounds [201 x i32], ptr %temp, i64 0, i64 %23
store i32 %21, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next46 = or i64 %indvars.iv45, 1
%24 = add nuw nsw i64 %indvars.iv.next46, %4
%arrayidx7.1 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %24
%25 = load i32, ptr %arrayidx7.1, align 4, !tbaa !5
%26 = shl nuw nsw i64 %indvars.iv.next46, 1
%27 = or i64 %26, 1
%arrayidx11.1 = getelementptr inbounds [201 x i32], ptr %temp, i64 0, i64 %27
store i32 %25, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next46.1 = add nuw nsw i64 %indvars.iv45, 2
%niter60.next.1 = add nuw i64 %niter60, 2
%niter60.ncmp.1 = icmp eq i64 %niter60.next.1, %unroll_iter59
br i1 %niter60.ncmp.1, label %for.cond15.preheader.unr-lcssa, label %for.body5, !llvm.loop !17
for.end25: ; preds = %entry, %for.cond3.preheader, %for.body18.preheader, %for.cond15.preheader
call void @llvm.lifetime.end.p0(i64 804, ptr nonnull %temp) #7
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @cut(i32 noundef %k) local_unnamed_addr #2 {
entry:
%temp = alloca [201 x i32], align 16
call void @llvm.lifetime.start.p0(i64 804, ptr nonnull %temp) #7
%0 = load i32, ptr @n, align 4, !tbaa !5
%mul = shl nsw i32 %0, 1
%sub = sub nsw i32 %mul, %k
%cmp41 = icmp sgt i32 %sub, 0
br i1 %cmp41, label %for.body.preheader, label %for.cond3.preheader
for.body.preheader: ; preds = %entry
%1 = sext i32 %k to i64
%2 = shl nsw i64 %1, 2
%scevgep = getelementptr i8, ptr @a, i64 %2
%3 = xor i32 %k, -1
%4 = add i32 %mul, %3
%5 = zext i32 %4 to i64
%6 = shl nuw nsw i64 %5, 2
%7 = add nuw nsw i64 %6, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %temp, ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i64 %7, i1 false), !tbaa !5
br label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.body.preheader, %entry
%cmp444 = icmp sgt i32 %k, 0
br i1 %cmp444, label %for.body5.preheader, label %for.cond16.preheader
for.body5.preheader: ; preds = %for.cond3.preheader
%wide.trip.count = zext i32 %k to i64
%min.iters.check = icmp ult i32 %k, 12
br i1 %min.iters.check, label %for.body5.preheader56, label %vector.scevcheck
vector.scevcheck: ; preds = %for.body5.preheader
%8 = add nsw i64 %wide.trip.count, -1
%9 = trunc i64 %8 to i32
%10 = add i32 %sub, %9
%11 = icmp slt i32 %10, %sub
%12 = icmp ugt i64 %8, 4294967295
%13 = or i1 %11, %12
br i1 %13, label %for.body5.preheader56, label %vector.ph
vector.ph: ; preds = %vector.scevcheck
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%offset.idx = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%14 = trunc i64 %offset.idx to i32
%15 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %15, align 16, !tbaa !5
%16 = getelementptr inbounds i32, ptr %15, i64 4
%wide.load55 = load <4 x i32>, ptr %16, align 16, !tbaa !5
%17 = add nsw i32 %sub, %14
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [201 x i32], ptr %temp, i64 0, i64 %18
store <4 x i32> %wide.load, ptr %19, align 4, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
store <4 x i32> %wide.load55, ptr %20, align 4, !tbaa !5
%index.next = add nuw i64 %offset.idx, 8
%21 = icmp eq i64 %index.next, %n.vec
br i1 %21, label %middle.block, label %vector.body, !llvm.loop !18
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond16.preheader, label %for.body5.preheader56
for.body5.preheader56: ; preds = %vector.scevcheck, %for.body5.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %vector.scevcheck ], [ 0, %for.body5.preheader ], [ %n.vec, %middle.block ]
%xtraiter = and i64 %wide.trip.count, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body5.prol.loopexit, label %for.body5.prol
for.body5.prol: ; preds = %for.body5.preheader56
%indvars51.prol = trunc i64 %indvars.iv.ph to i32
%arrayidx7.prol = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv.ph
%22 = load i32, ptr %arrayidx7.prol, align 16, !tbaa !5
%add10.prol = add nsw i32 %sub, %indvars51.prol
%idxprom11.prol = sext i32 %add10.prol to i64
%arrayidx12.prol = getelementptr inbounds [201 x i32], ptr %temp, i64 0, i64 %idxprom11.prol
store i32 %22, ptr %arrayidx12.prol, align 4, !tbaa !5
%indvars.iv.next.prol = or i64 %indvars.iv.ph, 1
br label %for.body5.prol.loopexit
for.body5.prol.loopexit: ; preds = %for.body5.prol, %for.body5.preheader56
%indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body5.preheader56 ], [ %indvars.iv.next.prol, %for.body5.prol ]
%23 = sub nsw i64 0, %wide.trip.count
%24 = xor i64 %indvars.iv.ph, %23
%25 = icmp eq i64 %24, -1
br i1 %25, label %for.cond16.preheader, label %for.body5
for.cond16.preheader: ; preds = %for.body5.prol.loopexit, %for.body5, %middle.block, %for.cond3.preheader
%cmp1846 = icmp sgt i32 %0, 0
br i1 %cmp1846, label %for.body19.preheader, label %for.end26
for.body19.preheader: ; preds = %for.cond16.preheader
%smax = tail call i32 @llvm.smax.i32(i32 %mul, i32 1)
%26 = zext i32 %smax to i64
%27 = shl nuw nsw i64 %26, 2
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @a, ptr noundef nonnull align 16 dereferenceable(1) %temp, i64 %27, i1 false), !tbaa !5
br label %for.end26
for.body5: ; preds = %for.body5.prol.loopexit, %for.body5
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.body5 ], [ %indvars.iv.unr, %for.body5.prol.loopexit ]
%indvars51 = trunc i64 %indvars.iv to i32
%arrayidx7 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv
%28 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add10 = add nsw i32 %sub, %indvars51
%idxprom11 = sext i32 %add10 to i64
%arrayidx12 = getelementptr inbounds [201 x i32], ptr %temp, i64 0, i64 %idxprom11
store i32 %28, ptr %arrayidx12, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%indvars51.1 = trunc i64 %indvars.iv.next to i32
%arrayidx7.1 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv.next
%29 = load i32, ptr %arrayidx7.1, align 4, !tbaa !5
%add10.1 = add nsw i32 %sub, %indvars51.1
%idxprom11.1 = sext i32 %add10.1 to i64
%arrayidx12.1 = getelementptr inbounds [201 x i32], ptr %temp, i64 0, i64 %idxprom11.1
store i32 %29, ptr %arrayidx12.1, align 4, !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.cond16.preheader, label %for.body5, !llvm.loop !19
for.end26: ; preds = %for.body19.preheader, %for.cond16.preheader
call void @llvm.lifetime.end.p0(i64 804, ptr nonnull %temp) #7
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%temp.i23 = alloca [201 x i32], align 16
%temp.i = alloca [201 x i32], align 16
%m = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #7
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp4.i = icmp sgt i32 %0, 0
br i1 %cmp4.i, label %for.body.preheader.i, label %init.exit
for.body.preheader.i: ; preds = %entry
%mul.i = shl nuw i32 %0, 1
%smax.i = tail call i32 @llvm.smax.i32(i32 %mul.i, i32 1)
%wide.trip.count.i = zext i32 %smax.i to i64
%min.iters.check = icmp ult i32 %smax.i, 8
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %for.body.preheader.i
%n.vec = and i64 %wide.trip.count.i, 2147483640
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%1 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %index
%2 = trunc <4 x i64> %vec.ind to <4 x i32>
%3 = add <4 x i32> %2, <i32 1, i32 1, i32 1, i32 1>
%4 = trunc <4 x i64> %vec.ind to <4 x i32>
%5 = add <4 x i32> %4, <i32 5, i32 5, i32 5, i32 5>
store <4 x i32> %3, ptr %1, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> %5, ptr %6, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count.i
br i1 %cmp.n, label %init.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
br label %for.body.i
for.body.i: ; preds = %for.body.i.preheader, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%arrayidx.i = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv.i
%8 = trunc i64 %indvars.iv.next.i to i32
store i32 %8, ptr %arrayidx.i, align 4, !tbaa !5
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %init.exit, label %for.body.i, !llvm.loop !21
init.exit: ; preds = %for.body.i, %middle.block, %entry
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%9 = load i32, ptr %m, align 4, !tbaa !5
%cmp35 = icmp sgt i32 %9, 0
br i1 %cmp35, label %for.body, label %init.exit.for.cond4.preheader_crit_edge
init.exit.for.cond4.preheader_crit_edge: ; preds = %init.exit
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.inc, %init.exit.for.cond4.preheader_crit_edge
%10 = phi i32 [ %.pre, %init.exit.for.cond4.preheader_crit_edge ], [ %69, %for.inc ]
%cmp538 = icmp sgt i32 %10, 0
br i1 %cmp538, label %for.body6, label %for.end10
for.body: ; preds = %init.exit, %for.inc
%i.036 = phi i32 [ %inc, %for.inc ], [ 0, %init.exit ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%11 = load i32, ptr %k, align 4, !tbaa !5
%cmp3 = icmp eq i32 %11, 0
br i1 %cmp3, label %if.then, label %if.else
if.then: ; preds = %for.body
call void @llvm.lifetime.start.p0(i64 804, ptr nonnull %temp.i) #7
%12 = load i32, ptr @n, align 4, !tbaa !5
%cmp37.i = icmp sgt i32 %12, 0
br i1 %cmp37.i, label %for.body.preheader.i15, label %shaffle.exit
for.body.preheader.i15: ; preds = %if.then
%wide.trip.count.i16 = zext i32 %12 to i64
%xtraiter54 = and i64 %wide.trip.count.i16, 3
%13 = icmp ult i32 %12, 4
br i1 %13, label %for.body5.i.preheader.unr-lcssa, label %for.body.preheader.i15.new
for.body.preheader.i15.new: ; preds = %for.body.preheader.i15
%unroll_iter = and i64 %wide.trip.count.i16, 4294967292
br label %for.body.i17
for.body.i17: ; preds = %for.body.i17, %for.body.preheader.i15.new
%indvars.iv.i18 = phi i64 [ 0, %for.body.preheader.i15.new ], [ %indvars.iv.next.i20.3, %for.body.i17 ]
%niter = phi i64 [ 0, %for.body.preheader.i15.new ], [ %niter.next.3, %for.body.i17 ]
%arrayidx.i19 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv.i18
%14 = load i32, ptr %arrayidx.i19, align 16, !tbaa !5
%15 = shl nuw nsw i64 %indvars.iv.i18, 1
%arrayidx2.i = getelementptr inbounds [201 x i32], ptr %temp.i, i64 0, i64 %15
store i32 %14, ptr %arrayidx2.i, align 16, !tbaa !5
%indvars.iv.next.i20 = or i64 %indvars.iv.i18, 1
%arrayidx.i19.1 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv.next.i20
%16 = load i32, ptr %arrayidx.i19.1, align 4, !tbaa !5
%17 = shl nuw nsw i64 %indvars.iv.next.i20, 1
%arrayidx2.i.1 = getelementptr inbounds [201 x i32], ptr %temp.i, i64 0, i64 %17
store i32 %16, ptr %arrayidx2.i.1, align 8, !tbaa !5
%indvars.iv.next.i20.1 = or i64 %indvars.iv.i18, 2
%arrayidx.i19.2 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv.next.i20.1
%18 = load i32, ptr %arrayidx.i19.2, align 8, !tbaa !5
%19 = shl nuw nsw i64 %indvars.iv.next.i20.1, 1
%arrayidx2.i.2 = getelementptr inbounds [201 x i32], ptr %temp.i, i64 0, i64 %19
store i32 %18, ptr %arrayidx2.i.2, align 16, !tbaa !5
%indvars.iv.next.i20.2 = or i64 %indvars.iv.i18, 3
%arrayidx.i19.3 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv.next.i20.2
%20 = load i32, ptr %arrayidx.i19.3, align 4, !tbaa !5
%21 = shl nuw nsw i64 %indvars.iv.next.i20.2, 1
%arrayidx2.i.3 = getelementptr inbounds [201 x i32], ptr %temp.i, i64 0, i64 %21
store i32 %20, ptr %arrayidx2.i.3, align 8, !tbaa !5
%indvars.iv.next.i20.3 = add nuw nsw i64 %indvars.iv.i18, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.body5.i.preheader.unr-lcssa, label %for.body.i17, !llvm.loop !16
for.body5.i.preheader.unr-lcssa: ; preds = %for.body.i17, %for.body.preheader.i15
%indvars.iv.i18.unr = phi i64 [ 0, %for.body.preheader.i15 ], [ %indvars.iv.next.i20.3, %for.body.i17 ]
%lcmp.mod55.not = icmp eq i64 %xtraiter54, 0
br i1 %lcmp.mod55.not, label %for.body5.i.preheader, label %for.body.i17.epil
for.body.i17.epil: ; preds = %for.body5.i.preheader.unr-lcssa, %for.body.i17.epil
%indvars.iv.i18.epil = phi i64 [ %indvars.iv.next.i20.epil, %for.body.i17.epil ], [ %indvars.iv.i18.unr, %for.body5.i.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.i17.epil ], [ 0, %for.body5.i.preheader.unr-lcssa ]
%arrayidx.i19.epil = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv.i18.epil
%22 = load i32, ptr %arrayidx.i19.epil, align 4, !tbaa !5
%23 = shl nuw nsw i64 %indvars.iv.i18.epil, 1
%arrayidx2.i.epil = getelementptr inbounds [201 x i32], ptr %temp.i, i64 0, i64 %23
store i32 %22, ptr %arrayidx2.i.epil, align 8, !tbaa !5
%indvars.iv.next.i20.epil = add nuw nsw i64 %indvars.iv.i18.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter54
br i1 %epil.iter.cmp.not, label %for.body5.i.preheader, label %for.body.i17.epil, !llvm.loop !22
for.body5.i.preheader: ; preds = %for.body.i17.epil, %for.body5.i.preheader.unr-lcssa
%xtraiter56 = and i64 %wide.trip.count.i16, 1
%24 = icmp eq i32 %12, 1
br i1 %24, label %for.body18.preheader.i.unr-lcssa, label %for.body5.i.preheader.new
for.body5.i.preheader.new: ; preds = %for.body5.i.preheader
%unroll_iter59 = and i64 %wide.trip.count.i16, 4294967294
br label %for.body5.i
for.body18.preheader.i.unr-lcssa: ; preds = %for.body5.i, %for.body5.i.preheader
%indvars.iv45.i.unr = phi i64 [ 0, %for.body5.i.preheader ], [ %indvars.iv.next46.i.1, %for.body5.i ]
%lcmp.mod58.not = icmp eq i64 %xtraiter56, 0
br i1 %lcmp.mod58.not, label %for.body18.preheader.i, label %for.body5.i.epil
for.body5.i.epil: ; preds = %for.body18.preheader.i.unr-lcssa
%25 = add nuw nsw i64 %indvars.iv45.i.unr, %wide.trip.count.i16
%arrayidx7.i.epil = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %25
%26 = load i32, ptr %arrayidx7.i.epil, align 4, !tbaa !5
%27 = shl nuw nsw i64 %indvars.iv45.i.unr, 1
%28 = or i64 %27, 1
%arrayidx11.i.epil = getelementptr inbounds [201 x i32], ptr %temp.i, i64 0, i64 %28
store i32 %26, ptr %arrayidx11.i.epil, align 4, !tbaa !5
br label %for.body18.preheader.i
for.body18.preheader.i: ; preds = %for.body18.preheader.i.unr-lcssa, %for.body5.i.epil
%mul16.i = shl nuw i32 %12, 1
%smax.i22 = call i32 @llvm.smax.i32(i32 %mul16.i, i32 1)
%29 = zext i32 %smax.i22 to i64
%30 = shl nuw nsw i64 %29, 2
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @a, ptr noundef nonnull align 16 dereferenceable(1) %temp.i, i64 %30, i1 false), !tbaa !5
br label %shaffle.exit
for.body5.i: ; preds = %for.body5.i, %for.body5.i.preheader.new
%indvars.iv45.i = phi i64 [ 0, %for.body5.i.preheader.new ], [ %indvars.iv.next46.i.1, %for.body5.i ]
%niter60 = phi i64 [ 0, %for.body5.i.preheader.new ], [ %niter60.next.1, %for.body5.i ]
%31 = add nuw nsw i64 %indvars.iv45.i, %wide.trip.count.i16
%arrayidx7.i = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %31
%32 = load i32, ptr %arrayidx7.i, align 4, !tbaa !5
%33 = shl nuw nsw i64 %indvars.iv45.i, 1
%34 = or i64 %33, 1
%arrayidx11.i = getelementptr inbounds [201 x i32], ptr %temp.i, i64 0, i64 %34
store i32 %32, ptr %arrayidx11.i, align 4, !tbaa !5
%indvars.iv.next46.i = or i64 %indvars.iv45.i, 1
%35 = add nuw nsw i64 %indvars.iv.next46.i, %wide.trip.count.i16
%arrayidx7.i.1 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %35
%36 = load i32, ptr %arrayidx7.i.1, align 4, !tbaa !5
%37 = shl nuw nsw i64 %indvars.iv.next46.i, 1
%38 = or i64 %37, 1
%arrayidx11.i.1 = getelementptr inbounds [201 x i32], ptr %temp.i, i64 0, i64 %38
store i32 %36, ptr %arrayidx11.i.1, align 4, !tbaa !5
%indvars.iv.next46.i.1 = add nuw nsw i64 %indvars.iv45.i, 2
%niter60.next.1 = add i64 %niter60, 2
%niter60.ncmp.1 = icmp eq i64 %niter60.next.1, %unroll_iter59
br i1 %niter60.ncmp.1, label %for.body18.preheader.i.unr-lcssa, label %for.body5.i, !llvm.loop !17
shaffle.exit: ; preds = %if.then, %for.body18.preheader.i
call void @llvm.lifetime.end.p0(i64 804, ptr nonnull %temp.i) #7
br label %for.inc
if.else: ; preds = %for.body
call void @llvm.lifetime.start.p0(i64 804, ptr nonnull %temp.i23) #7
%39 = load i32, ptr @n, align 4, !tbaa !5
%mul.i24 = shl nsw i32 %39, 1
%sub.i = sub nsw i32 %mul.i24, %11
%cmp41.i = icmp sgt i32 %sub.i, 0
br i1 %cmp41.i, label %for.body.preheader.i34, label %for.cond3.preheader.i25
for.body.preheader.i34: ; preds = %if.else
%40 = sext i32 %11 to i64
%41 = shl nsw i64 %40, 2
%scevgep.i = getelementptr i8, ptr @a, i64 %41
%42 = xor i32 %11, -1
%43 = add i32 %mul.i24, %42
%44 = zext i32 %43 to i64
%45 = shl nuw nsw i64 %44, 2
%46 = add nuw nsw i64 %45, 4
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %temp.i23, ptr noundef nonnull align 4 dereferenceable(1) %scevgep.i, i64 %46, i1 false), !tbaa !5
br label %for.cond3.preheader.i25
for.cond3.preheader.i25: ; preds = %for.body.preheader.i34, %if.else
%cmp444.i = icmp sgt i32 %11, 0
br i1 %cmp444.i, label %for.body5.preheader.i27, label %for.cond16.preheader.i
for.body5.preheader.i27: ; preds = %for.cond3.preheader.i25
%wide.trip.count.i28 = zext i32 %11 to i64
%min.iters.check44 = icmp ult i32 %11, 12
br i1 %min.iters.check44, label %for.body5.i29.preheader, label %vector.scevcheck
vector.scevcheck: ; preds = %for.body5.preheader.i27
%47 = add nsw i64 %wide.trip.count.i28, -1
%48 = trunc i64 %47 to i32
%49 = add i32 %sub.i, %48
%50 = icmp slt i32 %49, %sub.i
%51 = icmp ugt i64 %47, 4294967295
%52 = or i1 %50, %51
br i1 %52, label %for.body5.i29.preheader, label %vector.ph45
vector.ph45: ; preds = %vector.scevcheck
%n.vec47 = and i64 %wide.trip.count.i28, 4294967288
br label %vector.body50
vector.body50: ; preds = %vector.body50, %vector.ph45
%offset.idx = phi i64 [ 0, %vector.ph45 ], [ %index.next53, %vector.body50 ]
%53 = trunc i64 %offset.idx to i32
%54 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %54, align 16, !tbaa !5
%55 = getelementptr inbounds i32, ptr %54, i64 4
%wide.load52 = load <4 x i32>, ptr %55, align 16, !tbaa !5
%56 = add nsw i32 %sub.i, %53
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [201 x i32], ptr %temp.i23, i64 0, i64 %57
store <4 x i32> %wide.load, ptr %58, align 4, !tbaa !5
%59 = getelementptr inbounds i32, ptr %58, i64 4
store <4 x i32> %wide.load52, ptr %59, align 4, !tbaa !5
%index.next53 = add nuw i64 %offset.idx, 8
%60 = icmp eq i64 %index.next53, %n.vec47
br i1 %60, label %middle.block42, label %vector.body50, !llvm.loop !23
middle.block42: ; preds = %vector.body50
%cmp.n49 = icmp eq i64 %n.vec47, %wide.trip.count.i28
br i1 %cmp.n49, label %for.cond16.preheader.i, label %for.body5.i29.preheader
for.body5.i29.preheader: ; preds = %vector.scevcheck, %for.body5.preheader.i27, %middle.block42
%indvars.iv.i30.ph = phi i64 [ 0, %vector.scevcheck ], [ 0, %for.body5.preheader.i27 ], [ %n.vec47, %middle.block42 ]
%xtraiter = and i64 %wide.trip.count.i28, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body5.i29.prol.loopexit, label %for.body5.i29.prol
for.body5.i29.prol: ; preds = %for.body5.i29.preheader
%indvars51.i.prol = trunc i64 %indvars.iv.i30.ph to i32
%arrayidx7.i31.prol = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv.i30.ph
%61 = load i32, ptr %arrayidx7.i31.prol, align 16, !tbaa !5
%add10.i.prol = add nsw i32 %sub.i, %indvars51.i.prol
%idxprom11.i.prol = sext i32 %add10.i.prol to i64
%arrayidx12.i.prol = getelementptr inbounds [201 x i32], ptr %temp.i23, i64 0, i64 %idxprom11.i.prol
store i32 %61, ptr %arrayidx12.i.prol, align 4, !tbaa !5
%indvars.iv.next.i32.prol = or i64 %indvars.iv.i30.ph, 1
br label %for.body5.i29.prol.loopexit
for.body5.i29.prol.loopexit: ; preds = %for.body5.i29.prol, %for.body5.i29.preheader
%indvars.iv.i30.unr = phi i64 [ %indvars.iv.i30.ph, %for.body5.i29.preheader ], [ %indvars.iv.next.i32.prol, %for.body5.i29.prol ]
%62 = sub nsw i64 0, %wide.trip.count.i28
%63 = xor i64 %indvars.iv.i30.ph, %62
%64 = icmp eq i64 %63, -1
br i1 %64, label %for.cond16.preheader.i, label %for.body5.i29
for.cond16.preheader.i: ; preds = %for.body5.i29.prol.loopexit, %for.body5.i29, %middle.block42, %for.cond3.preheader.i25
%cmp1846.i = icmp sgt i32 %39, 0
br i1 %cmp1846.i, label %for.body19.preheader.i, label %cut.exit
for.body19.preheader.i: ; preds = %for.cond16.preheader.i
%smax.i26 = call i32 @llvm.smax.i32(i32 %mul.i24, i32 1)
%65 = zext i32 %smax.i26 to i64
%66 = shl nuw nsw i64 %65, 2
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @a, ptr noundef nonnull align 16 dereferenceable(1) %temp.i23, i64 %66, i1 false), !tbaa !5
br label %cut.exit
for.body5.i29: ; preds = %for.body5.i29.prol.loopexit, %for.body5.i29
%indvars.iv.i30 = phi i64 [ %indvars.iv.next.i32.1, %for.body5.i29 ], [ %indvars.iv.i30.unr, %for.body5.i29.prol.loopexit ]
%indvars51.i = trunc i64 %indvars.iv.i30 to i32
%arrayidx7.i31 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv.i30
%67 = load i32, ptr %arrayidx7.i31, align 4, !tbaa !5
%add10.i = add nsw i32 %sub.i, %indvars51.i
%idxprom11.i = sext i32 %add10.i to i64
%arrayidx12.i = getelementptr inbounds [201 x i32], ptr %temp.i23, i64 0, i64 %idxprom11.i
store i32 %67, ptr %arrayidx12.i, align 4, !tbaa !5
%indvars.iv.next.i32 = add nuw nsw i64 %indvars.iv.i30, 1
%indvars51.i.1 = trunc i64 %indvars.iv.next.i32 to i32
%arrayidx7.i31.1 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv.next.i32
%68 = load i32, ptr %arrayidx7.i31.1, align 4, !tbaa !5
%add10.i.1 = add nsw i32 %sub.i, %indvars51.i.1
%idxprom11.i.1 = sext i32 %add10.i.1 to i64
%arrayidx12.i.1 = getelementptr inbounds [201 x i32], ptr %temp.i23, i64 0, i64 %idxprom11.i.1
store i32 %68, ptr %arrayidx12.i.1, align 4, !tbaa !5
%indvars.iv.next.i32.1 = add nuw nsw i64 %indvars.iv.i30, 2
%exitcond.not.i33.1 = icmp eq i64 %indvars.iv.next.i32.1, %wide.trip.count.i28
br i1 %exitcond.not.i33.1, label %for.cond16.preheader.i, label %for.body5.i29, !llvm.loop !24
cut.exit: ; preds = %for.cond16.preheader.i, %for.body19.preheader.i
call void @llvm.lifetime.end.p0(i64 804, ptr nonnull %temp.i23) #7
br label %for.inc
for.inc: ; preds = %shaffle.exit, %cut.exit
%69 = phi i32 [ %12, %shaffle.exit ], [ %39, %cut.exit ]
%inc = add nuw nsw i32 %i.036, 1
%70 = load i32, ptr %m, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %70
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !25
for.body6: ; preds = %for.cond4.preheader, %for.body6
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body6 ], [ 0, %for.cond4.preheader ]
%arrayidx = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv
%71 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %71)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%72 = load i32, ptr @n, align 4, !tbaa !5
%mul = shl nsw i32 %72, 1
%73 = sext i32 %mul to i64
%cmp5 = icmp slt i64 %indvars.iv.next, %73
br i1 %cmp5, label %for.body6, label %for.end10, !llvm.loop !26
for.end10: ; preds = %for.body6, %for.cond4.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6
attributes #0 = { nofree nosync nounwind memory(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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !11, !12}
!19 = distinct !{!19, !10, !11}
!20 = distinct !{!20, !10, !11, !12}
!21 = distinct !{!21, !10, !12, !11}
!22 = distinct !{!22, !15}
!23 = distinct !{!23, !10, !11, !12}
!24 = distinct !{!24, !10, !11}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
|
#include <stdio.h>
int main(){
int x;
scanf("%d", &x);
printf("%d\n", x * x * x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323374/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323374/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
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;
scanf("%d",&x);
printf("%d\n",x*x*x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323424/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323424/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int x;
scanf("%d\n", &x);
x = x*x*x;
printf("%d\n", x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323468/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323468/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
store i32 %mul1, ptr %x, align 4, !tbaa !5
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %mul1)
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;
scanf("%d",&x);
y = x * x * x;
printf("%d\n",y);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323532/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323532/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
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;
scanf("%d", &x);
printf("%d\n", x*x*x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323576/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323576/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int a;
int b;
scanf("%d",&a);
b=a*a*a;
printf("%d\n",b);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323633/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323633/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int a;
scanf("%d",&a);
printf("%d\n",a*a*a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323677/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323677/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int h[n],w[n],i,low,high,prevheight=0;
for(i=0;i<n;i++)
scanf("%d %d",&h[i],&w[i]);
high = h[0] > w[0] ? h[0] : w[0] ;
prevheight = high ;
for(i=1;i<n;i++)
{
low = h[i] < w[i] ? h[i] : w[i] ;
high = h[i] > w[i] ? h[i] : w[i] ;
if(prevheight < low) break ;
else if(prevheight >= high) prevheight = high;
else prevheight = low ;
}
if(i==n) printf("YES");
else printf("NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_32372/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_32372/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%cmp77 = icmp sgt i32 %3, 0
br i1 %cmp77, label %for.body, label %for.end46
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%arrayidx3 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp1179 = icmp sgt i32 %5, 1
br i1 %cmp1179, label %for.body12.preheader, label %for.end46
for.body12.preheader: ; preds = %for.end
%.pre89 = load i32, ptr %vla1, align 16, !tbaa !5
%.pre = load i32, ptr %vla, align 16, !tbaa !5
%. = call i32 @llvm.smax.i32(i32 %.pre, i32 %.pre89)
%wide.trip.count = zext i32 %5 to i64
br label %for.body12
for.body12: ; preds = %for.body12.preheader, %if.else
%indvars.iv86 = phi i64 [ 1, %for.body12.preheader ], [ %indvars.iv.next87, %if.else ]
%prevheight.081 = phi i32 [ %., %for.body12.preheader ], [ %.76.cond38, %if.else ]
%arrayidx14 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv86
%7 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv86
%8 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%.76 = call i32 @llvm.smin.i32(i32 %7, i32 %8)
%cmp39 = icmp slt i32 %prevheight.081, %.76
br i1 %cmp39, label %for.end46.loopexit, label %if.else
if.else: ; preds = %for.body12
%cond38 = call i32 @llvm.smax.i32(i32 %7, i32 %8)
%cmp40.not = icmp slt i32 %prevheight.081, %cond38
%.76.cond38 = select i1 %cmp40.not, i32 %.76, i32 %cond38
%indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
%exitcond.not = icmp eq i64 %indvars.iv.next87, %wide.trip.count
br i1 %exitcond.not, label %if.end52, label %for.body12, !llvm.loop !11
for.end46.loopexit: ; preds = %for.body12
%9 = trunc i64 %indvars.iv86 to i32
br label %for.end46
for.end46: ; preds = %for.end46.loopexit, %entry, %for.end
%.lcssa92 = phi i32 [ %5, %for.end ], [ %3, %entry ], [ %5, %for.end46.loopexit ]
%i.1.lcssa = phi i32 [ 1, %for.end ], [ 1, %entry ], [ %9, %for.end46.loopexit ]
%cmp47 = icmp eq i32 %i.1.lcssa, %.lcssa92
%spec.select = select i1 %cmp47, ptr @.str.2, ptr @.str.3
br label %if.end52
if.end52: ; preds = %if.else, %for.end46
%.str.3.sink = phi ptr [ %spec.select, %for.end46 ], [ @.str.2, %if.else ]
%call51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; 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 = { 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}
|
#include<stdio.h>
int main(){
int x;
scanf("%d", &x);
printf("%d\n", x*x*x);
return 0;} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323770/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323770/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int a,x;
scanf("%d",&x);
a=x*x*x;
printf("%d\n",a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323820/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323820/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int a;
scanf("%d",&a);
printf("%d\n",a*a*a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323871/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323871/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int a;
scanf("%d",&a);
a=a*a*a;
printf("%d\n",a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323914/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323914/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
store i32 %mul1, ptr %a, align 4, !tbaa !5
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int x;
scanf("%d", &x);
printf("%d",x*x*x );
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_323958/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_323958/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %mul1)
%putchar = call i32 @putchar(i32 10)
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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int a;
scanf("%d",&a);
printf("%d\n",a*a*a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324007/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324007/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%mul1 = mul nsw i32 %mul, %0
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %mul1)
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>
#define MAX 1000
#define VMAX 10000
int n, A[MAX], s;
int B[MAX], T[VMAX+1];
int min(int a,int b){
if(a>b) return b;
else return a;
}
int partition(int A[],int p,int r){
int i,j;
int t,x;
x = A[r];
i = p - 1;
for(j=p;j<r;j++){
if(A[j]<=x){
i++;
t = A[i];
A[i] = A[j];
A[j] = t;
}
}
t = A[i+1];
A[i+1] = A[r];
A[r] = t;
return i+1;
}
void quickSort(int A[],int p,int r){
int q;
if(p<r){
q = partition(A,p,r);
quickSort(A,p,q-1);
quickSort(A,q+1,r);
}
}
int solve(){
int ans=0,i,cur,S,m,an,v;
int V[MAX];
for(i=0;i<n;i++){
B[i] = A[i];
V[i] = 0;
}
quickSort(B,0,n-1);
for(i=0;i<n;i++) T[B[i]] = i;
for(i=0;i<n;i++){
if(V[i]) continue;
cur = i;
S = 0;
m = VMAX;
an = 0;
while(1){
V[cur] = 1;
an++;
v = A[cur];
m = min(m,v);
S += v;
cur = T[v];
if(V[cur]) break;
}
ans += min(S+(an-2)*m,m+S+(an+1)*s);
}
return ans;
}
int main(){
int i;
scanf("%d", &n);
s = VMAX;
for(i=0;i<n;i++){
scanf("%d",&A[i]);
s = min(s,A[i]);
}
int ans = solve();
printf("%d\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324058/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324058/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@A = dso_local global [1000 x i32] zeroinitializer, align 16
@B = dso_local global [1000 x i32] zeroinitializer, align 16
@T = dso_local local_unnamed_addr global [10001 x i32] zeroinitializer, align 16
@s = 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\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%b.a = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %b.a
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @partition(ptr nocapture noundef %A, i32 noundef %p, i32 noundef %r) local_unnamed_addr #1 {
entry:
%idxprom = sext i32 %r to i64
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp46 = icmp slt i32 %p, %r
br i1 %cmp46, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%sub = add nsw i32 %p, -1
%1 = sext i32 %p to i64
%2 = sub nsw i64 %idxprom, %1
%xtraiter = and i64 %2, 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
%arrayidx2.prol = getelementptr inbounds i32, ptr %A, i64 %1
%3 = load i32, ptr %arrayidx2.prol, align 4, !tbaa !5
%cmp3.not.prol = icmp sgt i32 %3, %0
br i1 %cmp3.not.prol, label %for.inc.prol, label %if.then.prol
if.then.prol: ; preds = %for.body.prol
%idxprom4.prol = sext i32 %p to i64
%arrayidx5.prol = getelementptr inbounds i32, ptr %A, i64 %idxprom4.prol
%4 = load i32, ptr %arrayidx5.prol, align 4, !tbaa !5
store i32 %3, ptr %arrayidx5.prol, align 4, !tbaa !5
store i32 %4, ptr %arrayidx2.prol, align 4, !tbaa !5
br label %for.inc.prol
for.inc.prol: ; preds = %if.then.prol, %for.body.prol
%i.1.prol = phi i32 [ %p, %if.then.prol ], [ %sub, %for.body.prol ]
%indvars.iv.next.prol = add nsw i64 %1, 1
br label %for.body.prol.loopexit
for.body.prol.loopexit: ; preds = %for.inc.prol, %for.body.preheader
%i.1.lcssa.unr = phi i32 [ undef, %for.body.preheader ], [ %i.1.prol, %for.inc.prol ]
%indvars.iv.unr = phi i64 [ %1, %for.body.preheader ], [ %indvars.iv.next.prol, %for.inc.prol ]
%i.048.unr = phi i32 [ %sub, %for.body.preheader ], [ %i.1.prol, %for.inc.prol ]
%5 = sub nsw i64 0, %idxprom
%6 = xor i64 %1, %5
%7 = icmp eq i64 %6, -1
br i1 %7, label %for.end.loopexit, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.prol.loopexit
%invariant.gep = getelementptr i32, ptr %A, i64 1
br label %for.body
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ %indvars.iv.unr, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%i.048 = phi i32 [ %i.048.unr, %for.body.preheader.new ], [ %i.1.1, %for.inc.1 ]
%arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
%8 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp3.not = icmp sgt i32 %8, %0
br i1 %cmp3.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%inc = add nsw i32 %i.048, 1
%idxprom4 = sext i32 %inc to i64
%arrayidx5 = getelementptr inbounds i32, ptr %A, i64 %idxprom4
%9 = load i32, ptr %arrayidx5, align 4, !tbaa !5
store i32 %8, ptr %arrayidx5, align 4, !tbaa !5
store i32 %9, ptr %arrayidx2, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%i.1 = phi i32 [ %inc, %if.then ], [ %i.048, %for.body ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
%10 = load i32, ptr %gep, align 4, !tbaa !5
%cmp3.not.1 = icmp sgt i32 %10, %0
br i1 %cmp3.not.1, label %for.inc.1, label %if.then.1
if.then.1: ; preds = %for.inc
%inc.1 = add nsw i32 %i.1, 1
%idxprom4.1 = sext i32 %inc.1 to i64
%arrayidx5.1 = getelementptr inbounds i32, ptr %A, i64 %idxprom4.1
%11 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
store i32 %10, ptr %arrayidx5.1, align 4, !tbaa !5
store i32 %11, ptr %gep, align 4, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%i.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ %i.1, %for.inc ]
%indvars.iv.next.1 = add nsw i64 %indvars.iv, 2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %idxprom
br i1 %exitcond.not.1, label %for.end.loopexit, label %for.body, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc.1, %for.body.prol.loopexit
%i.1.lcssa = phi i32 [ %i.1.lcssa.unr, %for.body.prol.loopexit ], [ %i.1.1, %for.inc.1 ]
%.pre = load i32, ptr %arrayidx, align 4, !tbaa !5
%12 = add nsw i32 %i.1.lcssa, 1
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%13 = phi i32 [ %0, %entry ], [ %.pre, %for.end.loopexit ]
%i.0.lcssa = phi i32 [ %p, %entry ], [ %12, %for.end.loopexit ]
%idxprom13 = sext i32 %i.0.lcssa to i64
%arrayidx14 = getelementptr inbounds i32, ptr %A, i64 %idxprom13
%14 = load i32, ptr %arrayidx14, align 4, !tbaa !5
store i32 %13, ptr %arrayidx14, align 4, !tbaa !5
store i32 %14, ptr %arrayidx, align 4, !tbaa !5
ret i32 %i.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @quickSort(ptr nocapture noundef %A, i32 noundef %p, i32 noundef %r) local_unnamed_addr #3 {
entry:
%cmp8 = icmp slt i32 %p, %r
br i1 %cmp8, label %for.body.preheader.i.lr.ph, label %if.end
for.body.preheader.i.lr.ph: ; preds = %entry
%idxprom.i = sext i32 %r to i64
%arrayidx.i = getelementptr inbounds i32, ptr %A, i64 %idxprom.i
%0 = sub nsw i64 0, %idxprom.i
%invariant.gep = getelementptr i32, ptr %A, i64 1
br label %for.body.preheader.i
for.body.preheader.i: ; preds = %for.body.preheader.i.lr.ph, %partition.exit
%p.tr9 = phi i32 [ %p, %for.body.preheader.i.lr.ph ], [ %add, %partition.exit ]
%1 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%sub.i = add nsw i32 %p.tr9, -1
%2 = sext i32 %p.tr9 to i64
%3 = sub nsw i64 %idxprom.i, %2
%xtraiter = and i64 %3, 1
%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.preheader.i
%arrayidx2.i.prol = getelementptr inbounds i32, ptr %A, i64 %2
%4 = load i32, ptr %arrayidx2.i.prol, align 4, !tbaa !5
%cmp3.not.i.prol = icmp sgt i32 %4, %1
br i1 %cmp3.not.i.prol, label %for.inc.i.prol, label %if.then.i.prol
if.then.i.prol: ; preds = %for.body.i.prol
%idxprom4.i.prol = sext i32 %p.tr9 to i64
%arrayidx5.i.prol = getelementptr inbounds i32, ptr %A, i64 %idxprom4.i.prol
%5 = load i32, ptr %arrayidx5.i.prol, align 4, !tbaa !5
store i32 %4, ptr %arrayidx5.i.prol, align 4, !tbaa !5
store i32 %5, ptr %arrayidx2.i.prol, align 4, !tbaa !5
br label %for.inc.i.prol
for.inc.i.prol: ; preds = %if.then.i.prol, %for.body.i.prol
%i.1.i.prol = phi i32 [ %p.tr9, %if.then.i.prol ], [ %sub.i, %for.body.i.prol ]
%indvars.iv.next.i.prol = add nsw i64 %2, 1
br label %for.body.i.prol.loopexit
for.body.i.prol.loopexit: ; preds = %for.inc.i.prol, %for.body.preheader.i
%i.1.i.lcssa.unr = phi i32 [ undef, %for.body.preheader.i ], [ %i.1.i.prol, %for.inc.i.prol ]
%indvars.iv.i.unr = phi i64 [ %2, %for.body.preheader.i ], [ %indvars.iv.next.i.prol, %for.inc.i.prol ]
%i.048.i.unr = phi i32 [ %sub.i, %for.body.preheader.i ], [ %i.1.i.prol, %for.inc.i.prol ]
%6 = xor i64 %2, %0
%7 = icmp eq i64 %6, -1
br i1 %7, label %partition.exit, label %for.body.i
for.body.i: ; preds = %for.body.i.prol.loopexit, %for.inc.i.1
%indvars.iv.i = phi i64 [ %indvars.iv.next.i.1, %for.inc.i.1 ], [ %indvars.iv.i.unr, %for.body.i.prol.loopexit ]
%i.048.i = phi i32 [ %i.1.i.1, %for.inc.i.1 ], [ %i.048.i.unr, %for.body.i.prol.loopexit ]
%arrayidx2.i = getelementptr inbounds i32, ptr %A, i64 %indvars.iv.i
%8 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp3.not.i = icmp sgt i32 %8, %1
br i1 %cmp3.not.i, label %for.inc.i, label %if.then.i
if.then.i: ; preds = %for.body.i
%inc.i = add nsw i32 %i.048.i, 1
%idxprom4.i = sext i32 %inc.i to i64
%arrayidx5.i = getelementptr inbounds i32, ptr %A, i64 %idxprom4.i
%9 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
store i32 %8, ptr %arrayidx5.i, align 4, !tbaa !5
store i32 %9, ptr %arrayidx2.i, align 4, !tbaa !5
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body.i
%i.1.i = phi i32 [ %inc.i, %if.then.i ], [ %i.048.i, %for.body.i ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv.i
%10 = load i32, ptr %gep, align 4, !tbaa !5
%cmp3.not.i.1 = icmp sgt i32 %10, %1
br i1 %cmp3.not.i.1, label %for.inc.i.1, label %if.then.i.1
if.then.i.1: ; preds = %for.inc.i
%inc.i.1 = add nsw i32 %i.1.i, 1
%idxprom4.i.1 = sext i32 %inc.i.1 to i64
%arrayidx5.i.1 = getelementptr inbounds i32, ptr %A, i64 %idxprom4.i.1
%11 = load i32, ptr %arrayidx5.i.1, align 4, !tbaa !5
store i32 %10, ptr %arrayidx5.i.1, align 4, !tbaa !5
store i32 %11, ptr %gep, align 4, !tbaa !5
br label %for.inc.i.1
for.inc.i.1: ; preds = %if.then.i.1, %for.inc.i
%i.1.i.1 = phi i32 [ %inc.i.1, %if.then.i.1 ], [ %i.1.i, %for.inc.i ]
%indvars.iv.next.i.1 = add nsw i64 %indvars.iv.i, 2
%exitcond.not.i.1 = icmp eq i64 %indvars.iv.next.i.1, %idxprom.i
br i1 %exitcond.not.i.1, label %partition.exit, label %for.body.i, !llvm.loop !9
partition.exit: ; preds = %for.inc.i.1, %for.body.i.prol.loopexit
%i.1.i.lcssa = phi i32 [ %i.1.i.lcssa.unr, %for.body.i.prol.loopexit ], [ %i.1.i.1, %for.inc.i.1 ]
%.pre.i = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%12 = add nsw i32 %i.1.i.lcssa, 1
%idxprom13.i = sext i32 %12 to i64
%arrayidx14.i = getelementptr inbounds i32, ptr %A, i64 %idxprom13.i
%13 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5
store i32 %.pre.i, ptr %arrayidx14.i, align 4, !tbaa !5
store i32 %13, ptr %arrayidx.i, align 4, !tbaa !5
tail call void @quickSort(ptr noundef nonnull %A, i32 noundef %p.tr9, i32 noundef %i.1.i.lcssa)
%add = add nsw i32 %i.1.i.lcssa, 2
%cmp = icmp slt i32 %add, %r
br i1 %cmp, label %for.body.preheader.i, label %if.end
if.end: ; preds = %partition.exit, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @solve() local_unnamed_addr #4 {
entry:
%V = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %V) #10
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp67 = icmp sgt i32 %0, 0
br i1 %cmp67, label %for.body7.preheader, label %for.cond15.preheader.thread
for.cond15.preheader.thread: ; preds = %entry
%sub = add nsw i32 %0, -1
tail call void @quickSort(ptr noundef nonnull @B, i32 noundef 0, i32 noundef %sub)
br label %for.end42
for.body7.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %V, i8 0, i64 %2, i1 false), !tbaa !5
tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @B, ptr nonnull align 16 @A, i64 %2, i1 false), !tbaa !5
%sub82 = add nsw i32 %0, -1
tail call void @quickSort(ptr noundef nonnull @B, i32 noundef 0, i32 noundef %sub82)
%wide.trip.count = zext i32 %0 to i64
%xtraiter = and i64 %wide.trip.count, 3
%3 = icmp ult i32 %0, 4
br i1 %3, label %for.cond15.preheader.unr-lcssa, label %for.body7.preheader.new
for.body7.preheader.new: ; preds = %for.body7.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body7
for.cond15.preheader.unr-lcssa: ; preds = %for.body7, %for.body7.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body7.preheader ], [ %indvars.iv.next.3, %for.body7 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond15.preheader, label %for.body7.epil
for.body7.epil: ; preds = %for.cond15.preheader.unr-lcssa, %for.body7.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body7.epil ], [ %indvars.iv.unr, %for.cond15.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body7.epil ], [ 0, %for.cond15.preheader.unr-lcssa ]
%arrayidx9.epil = getelementptr inbounds [1000 x i32], ptr @B, i64 0, i64 %indvars.iv.epil
%4 = load i32, ptr %arrayidx9.epil, align 4, !tbaa !5
%idxprom10.epil = sext i32 %4 to i64
%arrayidx11.epil = getelementptr inbounds [10001 x i32], ptr @T, i64 0, i64 %idxprom10.epil
%5 = trunc i64 %indvars.iv.epil to i32
store i32 %5, ptr %arrayidx11.epil, align 4, !tbaa !5
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond15.preheader, label %for.body7.epil, !llvm.loop !11
for.cond15.preheader: ; preds = %for.body7.epil, %for.cond15.preheader.unr-lcssa
br i1 %cmp67, label %for.body17.lr.ph, label %for.end42
for.body17.lr.ph: ; preds = %for.cond15.preheader
%6 = load i32, ptr @s, align 4
%wide.trip.count80 = zext i32 %0 to i64
br label %for.body17
for.body7: ; preds = %for.body7, %for.body7.preheader.new
%indvars.iv = phi i64 [ 0, %for.body7.preheader.new ], [ %indvars.iv.next.3, %for.body7 ]
%niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.3, %for.body7 ]
%arrayidx9 = getelementptr inbounds [1000 x i32], ptr @B, i64 0, i64 %indvars.iv
%7 = load i32, ptr %arrayidx9, align 16, !tbaa !5
%idxprom10 = sext i32 %7 to i64
%arrayidx11 = getelementptr inbounds [10001 x i32], ptr @T, i64 0, i64 %idxprom10
%8 = trunc i64 %indvars.iv to i32
store i32 %8, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx9.1 = getelementptr inbounds [1000 x i32], ptr @B, i64 0, i64 %indvars.iv.next
%9 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5
%idxprom10.1 = sext i32 %9 to i64
%arrayidx11.1 = getelementptr inbounds [10001 x i32], ptr @T, i64 0, i64 %idxprom10.1
%10 = trunc i64 %indvars.iv.next to i32
store i32 %10, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx9.2 = getelementptr inbounds [1000 x i32], ptr @B, i64 0, i64 %indvars.iv.next.1
%11 = load i32, ptr %arrayidx9.2, align 8, !tbaa !5
%idxprom10.2 = sext i32 %11 to i64
%arrayidx11.2 = getelementptr inbounds [10001 x i32], ptr @T, i64 0, i64 %idxprom10.2
%12 = trunc i64 %indvars.iv.next.1 to i32
store i32 %12, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx9.3 = getelementptr inbounds [1000 x i32], ptr @B, i64 0, i64 %indvars.iv.next.2
%13 = load i32, ptr %arrayidx9.3, align 4, !tbaa !5
%idxprom10.3 = sext i32 %13 to i64
%arrayidx11.3 = getelementptr inbounds [10001 x i32], ptr @T, i64 0, i64 %idxprom10.3
%14 = trunc i64 %indvars.iv.next.2 to i32
store i32 %14, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond15.preheader.unr-lcssa, label %for.body7, !llvm.loop !13
for.body17: ; preds = %for.body17.lr.ph, %for.inc40
%indvars.iv77 = phi i64 [ 0, %for.body17.lr.ph ], [ %indvars.iv.next78, %for.inc40 ]
%ans.073 = phi i32 [ 0, %for.body17.lr.ph ], [ %ans.1, %for.inc40 ]
%arrayidx19 = getelementptr inbounds [1000 x i32], ptr %V, i64 0, i64 %indvars.iv77
%15 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%tobool.not = icmp eq i32 %15, 0
br i1 %tobool.not, label %while.cond.preheader, label %for.inc40
while.cond.preheader: ; preds = %for.body17
%16 = trunc i64 %indvars.iv77 to i32
br label %while.cond
while.cond: ; preds = %while.cond.preheader, %while.cond
%cur.0 = phi i32 [ %18, %while.cond ], [ %16, %while.cond.preheader ]
%S.0 = phi i32 [ %add, %while.cond ], [ 0, %while.cond.preheader ]
%m.0 = phi i32 [ %b.a.i, %while.cond ], [ 10000, %while.cond.preheader ]
%an.0 = phi i32 [ %inc22, %while.cond ], [ 0, %while.cond.preheader ]
%idxprom20 = sext i32 %cur.0 to i64
%arrayidx21 = getelementptr inbounds [1000 x i32], ptr %V, i64 0, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc22 = add nuw nsw i32 %an.0, 1
%arrayidx24 = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %idxprom20
%17 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%b.a.i = tail call i32 @llvm.smin.i32(i32 %m.0, i32 %17)
%add = add nsw i32 %17, %S.0
%idxprom25 = sext i32 %17 to i64
%arrayidx26 = getelementptr inbounds [10001 x i32], ptr @T, i64 0, i64 %idxprom25
%18 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%idxprom27 = sext i32 %18 to i64
%arrayidx28 = getelementptr inbounds [1000 x i32], ptr %V, i64 0, i64 %idxprom27
%19 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%tobool29.not = icmp eq i32 %19, 0
br i1 %tobool29.not, label %while.cond, label %while.end
while.end: ; preds = %while.cond
%sub32 = add nsw i32 %an.0, -1
%mul = mul nsw i32 %b.a.i, %sub32
%add33 = add nsw i32 %mul, %add
%add34 = add nsw i32 %b.a.i, %add
%add35 = add nuw nsw i32 %an.0, 2
%mul36 = mul nsw i32 %6, %add35
%add37 = add nsw i32 %add34, %mul36
%b.a.i66 = tail call i32 @llvm.smin.i32(i32 %add33, i32 %add37)
%add39 = add nsw i32 %b.a.i66, %ans.073
br label %for.inc40
for.inc40: ; preds = %for.body17, %while.end
%ans.1 = phi i32 [ %ans.073, %for.body17 ], [ %add39, %while.end ]
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%exitcond81.not = icmp eq i64 %indvars.iv.next78, %wide.trip.count80
br i1 %exitcond81.not, label %for.end42, label %for.body17, !llvm.loop !14
for.end42: ; preds = %for.inc40, %for.cond15.preheader.thread, %for.cond15.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond15.preheader ], [ 0, %for.cond15.preheader.thread ], [ %ans.1, %for.inc40 ]
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %V) #10
ret i32 %ans.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #5 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
store i32 10000, ptr @s, align 4, !tbaa !5
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr @A, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr @s, align 4, !tbaa !5
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%b.a.i = tail call i32 @llvm.smin.i32(i32 %1, i32 %2)
store i32 %b.a.i, ptr @s, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr @n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !15
for.end: ; preds = %for.body, %entry
%call5 = tail call i32 @solve()
%call6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call5)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #8
; 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) #9
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(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree 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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #10 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#include <memory.h>
#define MIN(x, y) ((x) <= (y) ? (x) : (y))
int get_uint() {
int n = 0;
int c = getchar_unlocked();
if(c < 48 || 57 < c) return c;
while(47 < c && c < 58) {
n = 10 * n + (c & 0xf);
c = getchar_unlocked();
}
return n;
}
void put_uint(int n) {
if(!n) {
putchar_unlocked('0');
return;
}
char buf[11];
int i = 0;
while(n) buf[i++] = (char)(n % 10 + '0'), n /= 10;
while(i--)putchar_unlocked(buf[i]);
}
void *partition(int *first, int *last) {
int pivot = *(last - 1);
int *p = first - 1;
for(int *it = first; it != last - 1; ++it) {
if(*it <= pivot) {
p++;
int tmp = *p;
*p = *it;
*it = tmp;
}
}
int tmp = *++p;
*p = pivot;
*(last - 1) = tmp;
return p;
}
void quick_sort(void *first, void *last, size_t N) {
if(last - first <= N) return;
void *mid = partition(first, last);
quick_sort(first, mid, N);
quick_sort(mid, last, N);
}
int mincost_sort(const int *a, const int N, const int minw) {
int cnt = 0;
int b[N];
memcpy(b, a, N * sizeof(int));
quick_sort(b, b + N, sizeof(int));
int pos[10001];
for(int i = 0; i < N; ++i) pos[b[i]] = i;
int flag[1001] = {};
for(int i = 0; i < N; ++i) {
if(flag[i]) continue;
int cur = i;
int sum = 0;
int num = 0;
int mina = 1 << 29;
while(!flag[cur]) {
flag[cur] = 1;
num++;
sum += a[cur];
mina = MIN(mina, a[cur]);
cur = pos[a[cur]];
}
// [ sum + (num-2)*mina + 2(mina+minw) - (num-1)*(mina-minw) ] -> [ sum + mina + (n+1)*minw ]
cnt += MIN(sum + (num - 2) * mina, sum + mina + (num + 1) * minw);
}
return cnt;
}
int main(int argc, char **argv) {
int n = get_uint();
int w[n];
int minw = 1 << 29;
for(int i = 0; i < n; ++i) {
w[i] = get_uint();
minw = MIN(minw, w[i]);
}
put_uint(mincost_sort(w, n, minw));
putchar_unlocked('\n');
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324100/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324100/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nounwind uwtable
define dso_local i32 @get_uint() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #8
br label %getchar_unlocked.exit
cond.false.i: ; preds = %entry
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%conv3.i = zext i8 %3 to i32
br label %getchar_unlocked.exit
getchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
%cond.i = phi i32 [ %call.i, %cond.true.i ], [ %conv3.i, %cond.false.i ]
%4 = add i32 %cond.i, -58
%or.cond = icmp ult i32 %4, -10
br i1 %or.cond, label %cleanup, label %while.body.preheader
while.body.preheader: ; preds = %getchar_unlocked.exit
%.pre24 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.preheader, %getchar_unlocked.exit21
%5 = phi ptr [ %9, %getchar_unlocked.exit21 ], [ %.pre24, %while.body.preheader ]
%c.023 = phi i32 [ %cond.i17, %getchar_unlocked.exit21 ], [ %cond.i, %while.body.preheader ]
%n.022 = phi i32 [ %add, %getchar_unlocked.exit21 ], [ 0, %while.body.preheader ]
%mul = mul nsw i32 %n.022, 10
%and = and i32 %c.023, 15
%add = add nsw i32 %and, %mul
%_IO_read_ptr.i12 = getelementptr inbounds %struct._IO_FILE, ptr %5, i64 0, i32 1
%6 = load ptr, ptr %_IO_read_ptr.i12, align 8, !tbaa !9
%_IO_read_end.i13 = getelementptr inbounds %struct._IO_FILE, ptr %5, i64 0, i32 2
%7 = load ptr, ptr %_IO_read_end.i13, align 8, !tbaa !14
%cmp.not.i14 = icmp ult ptr %6, %7
br i1 %cmp.not.i14, label %cond.false.i18, label %cond.true.i15, !prof !15
cond.true.i15: ; preds = %while.body
%call.i16 = tail call i32 @__uflow(ptr noundef nonnull %5) #8
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit21
cond.false.i18: ; preds = %while.body
%incdec.ptr.i19 = getelementptr inbounds i8, ptr %6, i64 1
store ptr %incdec.ptr.i19, ptr %_IO_read_ptr.i12, align 8, !tbaa !9
%8 = load i8, ptr %6, align 1, !tbaa !16
%conv3.i20 = zext i8 %8 to i32
br label %getchar_unlocked.exit21
getchar_unlocked.exit21: ; preds = %cond.true.i15, %cond.false.i18
%9 = phi ptr [ %.pre, %cond.true.i15 ], [ %5, %cond.false.i18 ]
%cond.i17 = phi i32 [ %call.i16, %cond.true.i15 ], [ %conv3.i20, %cond.false.i18 ]
%10 = add i32 %cond.i17, -48
%11 = icmp ult i32 %10, 10
br i1 %11, label %while.body, label %cleanup, !llvm.loop !17
cleanup: ; preds = %getchar_unlocked.exit21, %getchar_unlocked.exit
%retval.0 = phi i32 [ %cond.i, %getchar_unlocked.exit ], [ %add, %getchar_unlocked.exit21 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nounwind uwtable
define dso_local void @put_uint(i32 noundef %n) local_unnamed_addr #0 {
entry:
%buf = alloca [11 x i8], align 1
%tobool.not = icmp eq i32 %n, 0
br i1 %tobool.not, label %if.then, label %if.end
if.then: ; preds = %entry
%0 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 5
%1 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !19
%_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 6
%2 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !20
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %if.then
%call.i = tail call i32 @__overflow(ptr noundef nonnull %0, i32 noundef 48) #8
br label %return
cond.false.i: ; preds = %if.then
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !19
store i8 48, ptr %1, align 1, !tbaa !16
br label %return
if.end: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %buf) #8
br label %while.body
while.body: ; preds = %if.end, %while.body
%indvars.iv28 = phi i32 [ 1, %if.end ], [ %indvars.iv.next29, %while.body ]
%indvars.iv = phi i64 [ 0, %if.end ], [ %indvars.iv.next, %while.body ]
%n.addr.024 = phi i32 [ %n, %if.end ], [ %div, %while.body ]
%rem = srem i32 %n.addr.024, 10
%3 = trunc i32 %rem to i8
%conv = add nsw i8 %3, 48
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [11 x i8], ptr %buf, i64 0, i64 %indvars.iv
store i8 %conv, ptr %arrayidx, align 1, !tbaa !16
%div = sdiv i32 %n.addr.024, 10
%n.addr.024.off = add i32 %n.addr.024, 9
%tobool1.not = icmp ult i32 %n.addr.024.off, 19
%indvars.iv.next29 = add nuw i32 %indvars.iv28, 1
br i1 %tobool1.not, label %while.body4.preheader, label %while.body, !llvm.loop !21
while.body4.preheader: ; preds = %while.body
%4 = sext i32 %indvars.iv28 to i64
br label %while.body4
while.body4: ; preds = %while.body4.preheader, %putchar_unlocked.exit23
%indvars.iv30 = phi i64 [ %4, %while.body4.preheader ], [ %indvars.iv.next31, %putchar_unlocked.exit23 ]
%indvars.iv.next31 = add nsw i64 %indvars.iv30, -1
%arrayidx6 = getelementptr inbounds [11 x i8], ptr %buf, i64 0, i64 %indvars.iv.next31
%5 = load i8, ptr %arrayidx6, align 1, !tbaa !16
%6 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i15 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 5
%7 = load ptr, ptr %_IO_write_ptr.i15, align 8, !tbaa !19
%_IO_write_end.i16 = getelementptr inbounds %struct._IO_FILE, ptr %6, i64 0, i32 6
%8 = load ptr, ptr %_IO_write_end.i16, align 8, !tbaa !20
%cmp.not.i17 = icmp ult ptr %7, %8
br i1 %cmp.not.i17, label %cond.false.i21, label %cond.true.i18, !prof !15
cond.true.i18: ; preds = %while.body4
%conv7 = zext i8 %5 to i32
%call.i19 = tail call i32 @__overflow(ptr noundef nonnull %6, i32 noundef %conv7) #8
br label %putchar_unlocked.exit23
cond.false.i21: ; preds = %while.body4
%incdec.ptr.i22 = getelementptr inbounds i8, ptr %7, i64 1
store ptr %incdec.ptr.i22, ptr %_IO_write_ptr.i15, align 8, !tbaa !19
store i8 %5, ptr %7, align 1, !tbaa !16
br label %putchar_unlocked.exit23
putchar_unlocked.exit23: ; preds = %cond.true.i18, %cond.false.i21
%9 = and i64 %indvars.iv.next31, 4294967295
%tobool3.not = icmp eq i64 %9, 0
br i1 %tobool3.not, label %while.end9, label %while.body4, !llvm.loop !22
while.end9: ; preds = %putchar_unlocked.exit23
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %buf) #8
br label %return
return: ; preds = %cond.false.i, %cond.true.i, %while.end9
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local nonnull ptr @partition(ptr noundef %first, ptr noundef %last) local_unnamed_addr #2 {
entry:
%add.ptr = getelementptr inbounds i32, ptr %last, i64 -1
%0 = load i32, ptr %add.ptr, align 4, !tbaa !23
%add.ptr1 = getelementptr inbounds i32, ptr %first, i64 -1
%cmp.not21 = icmp eq ptr %add.ptr, %first
br i1 %cmp.not21, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.inc, %entry
%p.0.lcssa = phi ptr [ %add.ptr1, %entry ], [ %p.1, %for.inc ]
%incdec.ptr6 = getelementptr inbounds i32, ptr %p.0.lcssa, i64 1
%1 = load i32, ptr %incdec.ptr6, align 4, !tbaa !23
store i32 %0, ptr %incdec.ptr6, align 4, !tbaa !23
store i32 %1, ptr %add.ptr, align 4, !tbaa !23
ret ptr %incdec.ptr6
for.body: ; preds = %entry, %for.inc
%p.023 = phi ptr [ %p.1, %for.inc ], [ %add.ptr1, %entry ]
%it.022 = phi ptr [ %incdec.ptr4, %for.inc ], [ %first, %entry ]
%2 = load i32, ptr %it.022, align 4, !tbaa !23
%cmp3.not = icmp sgt i32 %2, %0
br i1 %cmp3.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%incdec.ptr = getelementptr inbounds i32, ptr %p.023, i64 1
%3 = load i32, ptr %incdec.ptr, align 4, !tbaa !23
store i32 %2, ptr %incdec.ptr, align 4, !tbaa !23
store i32 %3, ptr %it.022, align 4, !tbaa !23
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%p.1 = phi ptr [ %incdec.ptr, %if.then ], [ %p.023, %for.body ]
%incdec.ptr4 = getelementptr inbounds i32, ptr %it.022, i64 1
%cmp.not = icmp eq ptr %incdec.ptr4, %add.ptr
br i1 %cmp.not, label %for.cond.cleanup, label %for.body, !llvm.loop !24
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @quick_sort(ptr noundef %first, ptr noundef %last, i64 noundef %N) local_unnamed_addr #3 {
entry:
%sub.ptr.lhs.cast = ptrtoint ptr %last to i64
%sub.ptr.rhs.cast8 = ptrtoint ptr %first to i64
%sub.ptr.sub9 = sub i64 %sub.ptr.lhs.cast, %sub.ptr.rhs.cast8
%cmp.not10 = icmp ugt i64 %sub.ptr.sub9, %N
br i1 %cmp.not10, label %if.end.lr.ph, label %return
if.end.lr.ph: ; preds = %entry
%add.ptr.i = getelementptr inbounds i32, ptr %last, i64 -1
br label %if.end
if.end: ; preds = %if.end.lr.ph, %partition.exit
%first.tr11 = phi ptr [ %first, %if.end.lr.ph ], [ %incdec.ptr6.i, %partition.exit ]
%0 = load i32, ptr %add.ptr.i, align 4, !tbaa !23
%add.ptr1.i = getelementptr inbounds i32, ptr %first.tr11, i64 -1
%cmp.not21.i = icmp eq ptr %add.ptr.i, %first.tr11
br i1 %cmp.not21.i, label %partition.exit, label %for.body.i
for.body.i: ; preds = %if.end, %for.inc.i
%p.023.i = phi ptr [ %p.1.i, %for.inc.i ], [ %add.ptr1.i, %if.end ]
%it.022.i = phi ptr [ %incdec.ptr4.i, %for.inc.i ], [ %first.tr11, %if.end ]
%1 = load i32, ptr %it.022.i, align 4, !tbaa !23
%cmp3.not.i = icmp sgt i32 %1, %0
br i1 %cmp3.not.i, label %for.inc.i, label %if.then.i
if.then.i: ; preds = %for.body.i
%incdec.ptr.i = getelementptr inbounds i32, ptr %p.023.i, i64 1
%2 = load i32, ptr %incdec.ptr.i, align 4, !tbaa !23
store i32 %1, ptr %incdec.ptr.i, align 4, !tbaa !23
store i32 %2, ptr %it.022.i, align 4, !tbaa !23
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body.i
%p.1.i = phi ptr [ %incdec.ptr.i, %if.then.i ], [ %p.023.i, %for.body.i ]
%incdec.ptr4.i = getelementptr inbounds i32, ptr %it.022.i, i64 1
%cmp.not.i = icmp eq ptr %incdec.ptr4.i, %add.ptr.i
br i1 %cmp.not.i, label %partition.exit, label %for.body.i, !llvm.loop !24
partition.exit: ; preds = %for.inc.i, %if.end
%p.0.lcssa.i = phi ptr [ %add.ptr1.i, %if.end ], [ %p.1.i, %for.inc.i ]
%incdec.ptr6.i = getelementptr inbounds i32, ptr %p.0.lcssa.i, i64 1
%3 = load i32, ptr %incdec.ptr6.i, align 4, !tbaa !23
store i32 %0, ptr %incdec.ptr6.i, align 4, !tbaa !23
store i32 %3, ptr %add.ptr.i, align 4, !tbaa !23
tail call void @quick_sort(ptr noundef %first.tr11, ptr noundef nonnull %incdec.ptr6.i, i64 noundef %N)
%sub.ptr.rhs.cast = ptrtoint ptr %incdec.ptr6.i to i64
%sub.ptr.sub = sub i64 %sub.ptr.lhs.cast, %sub.ptr.rhs.cast
%cmp.not = icmp ugt i64 %sub.ptr.sub, %N
br i1 %cmp.not, label %if.end, label %return
return: ; preds = %partition.exit, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @mincost_sort(ptr nocapture noundef readonly %a, i32 noundef %N, i32 noundef %minw) local_unnamed_addr #3 {
entry:
%pos = alloca [10001 x i32], align 16
%flag = alloca [1001 x i32], align 16
%0 = zext i32 %N to i64
%vla = alloca i32, i64 %0, align 16
%conv = sext i32 %N to i64
%mul = shl nsw i64 %conv, 2
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %vla, ptr align 4 %a, i64 %mul, i1 false)
%add.ptr = getelementptr inbounds i32, ptr %vla, i64 %conv
call void @quick_sort(ptr noundef nonnull %vla, ptr noundef nonnull %add.ptr, i64 noundef 4)
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %pos) #8
%cmp87 = icmp sgt i32 %N, 0
br i1 %cmp87, label %for.body.preheader, label %for.cond.cleanup.thread
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %0, 3
%1 = icmp ult i32 %N, 4
br i1 %1, label %for.cond.cleanup.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %0, 4294967292
br label %for.body
for.cond.cleanup.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %flag) #8
br label %for.cond.cleanup8
for.cond.cleanup.unr-lcssa: ; preds = %for.body, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil
for.body.epil: ; preds = %for.cond.cleanup.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond.cleanup.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond.cleanup.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.epil
%2 = load i32, ptr %arrayidx.epil, align 4, !tbaa !23
%idxprom2.epil = sext i32 %2 to i64
%arrayidx3.epil = getelementptr inbounds [10001 x i32], ptr %pos, i64 0, i64 %idxprom2.epil
%3 = trunc i64 %indvars.iv.epil to i32
store i32 %3, ptr %arrayidx3.epil, align 4, !tbaa !23
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup, label %for.body.epil, !llvm.loop !25
for.cond.cleanup: ; preds = %for.body.epil, %for.cond.cleanup.unr-lcssa
call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %flag) #8
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4004) %flag, i8 0, i64 4004, i1 false)
br i1 %cmp87, label %for.body9, label %for.cond.cleanup8
for.body: ; preds = %for.body, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%4 = load i32, ptr %arrayidx, align 16, !tbaa !23
%idxprom2 = sext i32 %4 to i64
%arrayidx3 = getelementptr inbounds [10001 x i32], ptr %pos, i64 0, i64 %idxprom2
%5 = trunc i64 %indvars.iv to i32
store i32 %5, ptr %arrayidx3, align 4, !tbaa !23
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next
%6 = load i32, ptr %arrayidx.1, align 4, !tbaa !23
%idxprom2.1 = sext i32 %6 to i64
%arrayidx3.1 = getelementptr inbounds [10001 x i32], ptr %pos, i64 0, i64 %idxprom2.1
%7 = trunc i64 %indvars.iv.next to i32
store i32 %7, ptr %arrayidx3.1, align 4, !tbaa !23
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next.1
%8 = load i32, ptr %arrayidx.2, align 8, !tbaa !23
%idxprom2.2 = sext i32 %8 to i64
%arrayidx3.2 = getelementptr inbounds [10001 x i32], ptr %pos, i64 0, i64 %idxprom2.2
%9 = trunc i64 %indvars.iv.next.1 to i32
store i32 %9, ptr %arrayidx3.2, align 4, !tbaa !23
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next.2
%10 = load i32, ptr %arrayidx.3, align 4, !tbaa !23
%idxprom2.3 = sext i32 %10 to i64
%arrayidx3.3 = getelementptr inbounds [10001 x i32], ptr %pos, i64 0, i64 %idxprom2.3
%11 = trunc i64 %indvars.iv.next.2 to i32
store i32 %11, ptr %arrayidx3.3, align 4, !tbaa !23
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond.cleanup.unr-lcssa, label %for.body, !llvm.loop !27
for.cond.cleanup8: ; preds = %for.inc50, %for.cond.cleanup.thread, %for.cond.cleanup
%cnt.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ 0, %for.cond.cleanup.thread ], [ %cnt.1, %for.inc50 ]
call void @llvm.lifetime.end.p0(i64 4004, ptr nonnull %flag) #8
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %pos) #8
ret i32 %cnt.0.lcssa
for.body9: ; preds = %for.cond.cleanup, %for.inc50
%indvars.iv104 = phi i64 [ %indvars.iv.next105, %for.inc50 ], [ 0, %for.cond.cleanup ]
%cnt.0100 = phi i32 [ %cnt.1, %for.inc50 ], [ 0, %for.cond.cleanup ]
%arrayidx11 = getelementptr inbounds [1001 x i32], ptr %flag, i64 0, i64 %indvars.iv104
%12 = load i32, ptr %arrayidx11, align 4, !tbaa !23
%tobool.not = icmp eq i32 %12, 0
br i1 %tobool.not, label %while.body, label %for.inc50
while.body: ; preds = %for.body9, %while.body
%arrayidx1396 = phi ptr [ %arrayidx13, %while.body ], [ %arrayidx11, %for.body9 ]
%idxprom1295 = phi i64 [ %idxprom12, %while.body ], [ %indvars.iv104, %for.body9 ]
%mina.094 = phi i32 [ %.mina.0, %while.body ], [ 536870912, %for.body9 ]
%num.093 = phi i32 [ %inc17, %while.body ], [ 0, %for.body9 ]
%sum.092 = phi i32 [ %add, %while.body ], [ 0, %for.body9 ]
store i32 1, ptr %arrayidx1396, align 4, !tbaa !23
%inc17 = add nuw nsw i32 %num.093, 1
%arrayidx19 = getelementptr inbounds i32, ptr %a, i64 %idxprom1295
%13 = load i32, ptr %arrayidx19, align 4, !tbaa !23
%add = add nsw i32 %13, %sum.092
%.mina.0 = call i32 @llvm.smin.i32(i32 %mina.094, i32 %13)
%idxprom28 = sext i32 %13 to i64
%arrayidx29 = getelementptr inbounds [10001 x i32], ptr %pos, i64 0, i64 %idxprom28
%14 = load i32, ptr %arrayidx29, align 4, !tbaa !23
%idxprom12 = sext i32 %14 to i64
%arrayidx13 = getelementptr inbounds [1001 x i32], ptr %flag, i64 0, i64 %idxprom12
%15 = load i32, ptr %arrayidx13, align 4, !tbaa !23
%tobool14.not = icmp eq i32 %15, 0
br i1 %tobool14.not, label %while.body, label %while.end, !llvm.loop !28
while.end: ; preds = %while.body
%sub = add nsw i32 %num.093, -1
%mul30 = mul nsw i32 %sub, %.mina.0
%add31 = add nsw i32 %mul30, %add
%add32 = add nsw i32 %.mina.0, %add
%add33 = add nuw nsw i32 %num.093, 2
%mul34 = mul nsw i32 %add33, %minw
%add35 = add nsw i32 %add32, %mul34
%add35.add31 = call i32 @llvm.smin.i32(i32 %add31, i32 %add35)
%add49 = add nsw i32 %add35.add31, %cnt.0100
br label %for.inc50
for.inc50: ; preds = %for.body9, %while.end
%cnt.1 = phi i32 [ %cnt.0100, %for.body9 ], [ %add49, %while.end ]
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%exitcond108.not = icmp eq i64 %indvars.iv.next105, %0
br i1 %exitcond108.not, label %for.cond.cleanup8, label %for.body9, !llvm.loop !29
}
; 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%buf.i = alloca [11 x i8], align 1
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !14
%cmp.not.i.i = icmp ult ptr %1, %2
br i1 %cmp.not.i.i, label %cond.false.i.i, label %cond.true.i.i, !prof !15
cond.true.i.i: ; preds = %entry
%call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #8
br label %getchar_unlocked.exit.i
cond.false.i.i: ; preds = %entry
%incdec.ptr.i.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%conv3.i.i = zext i8 %3 to i32
br label %getchar_unlocked.exit.i
getchar_unlocked.exit.i: ; preds = %cond.false.i.i, %cond.true.i.i
%cond.i.i = phi i32 [ %call.i.i, %cond.true.i.i ], [ %conv3.i.i, %cond.false.i.i ]
%4 = add i32 %cond.i.i, -58
%or.cond.i = icmp ult i32 %4, -10
br i1 %or.cond.i, label %get_uint.exit, label %while.body.preheader.i
while.body.preheader.i: ; preds = %getchar_unlocked.exit.i
%.pre24.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %while.body.i
while.body.i: ; preds = %getchar_unlocked.exit21.i, %while.body.preheader.i
%5 = phi ptr [ %9, %getchar_unlocked.exit21.i ], [ %.pre24.i, %while.body.preheader.i ]
%c.023.i = phi i32 [ %cond.i17.i, %getchar_unlocked.exit21.i ], [ %cond.i.i, %while.body.preheader.i ]
%n.022.i = phi i32 [ %add.i, %getchar_unlocked.exit21.i ], [ 0, %while.body.preheader.i ]
%mul.i = mul nsw i32 %n.022.i, 10
%and.i = and i32 %c.023.i, 15
%add.i = add nsw i32 %mul.i, %and.i
%_IO_read_ptr.i12.i = getelementptr inbounds %struct._IO_FILE, ptr %5, i64 0, i32 1
%6 = load ptr, ptr %_IO_read_ptr.i12.i, align 8, !tbaa !9
%_IO_read_end.i13.i = getelementptr inbounds %struct._IO_FILE, ptr %5, i64 0, i32 2
%7 = load ptr, ptr %_IO_read_end.i13.i, align 8, !tbaa !14
%cmp.not.i14.i = icmp ult ptr %6, %7
br i1 %cmp.not.i14.i, label %cond.false.i18.i, label %cond.true.i15.i, !prof !15
cond.true.i15.i: ; preds = %while.body.i
%call.i16.i = tail call i32 @__uflow(ptr noundef nonnull %5) #8
%.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit21.i
cond.false.i18.i: ; preds = %while.body.i
%incdec.ptr.i19.i = getelementptr inbounds i8, ptr %6, i64 1
store ptr %incdec.ptr.i19.i, ptr %_IO_read_ptr.i12.i, align 8, !tbaa !9
%8 = load i8, ptr %6, align 1, !tbaa !16
%conv3.i20.i = zext i8 %8 to i32
br label %getchar_unlocked.exit21.i
getchar_unlocked.exit21.i: ; preds = %cond.false.i18.i, %cond.true.i15.i
%9 = phi ptr [ %.pre.i, %cond.true.i15.i ], [ %5, %cond.false.i18.i ]
%cond.i17.i = phi i32 [ %call.i16.i, %cond.true.i15.i ], [ %conv3.i20.i, %cond.false.i18.i ]
%10 = add i32 %cond.i17.i, -48
%11 = icmp ult i32 %10, 10
br i1 %11, label %while.body.i, label %get_uint.exit, !llvm.loop !17
get_uint.exit: ; preds = %getchar_unlocked.exit21.i, %getchar_unlocked.exit.i
%retval.0.i = phi i32 [ %cond.i.i, %getchar_unlocked.exit.i ], [ %add.i, %getchar_unlocked.exit21.i ]
%12 = zext i32 %retval.0.i to i64
%vla = alloca i32, i64 %12, align 16
%cmp55 = icmp sgt i32 %retval.0.i, 0
br i1 %cmp55, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %get_uint.exit
%.pre59 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %for.body
for.cond.cleanup: ; preds = %get_uint.exit54, %get_uint.exit
%minw.0.lcssa = phi i32 [ 536870912, %get_uint.exit ], [ %call1.minw.0, %get_uint.exit54 ]
%call7 = call i32 @mincost_sort(ptr noundef nonnull %vla, i32 noundef %retval.0.i, i32 noundef %minw.0.lcssa)
%tobool.not.i = icmp eq i32 %call7, 0
br i1 %tobool.not.i, label %if.then.i, label %if.end.i
if.then.i: ; preds = %for.cond.cleanup
%13 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 5
%14 = load ptr, ptr %_IO_write_ptr.i.i, align 8, !tbaa !19
%_IO_write_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %13, i64 0, i32 6
%15 = load ptr, ptr %_IO_write_end.i.i, align 8, !tbaa !20
%cmp.not.i.i18 = icmp ult ptr %14, %15
br i1 %cmp.not.i.i18, label %cond.false.i.i21, label %cond.true.i.i19, !prof !15
cond.true.i.i19: ; preds = %if.then.i
%call.i.i20 = tail call i32 @__overflow(ptr noundef nonnull %13, i32 noundef 48) #8
br label %put_uint.exit
cond.false.i.i21: ; preds = %if.then.i
%incdec.ptr.i.i22 = getelementptr inbounds i8, ptr %14, i64 1
store ptr %incdec.ptr.i.i22, ptr %_IO_write_ptr.i.i, align 8, !tbaa !19
store i8 48, ptr %14, align 1, !tbaa !16
br label %put_uint.exit
if.end.i: ; preds = %for.cond.cleanup
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %buf.i) #8
br label %while.body.i17
while.body.i17: ; preds = %while.body.i17, %if.end.i
%indvars.iv28.i = phi i32 [ 1, %if.end.i ], [ %indvars.iv.next29.i, %while.body.i17 ]
%indvars.iv.i = phi i64 [ 0, %if.end.i ], [ %indvars.iv.next.i, %while.body.i17 ]
%n.addr.024.i = phi i32 [ %call7, %if.end.i ], [ %div.i, %while.body.i17 ]
%rem.i = srem i32 %n.addr.024.i, 10
%16 = trunc i32 %rem.i to i8
%conv.i = add nsw i8 %16, 48
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
%arrayidx.i = getelementptr inbounds [11 x i8], ptr %buf.i, i64 0, i64 %indvars.iv.i
store i8 %conv.i, ptr %arrayidx.i, align 1, !tbaa !16
%div.i = sdiv i32 %n.addr.024.i, 10
%n.addr.024.off.i = add i32 %n.addr.024.i, 9
%tobool1.not.i = icmp ult i32 %n.addr.024.off.i, 19
%indvars.iv.next29.i = add nuw i32 %indvars.iv28.i, 1
br i1 %tobool1.not.i, label %while.body4.preheader.i, label %while.body.i17, !llvm.loop !21
while.body4.preheader.i: ; preds = %while.body.i17
%17 = sext i32 %indvars.iv28.i to i64
br label %while.body4.i
while.body4.i: ; preds = %putchar_unlocked.exit23.i, %while.body4.preheader.i
%indvars.iv30.i = phi i64 [ %17, %while.body4.preheader.i ], [ %indvars.iv.next31.i, %putchar_unlocked.exit23.i ]
%indvars.iv.next31.i = add nsw i64 %indvars.iv30.i, -1
%arrayidx6.i = getelementptr inbounds [11 x i8], ptr %buf.i, i64 0, i64 %indvars.iv.next31.i
%18 = load i8, ptr %arrayidx6.i, align 1, !tbaa !16
%19 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i15.i = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 5
%20 = load ptr, ptr %_IO_write_ptr.i15.i, align 8, !tbaa !19
%_IO_write_end.i16.i = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 6
%21 = load ptr, ptr %_IO_write_end.i16.i, align 8, !tbaa !20
%cmp.not.i17.i = icmp ult ptr %20, %21
br i1 %cmp.not.i17.i, label %cond.false.i21.i, label %cond.true.i18.i, !prof !15
cond.true.i18.i: ; preds = %while.body4.i
%conv7.i = zext i8 %18 to i32
%call.i19.i = tail call i32 @__overflow(ptr noundef nonnull %19, i32 noundef %conv7.i) #8
br label %putchar_unlocked.exit23.i
cond.false.i21.i: ; preds = %while.body4.i
%incdec.ptr.i22.i = getelementptr inbounds i8, ptr %20, i64 1
store ptr %incdec.ptr.i22.i, ptr %_IO_write_ptr.i15.i, align 8, !tbaa !19
store i8 %18, ptr %20, align 1, !tbaa !16
br label %putchar_unlocked.exit23.i
putchar_unlocked.exit23.i: ; preds = %cond.false.i21.i, %cond.true.i18.i
%22 = and i64 %indvars.iv.next31.i, 4294967295
%tobool3.not.i = icmp eq i64 %22, 0
br i1 %tobool3.not.i, label %while.end9.i, label %while.body4.i, !llvm.loop !22
while.end9.i: ; preds = %putchar_unlocked.exit23.i
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %buf.i) #8
br label %put_uint.exit
put_uint.exit: ; preds = %cond.true.i.i19, %cond.false.i.i21, %while.end9.i
%23 = load ptr, ptr @stdout, align 8, !tbaa !5
%_IO_write_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %23, i64 0, i32 5
%24 = load ptr, ptr %_IO_write_ptr.i, align 8, !tbaa !19
%_IO_write_end.i = getelementptr inbounds %struct._IO_FILE, ptr %23, i64 0, i32 6
%25 = load ptr, ptr %_IO_write_end.i, align 8, !tbaa !20
%cmp.not.i = icmp ult ptr %24, %25
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %put_uint.exit
%call.i = tail call i32 @__overflow(ptr noundef nonnull %23, i32 noundef 10) #8
br label %putchar_unlocked.exit
cond.false.i: ; preds = %put_uint.exit
%incdec.ptr.i = getelementptr inbounds i8, ptr %24, i64 1
store ptr %incdec.ptr.i, ptr %_IO_write_ptr.i, align 8, !tbaa !19
store i8 10, ptr %24, align 1, !tbaa !16
br label %putchar_unlocked.exit
putchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
ret i32 0
for.body: ; preds = %for.body.preheader, %get_uint.exit54
%.pre24.i3262 = phi ptr [ %.pre59, %for.body.preheader ], [ %.pre24.i3263, %get_uint.exit54 ]
%26 = phi ptr [ %.pre59, %for.body.preheader ], [ %39, %get_uint.exit54 ]
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %get_uint.exit54 ]
%minw.056 = phi i32 [ 536870912, %for.body.preheader ], [ %call1.minw.0, %get_uint.exit54 ]
%_IO_read_ptr.i.i23 = getelementptr inbounds %struct._IO_FILE, ptr %26, i64 0, i32 1
%27 = load ptr, ptr %_IO_read_ptr.i.i23, align 8, !tbaa !9
%_IO_read_end.i.i24 = getelementptr inbounds %struct._IO_FILE, ptr %26, i64 0, i32 2
%28 = load ptr, ptr %_IO_read_end.i.i24, align 8, !tbaa !14
%cmp.not.i.i25 = icmp ult ptr %27, %28
br i1 %cmp.not.i.i25, label %cond.false.i.i51, label %cond.true.i.i26, !prof !15
cond.true.i.i26: ; preds = %for.body
%call.i.i27 = tail call i32 @__uflow(ptr noundef nonnull %26) #8
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit.i28
cond.false.i.i51: ; preds = %for.body
%incdec.ptr.i.i52 = getelementptr inbounds i8, ptr %27, i64 1
store ptr %incdec.ptr.i.i52, ptr %_IO_read_ptr.i.i23, align 8, !tbaa !9
%29 = load i8, ptr %27, align 1, !tbaa !16
%conv3.i.i53 = zext i8 %29 to i32
br label %getchar_unlocked.exit.i28
getchar_unlocked.exit.i28: ; preds = %cond.false.i.i51, %cond.true.i.i26
%.pre24.i32 = phi ptr [ %.pre, %cond.true.i.i26 ], [ %.pre24.i3262, %cond.false.i.i51 ]
%30 = phi ptr [ %.pre, %cond.true.i.i26 ], [ %26, %cond.false.i.i51 ]
%cond.i.i29 = phi i32 [ %call.i.i27, %cond.true.i.i26 ], [ %conv3.i.i53, %cond.false.i.i51 ]
%31 = add i32 %cond.i.i29, -58
%or.cond.i30 = icmp ult i32 %31, -10
br i1 %or.cond.i30, label %get_uint.exit54, label %while.body.i33
while.body.i33: ; preds = %getchar_unlocked.exit.i28, %getchar_unlocked.exit21.i45
%.pre24.i3261 = phi ptr [ %.pre24.i3260, %getchar_unlocked.exit21.i45 ], [ %.pre24.i32, %getchar_unlocked.exit.i28 ]
%32 = phi ptr [ %36, %getchar_unlocked.exit21.i45 ], [ %.pre24.i32, %getchar_unlocked.exit.i28 ]
%c.023.i34 = phi i32 [ %cond.i17.i46, %getchar_unlocked.exit21.i45 ], [ %cond.i.i29, %getchar_unlocked.exit.i28 ]
%n.022.i35 = phi i32 [ %add.i38, %getchar_unlocked.exit21.i45 ], [ 0, %getchar_unlocked.exit.i28 ]
%mul.i36 = mul nsw i32 %n.022.i35, 10
%and.i37 = and i32 %c.023.i34, 15
%add.i38 = add nsw i32 %mul.i36, %and.i37
%_IO_read_ptr.i12.i39 = getelementptr inbounds %struct._IO_FILE, ptr %32, i64 0, i32 1
%33 = load ptr, ptr %_IO_read_ptr.i12.i39, align 8, !tbaa !9
%_IO_read_end.i13.i40 = getelementptr inbounds %struct._IO_FILE, ptr %32, i64 0, i32 2
%34 = load ptr, ptr %_IO_read_end.i13.i40, align 8, !tbaa !14
%cmp.not.i14.i41 = icmp ult ptr %33, %34
br i1 %cmp.not.i14.i41, label %cond.false.i18.i48, label %cond.true.i15.i42, !prof !15
cond.true.i15.i42: ; preds = %while.body.i33
%call.i16.i43 = tail call i32 @__uflow(ptr noundef nonnull %32) #8
%.pre.i44 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit21.i45
cond.false.i18.i48: ; preds = %while.body.i33
%incdec.ptr.i19.i49 = getelementptr inbounds i8, ptr %33, i64 1
store ptr %incdec.ptr.i19.i49, ptr %_IO_read_ptr.i12.i39, align 8, !tbaa !9
%35 = load i8, ptr %33, align 1, !tbaa !16
%conv3.i20.i50 = zext i8 %35 to i32
br label %getchar_unlocked.exit21.i45
getchar_unlocked.exit21.i45: ; preds = %cond.false.i18.i48, %cond.true.i15.i42
%.pre24.i3260 = phi ptr [ %.pre.i44, %cond.true.i15.i42 ], [ %.pre24.i3261, %cond.false.i18.i48 ]
%36 = phi ptr [ %.pre.i44, %cond.true.i15.i42 ], [ %32, %cond.false.i18.i48 ]
%cond.i17.i46 = phi i32 [ %call.i16.i43, %cond.true.i15.i42 ], [ %conv3.i20.i50, %cond.false.i18.i48 ]
%37 = add i32 %cond.i17.i46, -48
%38 = icmp ult i32 %37, 10
br i1 %38, label %while.body.i33, label %get_uint.exit54, !llvm.loop !17
get_uint.exit54: ; preds = %getchar_unlocked.exit21.i45, %getchar_unlocked.exit.i28
%.pre24.i3263 = phi ptr [ %.pre24.i32, %getchar_unlocked.exit.i28 ], [ %.pre24.i3260, %getchar_unlocked.exit21.i45 ]
%39 = phi ptr [ %30, %getchar_unlocked.exit.i28 ], [ %36, %getchar_unlocked.exit21.i45 ]
%retval.0.i47 = phi i32 [ %cond.i.i29, %getchar_unlocked.exit.i28 ], [ %add.i38, %getchar_unlocked.exit21.i45 ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
store i32 %retval.0.i47, ptr %arrayidx, align 4, !tbaa !23
%call1.minw.0 = tail call i32 @llvm.smin.i32(i32 %minw.056, i32 %retval.0.i47)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %12
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !30
}
declare i32 @__uflow(ptr noundef) local_unnamed_addr #6
declare i32 @__overflow(ptr noundef, i32 noundef) local_unnamed_addr #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 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 #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { "no-trapping-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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_IO_FILE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !11, i64 116, !12, i64 120, !13, i64 128, !7, i64 130, !7, i64 131, !6, i64 136, !12, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !12, i64 184, !11, i64 192, !7, i64 196}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!10, !6, i64 16}
!15 = !{!"branch_weights", i32 2000, i32 1}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!10, !6, i64 40}
!20 = !{!10, !6, i64 48}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}
!23 = !{!11, !11, i64 0}
!24 = distinct !{!24, !18}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.unroll.disable"}
!27 = distinct !{!27, !18}
!28 = distinct !{!28, !18}
!29 = distinct !{!29, !18}
!30 = distinct !{!30, !18}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define min(p,q)((p)<(q)?(p):(q))
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
//座圧(破壊的)
int cocomp(ll*a,int n){
//0~cnt-1に圧縮
ll*b=(ll*)malloc(sizeof(ll)*n);
memcpy(b,a,sizeof(ll)*n);
sortup(b,n);
int cnt=1;
rep(r,1,n)if(b[r]!=b[cnt-1])b[cnt++]=b[r];
rep(i,0,n){
int l=0,r=cnt;
while(r-l>1){int m=(l+r)/2;if(b[m]>a[i])r=m;else l=m;}
a[i]=l;
}
free(b);
return cnt;
}
ll a[1010],b[1010];
ll sum[1010],mm[1010],len[1010],cnt;
int main(){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",a+i);
b[i]=a[i];
}
cocomp(b,n);
for(int i=0;i<n;i++)if(b[i]!=-1){
int tsum=0;
int tlen=0;
int tmm=1e9;
int crr=i;
do{
tsum+=a[crr];
tmm=min(tmm,a[crr]);
tlen++;
int temp=b[crr];
b[crr]=-1;
crr=temp;
}while(crr!=i);
sum[cnt]=tsum;
mm[cnt]=tmm;
len[cnt]=tlen;
cnt++;
}
int ans=1e9;
rep(i,0,cnt){
//mm[i]を使う
int tans=0;
rep(j,0,cnt)tans+=min((sum[j]-mm[j])+(len[j]-1)*mm[j],(sum[j]-mm[j])+(len[j]-1)*mm[i]+(mm[i]+mm[j])*2);
ans=min(ans,tans);
}
printf("%d\n",ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324144/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324144/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@a = dso_local global [1010 x i64] zeroinitializer, align 16
@b = dso_local global [1010 x i64] zeroinitializer, align 16
@sum = dso_local local_unnamed_addr global [1010 x i64] zeroinitializer, align 16
@cnt = dso_local local_unnamed_addr global i64 0, align 8
@mm = dso_local local_unnamed_addr global [1010 x i64] zeroinitializer, align 16
@len = dso_local local_unnamed_addr global [1010 x i64] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @upll(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt i64 %0, %1
%cond = zext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 -1, i32 %cond
ret i32 %cond2
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @sortup(ptr noundef %a, i32 noundef %n) local_unnamed_addr #1 {
entry:
%conv = sext i32 %n to i64
tail call void @qsort(ptr noundef %a, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @upll) #11
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nounwind uwtable
define dso_local i32 @cocomp(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #3 {
entry:
%conv = sext i32 %n to i64
%mul = shl nsw i64 %conv, 3
%call = tail call noalias ptr @malloc(i64 noundef %mul) #12
tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %call, ptr align 8 %a, i64 %mul, i1 false)
tail call void @qsort(ptr noundef %call, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @upll) #11
%cmp61 = icmp sgt i32 %n, 1
br i1 %cmp61, label %for.body.preheader, label %for.cond12.preheader.thread
for.body.preheader: ; preds = %entry
%0 = add nsw i64 %conv, -1
%xtraiter = and i64 %0, 1
%1 = icmp eq i32 %n, 2
br i1 %1, label %for.cond12.preheader.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %0, -2
%invariant.gep = getelementptr i64, ptr %call, i64 1
br label %for.body
for.cond12.preheader.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%cnt.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %cnt.1.1, %for.inc.1 ]
%cnt.063.unr = phi i32 [ 1, %for.body.preheader ], [ %cnt.1.1, %for.inc.1 ]
%r.062.unr = phi i64 [ 1, %for.body.preheader ], [ %inc11.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond12.preheader, label %for.body.epil
for.body.epil: ; preds = %for.cond12.preheader.unr-lcssa
%arrayidx.epil = getelementptr inbounds i64, ptr %call, i64 %r.062.unr
%2 = load i64, ptr %arrayidx.epil, align 8, !tbaa !5
%sub.epil = add nsw i32 %cnt.063.unr, -1
%idxprom.epil = sext i32 %sub.epil to i64
%arrayidx5.epil = getelementptr inbounds i64, ptr %call, i64 %idxprom.epil
%3 = load i64, ptr %arrayidx5.epil, align 8, !tbaa !5
%cmp6.not.epil = icmp eq i64 %2, %3
br i1 %cmp6.not.epil, label %for.cond12.preheader, label %if.then.epil
if.then.epil: ; preds = %for.body.epil
%inc.epil = add nsw i32 %cnt.063.unr, 1
%idxprom9.epil = sext i32 %cnt.063.unr to i64
%arrayidx10.epil = getelementptr inbounds i64, ptr %call, i64 %idxprom9.epil
store i64 %2, ptr %arrayidx10.epil, align 8, !tbaa !5
br label %for.cond12.preheader
for.cond12.preheader: ; preds = %for.body.epil, %if.then.epil, %for.cond12.preheader.unr-lcssa
%cnt.1.lcssa = phi i32 [ %cnt.1.lcssa.ph, %for.cond12.preheader.unr-lcssa ], [ %inc.epil, %if.then.epil ], [ %cnt.063.unr, %for.body.epil ]
%cmp1468 = icmp sgt i32 %n, 0
br i1 %cmp1468, label %while.cond.preheader.lr.ph, label %for.cond.cleanup16
for.cond12.preheader.thread: ; preds = %entry
%cmp146873 = icmp eq i32 %n, 1
br i1 %cmp146873, label %while.cond.preheader.preheader, label %for.cond.cleanup16
while.cond.preheader.lr.ph: ; preds = %for.cond12.preheader
%cmp2064 = icmp sgt i32 %cnt.1.lcssa, 1
br i1 %cmp2064, label %while.cond.preheader.us, label %while.cond.preheader.preheader
while.cond.preheader.preheader: ; preds = %for.cond12.preheader.thread, %while.cond.preheader.lr.ph
%cnt.0.lcssa7578 = phi i32 [ %cnt.1.lcssa, %while.cond.preheader.lr.ph ], [ 1, %for.cond12.preheader.thread ]
tail call void @llvm.memset.p0.i64(ptr align 8 %a, i8 0, i64 %mul, i1 false), !tbaa !5
br label %for.cond.cleanup16
while.cond.preheader.us: ; preds = %while.cond.preheader.lr.ph, %while.cond.while.end_crit_edge.us
%i.069.us = phi i64 [ %inc32.us, %while.cond.while.end_crit_edge.us ], [ 0, %while.cond.preheader.lr.ph ]
%arrayidx24.us = getelementptr inbounds i64, ptr %a, i64 %i.069.us
%4 = load i64, ptr %arrayidx24.us, align 8, !tbaa !5
br label %while.body.us
while.body.us: ; preds = %while.cond.preheader.us, %while.body.us
%r18.066.us = phi i32 [ %cnt.1.lcssa, %while.cond.preheader.us ], [ %div.r18.0.us, %while.body.us ]
%l.065.us = phi i32 [ 0, %while.cond.preheader.us ], [ %l.0.div.us, %while.body.us ]
%add.us = add nsw i32 %r18.066.us, %l.065.us
%div.us = sdiv i32 %add.us, 2
%idxprom22.us = sext i32 %div.us to i64
%arrayidx23.us = getelementptr inbounds i64, ptr %call, i64 %idxprom22.us
%5 = load i64, ptr %arrayidx23.us, align 8, !tbaa !5
%cmp25.us = icmp sgt i64 %5, %4
%l.0.div.us = select i1 %cmp25.us, i32 %l.065.us, i32 %div.us
%div.r18.0.us = select i1 %cmp25.us, i32 %div.us, i32 %r18.066.us
%sub19.us = sub nsw i32 %div.r18.0.us, %l.0.div.us
%cmp20.us = icmp sgt i32 %sub19.us, 1
br i1 %cmp20.us, label %while.body.us, label %while.cond.while.end_crit_edge.us, !llvm.loop !9
while.cond.while.end_crit_edge.us: ; preds = %while.body.us
%conv29.us = sext i32 %l.0.div.us to i64
store i64 %conv29.us, ptr %arrayidx24.us, align 8, !tbaa !5
%inc32.us = add nuw nsw i64 %i.069.us, 1
%exitcond71.not = icmp eq i64 %inc32.us, %conv
br i1 %exitcond71.not, label %for.cond.cleanup16, label %while.cond.preheader.us, !llvm.loop !11
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%cnt.063 = phi i32 [ 1, %for.body.preheader.new ], [ %cnt.1.1, %for.inc.1 ]
%r.062 = phi i64 [ 1, %for.body.preheader.new ], [ %inc11.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds i64, ptr %call, i64 %r.062
%6 = load i64, ptr %arrayidx, align 8, !tbaa !5
%sub = add nsw i32 %cnt.063, -1
%idxprom = sext i32 %sub to i64
%arrayidx5 = getelementptr inbounds i64, ptr %call, i64 %idxprom
%7 = load i64, ptr %arrayidx5, align 8, !tbaa !5
%cmp6.not = icmp eq i64 %6, %7
br i1 %cmp6.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%inc = add nsw i32 %cnt.063, 1
%idxprom9 = sext i32 %cnt.063 to i64
%arrayidx10 = getelementptr inbounds i64, ptr %call, i64 %idxprom9
store i64 %6, ptr %arrayidx10, align 8, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%cnt.1 = phi i32 [ %inc, %if.then ], [ %cnt.063, %for.body ]
%gep = getelementptr i64, ptr %invariant.gep, i64 %r.062
%8 = load i64, ptr %gep, align 8, !tbaa !5
%sub.1 = add nsw i32 %cnt.1, -1
%idxprom.1 = sext i32 %sub.1 to i64
%arrayidx5.1 = getelementptr inbounds i64, ptr %call, i64 %idxprom.1
%9 = load i64, ptr %arrayidx5.1, align 8, !tbaa !5
%cmp6.not.1 = icmp eq i64 %8, %9
br i1 %cmp6.not.1, label %for.inc.1, label %if.then.1
if.then.1: ; preds = %for.inc
%inc.1 = add nsw i32 %cnt.1, 1
%idxprom9.1 = sext i32 %cnt.1 to i64
%arrayidx10.1 = getelementptr inbounds i64, ptr %call, i64 %idxprom9.1
store i64 %8, ptr %arrayidx10.1, align 8, !tbaa !5
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %for.inc
%cnt.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ %cnt.1, %for.inc ]
%inc11.1 = add nuw nsw i64 %r.062, 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.cond12.preheader.unr-lcssa, label %for.body, !llvm.loop !12
for.cond.cleanup16: ; preds = %while.cond.while.end_crit_edge.us, %for.cond12.preheader.thread, %while.cond.preheader.preheader, %for.cond12.preheader
%cnt.0.lcssa74 = phi i32 [ 1, %for.cond12.preheader.thread ], [ %cnt.0.lcssa7578, %while.cond.preheader.preheader ], [ %cnt.1.lcssa, %for.cond12.preheader ], [ %cnt.1.lcssa, %while.cond.while.end_crit_edge.us ]
tail call void @free(ptr noundef %call) #11
ret i32 %cnt.0.lcssa74
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5
; 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) #6
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: 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) #11
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !13
%cmp163 = icmp sgt i32 %0, 0
br i1 %cmp163, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %3, %for.body ]
%call4 = call i32 @cocomp(ptr noundef nonnull @b, i32 noundef %.lcssa)
%1 = load i32, ptr %n, align 4, !tbaa !13
%cnt.promoted = load i64, ptr @cnt, align 8, !tbaa !5
%cmp7167 = icmp sgt i32 %1, 0
br i1 %cmp7167, label %for.body9.preheader, label %for.cond44.preheader
for.body9.preheader: ; preds = %for.cond.cleanup
%wide.trip.count = zext i32 %1 to i64
br label %for.body9
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i64, ptr @a, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%2 = load i64, ptr %add.ptr, align 8, !tbaa !5
%arrayidx3 = getelementptr inbounds [1010 x i64], ptr @b, i64 0, i64 %indvars.iv
store i64 %2, ptr %arrayidx3, align 8, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !13
%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 !15
for.cond44.preheader: ; preds = %for.inc40, %for.cond.cleanup
%5 = phi i64 [ %cnt.promoted, %for.cond.cleanup ], [ %inc39165, %for.inc40 ]
%cmp45174 = icmp sgt i64 %5, 0
br i1 %cmp45174, label %for.cond49.preheader.us.preheader, label %for.cond.cleanup47
for.cond49.preheader.us.preheader: ; preds = %for.cond44.preheader
%min.iters.check = icmp ult i64 %5, 4
%n.vec = and i64 %5, -4
%cmp.n = icmp eq i64 %5, %n.vec
br label %for.cond49.preheader.us
for.cond49.preheader.us: ; preds = %for.cond49.preheader.us.preheader, %for.cond49.for.cond.cleanup52_crit_edge.us
%i43.0176.us = phi i64 [ %inc113.us, %for.cond49.for.cond.cleanup52_crit_edge.us ], [ 0, %for.cond49.preheader.us.preheader ]
%ans.0175.us = phi i32 [ %cond111.us, %for.cond49.for.cond.cleanup52_crit_edge.us ], [ 1000000000, %for.cond49.preheader.us.preheader ]
%arrayidx65.us = getelementptr inbounds [1010 x i64], ptr @mm, i64 0, i64 %i43.0176.us
%6 = load i64, ptr %arrayidx65.us, align 8, !tbaa !5
br i1 %min.iters.check, label %for.body53.us.preheader, label %vector.ph
vector.ph: ; preds = %for.cond49.preheader.us
%broadcast.splatinsert = insertelement <2 x i64> poison, i64 %6, i64 0
%broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i32> [ zeroinitializer, %vector.ph ], [ %35, %vector.body ]
%vec.phi188 = phi <2 x i32> [ zeroinitializer, %vector.ph ], [ %36, %vector.body ]
%7 = getelementptr inbounds [1010 x i64], ptr @sum, i64 0, i64 %index
%wide.load = load <2 x i64>, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds i64, ptr %7, i64 2
%wide.load189 = load <2 x i64>, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds [1010 x i64], ptr @mm, i64 0, i64 %index
%wide.load190 = load <2 x i64>, ptr %9, align 16, !tbaa !5
%10 = getelementptr inbounds i64, ptr %9, i64 2
%wide.load191 = load <2 x i64>, ptr %10, align 16, !tbaa !5
%11 = sub nsw <2 x i64> %wide.load, %wide.load190
%12 = sub nsw <2 x i64> %wide.load189, %wide.load191
%13 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %index
%wide.load192 = load <2 x i64>, ptr %13, align 16, !tbaa !5
%14 = getelementptr inbounds i64, ptr %13, i64 2
%wide.load193 = load <2 x i64>, ptr %14, align 16, !tbaa !5
%15 = add nsw <2 x i64> %wide.load192, <i64 -1, i64 -1>
%16 = add nsw <2 x i64> %wide.load193, <i64 -1, i64 -1>
%17 = mul nsw <2 x i64> %15, %wide.load190
%18 = mul nsw <2 x i64> %16, %wide.load191
%19 = add nsw <2 x i64> %17, %11
%20 = add nsw <2 x i64> %18, %12
%21 = mul nsw <2 x i64> %15, %broadcast.splat
%22 = mul nsw <2 x i64> %16, %broadcast.splat
%23 = add nsw <2 x i64> %21, %11
%24 = add nsw <2 x i64> %22, %12
%25 = add nsw <2 x i64> %broadcast.splat, %wide.load190
%26 = add nsw <2 x i64> %broadcast.splat, %wide.load191
%27 = shl nsw <2 x i64> %25, <i64 1, i64 1>
%28 = shl nsw <2 x i64> %26, <i64 1, i64 1>
%29 = add nsw <2 x i64> %23, %27
%30 = add nsw <2 x i64> %24, %28
%31 = call <2 x i64> @llvm.smin.v2i64(<2 x i64> %19, <2 x i64> %29)
%32 = call <2 x i64> @llvm.smin.v2i64(<2 x i64> %20, <2 x i64> %30)
%33 = trunc <2 x i64> %31 to <2 x i32>
%34 = trunc <2 x i64> %32 to <2 x i32>
%35 = add <2 x i32> %vec.phi, %33
%36 = add <2 x i32> %vec.phi188, %34
%index.next = add nuw i64 %index, 4
%37 = icmp eq i64 %index.next, %n.vec
br i1 %37, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i32> %36, %35
%38 = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond49.for.cond.cleanup52_crit_edge.us, label %for.body53.us.preheader
for.body53.us.preheader: ; preds = %for.cond49.preheader.us, %middle.block
%j.0172.us.ph = phi i64 [ 0, %for.cond49.preheader.us ], [ %n.vec, %middle.block ]
%tans.0171.us.ph = phi i32 [ 0, %for.cond49.preheader.us ], [ %38, %middle.block ]
br label %for.body53.us
for.body53.us: ; preds = %for.body53.us.preheader, %for.body53.us
%j.0172.us = phi i64 [ %inc104.us, %for.body53.us ], [ %j.0172.us.ph, %for.body53.us.preheader ]
%tans.0171.us = phi i32 [ %conv102.us, %for.body53.us ], [ %tans.0171.us.ph, %for.body53.us.preheader ]
%arrayidx54.us = getelementptr inbounds [1010 x i64], ptr @sum, i64 0, i64 %j.0172.us
%39 = load i64, ptr %arrayidx54.us, align 8, !tbaa !5
%arrayidx55.us = getelementptr inbounds [1010 x i64], ptr @mm, i64 0, i64 %j.0172.us
%40 = load i64, ptr %arrayidx55.us, align 8, !tbaa !5
%sub.us = sub nsw i64 %39, %40
%arrayidx56.us = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %j.0172.us
%41 = load i64, ptr %arrayidx56.us, align 8, !tbaa !5
%sub57.us = add nsw i64 %41, -1
%mul.us = mul nsw i64 %sub57.us, %40
%add59.us = add nsw i64 %mul.us, %sub.us
%mul66.us = mul nsw i64 %sub57.us, %6
%add67.us = add nsw i64 %mul66.us, %sub.us
%add70.us = add nsw i64 %6, %40
%mul71.us = shl nsw i64 %add70.us, 1
%add72.us = add nsw i64 %add67.us, %mul71.us
%add59.add72.us = call i64 @llvm.smin.i64(i64 %add59.us, i64 %add72.us)
%42 = trunc i64 %add59.add72.us to i32
%conv102.us = add i32 %tans.0171.us, %42
%inc104.us = add nuw nsw i64 %j.0172.us, 1
%exitcond183.not = icmp eq i64 %inc104.us, %5
br i1 %exitcond183.not, label %for.cond49.for.cond.cleanup52_crit_edge.us, label %for.body53.us, !llvm.loop !19
for.cond49.for.cond.cleanup52_crit_edge.us: ; preds = %for.body53.us, %middle.block
%conv102.us.lcssa = phi i32 [ %38, %middle.block ], [ %conv102.us, %for.body53.us ]
%cond111.us = call i32 @llvm.smin.i32(i32 %ans.0175.us, i32 %conv102.us.lcssa)
%inc113.us = add nuw nsw i64 %i43.0176.us, 1
%exitcond184.not = icmp eq i64 %inc113.us, %5
br i1 %exitcond184.not, label %for.cond.cleanup47, label %for.cond49.preheader.us, !llvm.loop !20
for.body9: ; preds = %for.body9.preheader, %for.inc40
%indvars.iv180 = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next181, %for.inc40 ]
%inc39166168 = phi i64 [ %cnt.promoted, %for.body9.preheader ], [ %inc39165, %for.inc40 ]
%arrayidx11 = getelementptr inbounds [1010 x i64], ptr @b, i64 0, i64 %indvars.iv180
%43 = load i64, ptr %arrayidx11, align 8, !tbaa !5
%cmp12.not = icmp eq i64 %43, -1
br i1 %cmp12.not, label %for.inc40, label %do.body
do.body: ; preds = %for.body9, %do.body
%tsum.0 = phi i64 [ %add, %do.body ], [ 0, %for.body9 ]
%tlen.0 = phi i32 [ %inc25, %do.body ], [ 0, %for.body9 ]
%tmm.0 = phi i64 [ %conv16., %do.body ], [ 1000000000, %for.body9 ]
%crr.0 = phi i64 [ %45, %do.body ], [ %indvars.iv180, %for.body9 ]
%sext185 = shl i64 %crr.0, 32
%idxprom13 = ashr exact i64 %sext185, 32
%arrayidx14 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %idxprom13
%44 = load i64, ptr %arrayidx14, align 8, !tbaa !5
%sext = shl i64 %tsum.0, 32
%conv = ashr exact i64 %sext, 32
%add = add nsw i64 %44, %conv
%sext160 = shl i64 %tmm.0, 32
%conv16 = ashr exact i64 %sext160, 32
%conv16. = call i64 @llvm.smin.i64(i64 %conv16, i64 %44)
%inc25 = add nuw nsw i32 %tlen.0, 1
%arrayidx27 = getelementptr inbounds [1010 x i64], ptr @b, i64 0, i64 %idxprom13
%45 = load i64, ptr %arrayidx27, align 8, !tbaa !5
store i64 -1, ptr %arrayidx27, align 8, !tbaa !5
%46 = and i64 %45, 4294967295
%cmp31.not = icmp eq i64 %indvars.iv180, %46
br i1 %cmp31.not, label %do.end, label %do.body, !llvm.loop !21
do.end: ; preds = %do.body
%sext161 = shl i64 %add, 32
%conv33 = ashr exact i64 %sext161, 32
%arrayidx34 = getelementptr inbounds [1010 x i64], ptr @sum, i64 0, i64 %inc39166168
store i64 %conv33, ptr %arrayidx34, align 8, !tbaa !5
%sext162 = shl i64 %conv16., 32
%conv35 = ashr exact i64 %sext162, 32
%arrayidx36 = getelementptr inbounds [1010 x i64], ptr @mm, i64 0, i64 %inc39166168
store i64 %conv35, ptr %arrayidx36, align 8, !tbaa !5
%conv37 = zext i32 %inc25 to i64
%arrayidx38 = getelementptr inbounds [1010 x i64], ptr @len, i64 0, i64 %inc39166168
store i64 %conv37, ptr %arrayidx38, align 8, !tbaa !5
%inc39 = add nsw i64 %inc39166168, 1
store i64 %inc39, ptr @cnt, align 8, !tbaa !5
br label %for.inc40
for.inc40: ; preds = %for.body9, %do.end
%inc39165 = phi i64 [ %inc39166168, %for.body9 ], [ %inc39, %do.end ]
%indvars.iv.next181 = add nuw nsw i64 %indvars.iv180, 1
%exitcond.not = icmp eq i64 %indvars.iv.next181, %wide.trip.count
br i1 %exitcond.not, label %for.cond44.preheader, label %for.body9, !llvm.loop !22
for.cond.cleanup47: ; preds = %for.cond49.for.cond.cleanup52_crit_edge.us, %for.cond44.preheader
%ans.0.lcssa = phi i32 [ 1000000000, %for.cond44.preheader ], [ %cond111.us, %for.cond49.for.cond.cleanup52_crit_edge.us ]
%call115 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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.smin.i32(i32, i32) #9
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #9
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.smin.v2i64(<2 x i64>, <2 x i64>) #9
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v2i32(<2 x i32>) #9
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 = { 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 #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #11 = { nounwind }
attributes #12 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !17, !18}
!17 = !{!"llvm.loop.isvectorized", i32 1}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = distinct !{!19, !10, !18, !17}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
|
//
// main.c
// Numeral System
//
// Created by x15071xx on 2016/06/09.
// Copyright ?? 2016??´ AIT. All rights reserved.
//
#include <stdio.h>
#include <string.h>
int main(int argc, const char * argv[]) {
int n,i,j,k;
scanf("%d",&n);
for (i=0; i<n; i++) {
char mcxi1[9]={0},mcxi2[9]={0},add[9]={0};
int sum=0,scalar=0,x = 0;
unsigned int count;
scanf("%s %s",mcxi1,mcxi2);
//?????????????????´??°????±???????
for (j=0; j<strlen(mcxi1); j++) {
if (mcxi1[j] >=97 && mcxi1[j] <= 122) {
if (mcxi1[j-1] >= 48 && mcxi1[j-1] <= 57) {
scalar = mcxi1[j-1] - 48;
} else {
scalar = 1;
}
if (mcxi1[j] == 'm') {
sum += scalar * 1000;
}
if (mcxi1[j] == 'c') {
sum += scalar * 100;
}
if (mcxi1[j] == 'x') {
sum += scalar * 10;
}
if (mcxi1[j] == 'i') {
sum += scalar * 1;
}
}
}
for (j=0; j<strlen(mcxi2); j++) {
if (mcxi2[j] >=97 && mcxi2[j] <= 122) {
if (mcxi2[j-1] >= 48 && mcxi2[j-1] <= 57) {
scalar = mcxi2[j-1] - 48;
} else {
scalar = 1;
}
if (mcxi2[j] == 'm') {
sum += scalar * 1000;
}
if (mcxi2[j] == 'c') {
sum += scalar * 100;
}
if (mcxi2[j] == 'x') {
sum += scalar * 10;
}
if (mcxi2[j] == 'i') {
sum += scalar * 1;
}
}
}
//??´??°????????????????????????
if (sum/1000 >= 1) {
x = sum / 1000;
sum -= x * 1000;
if (x == 1) {
add[0] = 'm';
} else if (x > 1) {
add[0] = x + 48;
add[1] = 'm';
}
}
if (sum/100 >= 1) {
x = sum / 100;
sum -= x * 100;
count = strlen(add);
if (x == 1) {
add[count] = 'c';
} else if (x > 1) {
add[count] = x + 48;
add[count+1] = 'c';
}
}
if (sum/10 >= 1) {
x = sum / 10;
sum -= x * 10;
count = strlen(add);
if (x == 1) {
add[count] = 'x';
} else if (x > 1) {
add[count] = x + 48;
add[count+1] = 'x';
}
}
if (sum >= 1) {
count = strlen(add);
if (sum == 1) {
add[count] = 'i';
} else if (sum > 1){
add[count] = sum + 48;
add[count+1] = 'i';
}
}
//??°???
printf("%s\n",add);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324195/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324195/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%mcxi1 = alloca [9 x i8], align 1
%mcxi2 = alloca [9 x i8], align 1
%add = alloca [9 x i8], align 1
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
%cmp341 = icmp sgt i32 %0, 0
br i1 %cmp341, label %for.body.lr.ph, label %for.end259
for.body.lr.ph: ; preds = %entry
%arrayidx168 = getelementptr inbounds [9 x i8], ptr %add, i64 0, i64 1
br label %for.body
for.body: ; preds = %for.body.lr.ph, %if.end254
%i.0342 = phi i32 [ 0, %for.body.lr.ph ], [ %inc258, %if.end254 ]
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %mcxi1) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(9) %mcxi1, i8 0, i64 9, i1 false)
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %mcxi2) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(9) %mcxi2, i8 0, i64 9, i1 false)
call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %add) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(9) %add, i8 0, i64 9, i1 false)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %mcxi1, ptr noundef nonnull %mcxi2)
%call5 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %mcxi1) #7
%cmp6332.not = icmp eq i64 %call5, 0
br i1 %cmp6332.not, label %for.cond71.preheader, label %for.body8
for.cond71.preheader: ; preds = %for.inc, %for.body
%sum.0.lcssa = phi i32 [ 0, %for.body ], [ %sum.4, %for.inc ]
%call74 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %mcxi2) #7
%cmp75336.not = icmp eq i64 %call74, 0
br i1 %cmp75336.not, label %for.end150, label %for.body77
for.body8: ; preds = %for.body, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %for.body ]
%sum.0334 = phi i32 [ %sum.4, %for.inc ], [ 0, %for.body ]
%arrayidx = getelementptr inbounds [9 x i8], ptr %mcxi1, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%2 = add i8 %1, -97
%or.cond = icmp ult i8 %2, 26
br i1 %or.cond, label %if.then, label %for.inc
if.then: ; preds = %for.body8
%3 = add nsw i64 %indvars.iv, -1
%arrayidx18 = getelementptr inbounds [9 x i8], ptr %mcxi1, i64 0, i64 %3
%4 = load i8, ptr %arrayidx18, align 1, !tbaa !9
%conv19 = sext i8 %4 to i32
%5 = add i8 %4, -48
%or.cond328 = icmp ult i8 %5, 10
%sub34 = add nsw i32 %conv19, -48
%scalar.0 = select i1 %or.cond328, i32 %sub34, i32 1
%cmp38 = icmp eq i8 %1, 109
%mul = mul nuw nsw i32 %scalar.0, 1000
%add41 = select i1 %cmp38, i32 %mul, i32 0
%cmp46 = icmp eq i8 %1, 99
%mul49 = mul nuw nsw i32 %scalar.0, 100
%add50 = select i1 %cmp46, i32 %mul49, i32 0
%cmp55 = icmp eq i8 %1, 120
%mul58 = mul nuw nsw i32 %scalar.0, 10
%add59 = select i1 %cmp55, i32 %mul58, i32 0
%cmp64 = icmp eq i8 %1, 105
%add68 = select i1 %cmp64, i32 %scalar.0, i32 0
%sum.1 = add i32 %add68, %sum.0334
%sum.2 = add i32 %sum.1, %add41
%sum.3 = add i32 %sum.2, %add50
%spec.select = add i32 %sum.3, %add59
br label %for.inc
for.inc: ; preds = %if.then, %for.body8
%sum.4 = phi i32 [ %sum.0334, %for.body8 ], [ %spec.select, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %call5
br i1 %exitcond.not, label %for.cond71.preheader, label %for.body8, !llvm.loop !10
for.body77: ; preds = %for.cond71.preheader, %for.inc148
%indvars.iv345 = phi i64 [ %indvars.iv.next346, %for.inc148 ], [ 0, %for.cond71.preheader ]
%sum.5338 = phi i32 [ %sum.9, %for.inc148 ], [ %sum.0.lcssa, %for.cond71.preheader ]
%arrayidx79 = getelementptr inbounds [9 x i8], ptr %mcxi2, i64 0, i64 %indvars.iv345
%6 = load i8, ptr %arrayidx79, align 1, !tbaa !9
%7 = add i8 %6, -97
%or.cond329 = icmp ult i8 %7, 26
br i1 %or.cond329, label %if.then89, label %for.inc148
if.then89: ; preds = %for.body77
%8 = add nsw i64 %indvars.iv345, -1
%arrayidx92 = getelementptr inbounds [9 x i8], ptr %mcxi2, i64 0, i64 %8
%9 = load i8, ptr %arrayidx92, align 1, !tbaa !9
%conv93 = sext i8 %9 to i32
%10 = add i8 %9, -48
%or.cond330 = icmp ult i8 %10, 10
%sub108 = add nsw i32 %conv93, -48
%scalar.1 = select i1 %or.cond330, i32 %sub108, i32 1
%cmp114 = icmp eq i8 %6, 109
%mul117 = mul nuw nsw i32 %scalar.1, 1000
%add118 = select i1 %cmp114, i32 %mul117, i32 0
%cmp123 = icmp eq i8 %6, 99
%mul126 = mul nuw nsw i32 %scalar.1, 100
%add127 = select i1 %cmp123, i32 %mul126, i32 0
%cmp132 = icmp eq i8 %6, 120
%mul135 = mul nuw nsw i32 %scalar.1, 10
%add136 = select i1 %cmp132, i32 %mul135, i32 0
%cmp141 = icmp eq i8 %6, 105
%add145 = select i1 %cmp141, i32 %scalar.1, i32 0
%sum.6 = add i32 %add145, %sum.5338
%sum.7 = add i32 %sum.6, %add118
%sum.8 = add i32 %sum.7, %add127
%spec.select331 = add i32 %sum.8, %add136
br label %for.inc148
for.inc148: ; preds = %if.then89, %for.body77
%sum.9 = phi i32 [ %sum.5338, %for.body77 ], [ %spec.select331, %if.then89 ]
%indvars.iv.next346 = add nuw nsw i64 %indvars.iv345, 1
%exitcond349.not = icmp eq i64 %indvars.iv.next346, %call74
br i1 %exitcond349.not, label %for.end150, label %for.body77, !llvm.loop !12
for.end150: ; preds = %for.inc148, %for.cond71.preheader
%sum.5.lcssa = phi i32 [ %sum.0.lcssa, %for.cond71.preheader ], [ %sum.9, %for.inc148 ]
%div = sdiv i32 %sum.5.lcssa, 1000
%cmp151 = icmp sgt i32 %sum.5.lcssa, 999
br i1 %cmp151, label %if.then153, label %if.end171
if.then153: ; preds = %for.end150
%mul155.neg = mul nsw i32 %div, -1000
%sub156 = add i32 %mul155.neg, %sum.5.lcssa
%sum.5.off = add nsw i32 %sum.5.lcssa, -1000
%cmp157 = icmp ult i32 %sum.5.off, 1000
br i1 %cmp157, label %if.then159, label %if.then164
if.then159: ; preds = %if.then153
store i8 109, ptr %add, align 1, !tbaa !9
br label %if.end171
if.then164: ; preds = %if.then153
%11 = trunc i32 %div to i8
%conv166 = add i8 %11, 48
store i8 %conv166, ptr %add, align 1, !tbaa !9
store i8 109, ptr %arrayidx168, align 1, !tbaa !9
br label %if.end171
if.end171: ; preds = %if.then159, %if.then164, %for.end150
%sum.10 = phi i32 [ %sub156, %if.then159 ], [ %sub156, %if.then164 ], [ %sum.5.lcssa, %for.end150 ]
%div172 = sdiv i32 %sum.10, 100
%cmp173 = icmp sgt i32 %sum.10, 99
br i1 %cmp173, label %if.then175, label %if.end200
if.then175: ; preds = %if.end171
%mul177.neg = mul nsw i32 %div172, -100
%sub178 = add i32 %mul177.neg, %sum.10
%call180 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %add) #7
%sum.10.off = add nsw i32 %sum.10, -100
%cmp182 = icmp ult i32 %sum.10.off, 100
br i1 %cmp182, label %if.end200.sink.split, label %if.then190
if.then190: ; preds = %if.then175
%12 = trunc i32 %div172 to i8
%conv192 = add i8 %12, 48
%idxprom193 = and i64 %call180, 4294967295
%arrayidx194 = getelementptr inbounds [9 x i8], ptr %add, i64 0, i64 %idxprom193
store i8 %conv192, ptr %arrayidx194, align 1, !tbaa !9
%add195 = add i64 %call180, 1
br label %if.end200.sink.split
if.end200.sink.split: ; preds = %if.then175, %if.then190
%call180.sink = phi i64 [ %add195, %if.then190 ], [ %call180, %if.then175 ]
%idxprom185 = and i64 %call180.sink, 4294967295
%arrayidx186 = getelementptr inbounds [9 x i8], ptr %add, i64 0, i64 %idxprom185
store i8 99, ptr %arrayidx186, align 1, !tbaa !9
br label %if.end200
if.end200: ; preds = %if.end200.sink.split, %if.end171
%sum.11 = phi i32 [ %sum.10, %if.end171 ], [ %sub178, %if.end200.sink.split ]
%div201 = sdiv i32 %sum.11, 10
%cmp202 = icmp sgt i32 %sum.11, 9
br i1 %cmp202, label %if.then204, label %if.end229
if.then204: ; preds = %if.end200
%mul206.neg = mul nsw i32 %div201, -10
%sub207 = add i32 %mul206.neg, %sum.11
%call209 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %add) #7
%sum.11.off = add nsw i32 %sum.11, -10
%cmp211 = icmp ult i32 %sum.11.off, 10
br i1 %cmp211, label %if.end229.sink.split, label %if.then219
if.then219: ; preds = %if.then204
%13 = trunc i32 %div201 to i8
%conv221 = add i8 %13, 48
%idxprom222 = and i64 %call209, 4294967295
%arrayidx223 = getelementptr inbounds [9 x i8], ptr %add, i64 0, i64 %idxprom222
store i8 %conv221, ptr %arrayidx223, align 1, !tbaa !9
%add224 = add i64 %call209, 1
br label %if.end229.sink.split
if.end229.sink.split: ; preds = %if.then204, %if.then219
%call209.sink = phi i64 [ %add224, %if.then219 ], [ %call209, %if.then204 ]
%idxprom214 = and i64 %call209.sink, 4294967295
%arrayidx215 = getelementptr inbounds [9 x i8], ptr %add, i64 0, i64 %idxprom214
store i8 120, ptr %arrayidx215, align 1, !tbaa !9
br label %if.end229
if.end229: ; preds = %if.end229.sink.split, %if.end200
%sum.12 = phi i32 [ %sum.11, %if.end200 ], [ %sub207, %if.end229.sink.split ]
%cmp230 = icmp sgt i32 %sum.12, 0
br i1 %cmp230, label %if.then232, label %if.end254
if.then232: ; preds = %if.end229
%call234 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %add) #7
%cmp236 = icmp eq i32 %sum.12, 1
br i1 %cmp236, label %if.end254.sink.split, label %if.then244
if.then244: ; preds = %if.then232
%14 = trunc i32 %sum.12 to i8
%conv246 = add i8 %14, 48
%idxprom247 = and i64 %call234, 4294967295
%arrayidx248 = getelementptr inbounds [9 x i8], ptr %add, i64 0, i64 %idxprom247
store i8 %conv246, ptr %arrayidx248, align 1, !tbaa !9
%add249 = add i64 %call234, 1
br label %if.end254.sink.split
if.end254.sink.split: ; preds = %if.then232, %if.then244
%call234.sink = phi i64 [ %add249, %if.then244 ], [ %call234, %if.then232 ]
%idxprom239 = and i64 %call234.sink, 4294967295
%arrayidx240 = getelementptr inbounds [9 x i8], ptr %add, i64 0, i64 %idxprom239
store i8 105, ptr %arrayidx240, align 1, !tbaa !9
br label %if.end254
if.end254: ; preds = %if.end254.sink.split, %if.end229
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %add)
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %add) #6
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %mcxi2) #6
call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %mcxi1) #6
%inc258 = add nuw nsw i32 %i.0342, 1
%15 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc258, %15
br i1 %cmp, label %for.body, label %for.end259, !llvm.loop !13
for.end259: ; preds = %if.end254, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
|
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
char digit[4]={'m','c','x','i'};
void to_num(int nums[4],char s[10]){
for(int j=0;j<strlen(s);j++){
char c=s[j];
switch(c){
case 'm':
if(j==0) nums[0]=1;
if(j-1<0) break;
if(isdigit(s[j-1])) nums[0]=s[j-1]-'0';
else nums[0]=1;
break;
case 'c':
if(j==0) nums[1]=1;
if(j-1<0) break;
if(isdigit(s[j-1])) nums[1]=s[j-1]-'0';
else nums[1]=1;
break;
case 'x':
if(j==0) nums[2]=1;
if(j-1<0) break;
if(isdigit(s[j-1])) nums[2]=s[j-1]-'0';
else nums[2]=1;
break;
case 'i':
if(j==0) nums[3]=1;
if(j-1<0) break;
if(isdigit(s[j-1])) nums[3]=s[j-1]-'0';
else nums[3]=1;
break;
default : break;
}
}
}
void sum(int nums[],int numt[],int ans[]){
for(int i=0;i<4;i++){
ans[i]=nums[i]+numt[i];
}
for(int i=3;i>=0;i--){
if(ans[i]>9){
ans[i]=ans[i]%10;
ans[i-1]++;
}
}
}
int main(void){
int n;
scanf("%d",&n);
getchar();
for(int i=0;i<n;i++){
char s[10],t[10];
scanf("%s%s",s,t); getchar();
//printf("|%s %s|\n",s,t); printf("%lu\n",strlen(s));
int nums[4]={0},numt[4]={0};
to_num(nums,s);
to_num(numt,t);
//for(int j=0;j<4;j++) printf("%d",nums[j]); puts("");
//for(int j=0;j<4;j++) printf("%d",numt[j]); puts("");
int ans[4]={0};
sum(nums,numt,ans);
//for(int j=0;j<4;j++) printf("%d",ans[j]); puts("");
for(int j=0;j<4;j++){
if(ans[j]>1){
printf("%d%c",ans[j],digit[j]);
}
else if(ans[j]==1){
printf("%c",digit[j]);
}
}puts("");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324238/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324238/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@digit = dso_local local_unnamed_addr global [4 x i8] c"mcxi", align 1
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%d%c\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @to_num(ptr nocapture noundef writeonly %nums, ptr nocapture noundef readonly %s) local_unnamed_addr #0 {
entry:
%char0 = load i8, ptr %s, align 1
%cmp162.not = icmp eq i8 %char0, 0
br i1 %cmp162.not, label %for.cond.cleanup, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%arrayidx116 = getelementptr inbounds i32, ptr %nums, i64 3
%arrayidx85 = getelementptr inbounds i32, ptr %nums, i64 2
%arrayidx54 = getelementptr inbounds i32, ptr %nums, i64 1
%conv2.peel = sext i8 %char0 to i32
switch i32 %conv2.peel, label %sw.epilog.peel [
i32 109, label %if.then.peel
i32 99, label %if.then30.peel
i32 120, label %if.then61.peel
i32 105, label %sw.epilog.peel.sink.split
]
if.then61.peel: ; preds = %for.body.lr.ph
br label %sw.epilog.peel.sink.split
if.then30.peel: ; preds = %for.body.lr.ph
br label %sw.epilog.peel.sink.split
if.then.peel: ; preds = %for.body.lr.ph
br label %sw.epilog.peel.sink.split
sw.epilog.peel.sink.split: ; preds = %for.body.lr.ph, %if.then61.peel, %if.then30.peel, %if.then.peel
%nums.sink = phi ptr [ %nums, %if.then.peel ], [ %arrayidx54, %if.then30.peel ], [ %arrayidx85, %if.then61.peel ], [ %arrayidx116, %for.body.lr.ph ]
store i32 1, ptr %nums.sink, align 4, !tbaa !5
br label %sw.epilog.peel
sw.epilog.peel: ; preds = %sw.epilog.peel.sink.split, %for.body.lr.ph
%call.peel = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #9
%cmp.peel = icmp ugt i64 %call.peel, 1
br i1 %cmp.peel, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %sw.epilog, %sw.epilog.peel, %entry
ret void
for.body: ; preds = %sw.epilog.peel, %sw.epilog
%indvars.iv = phi i64 [ %indvars.iv.next, %sw.epilog ], [ 1, %sw.epilog.peel ]
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !9
%conv2 = sext i8 %0 to i32
switch i32 %conv2, label %sw.epilog [
i32 109, label %if.end9
i32 99, label %if.end37
i32 120, label %if.end68
i32 105, label %if.end99
]
if.end9: ; preds = %for.body
%call10 = tail call ptr @__ctype_b_loc() #10
%1 = load ptr, ptr %call10, align 8, !tbaa !10
%2 = add nuw i64 %indvars.iv, 4294967295
%idxprom12 = and i64 %2, 4294967295
%arrayidx13 = getelementptr inbounds i8, ptr %s, i64 %idxprom12
%3 = load i8, ptr %arrayidx13, align 1, !tbaa !9
%idxprom15 = sext i8 %3 to i64
%arrayidx16 = getelementptr inbounds i16, ptr %1, i64 %idxprom15
%4 = load i16, ptr %arrayidx16, align 2, !tbaa !12
%5 = and i16 %4, 2048
%tobool.not = icmp eq i16 %5, 0
br i1 %tobool.not, label %if.else, label %if.then18
if.then18: ; preds = %if.end9
%conv14 = sext i8 %3 to i32
%sub23 = add nsw i32 %conv14, -48
store i32 %sub23, ptr %nums, align 4, !tbaa !5
br label %sw.epilog
if.else: ; preds = %if.end9
store i32 1, ptr %nums, align 4, !tbaa !5
br label %sw.epilog
if.end37: ; preds = %for.body
%call38 = tail call ptr @__ctype_b_loc() #10
%6 = load ptr, ptr %call38, align 8, !tbaa !10
%7 = add nuw i64 %indvars.iv, 4294967295
%idxprom40 = and i64 %7, 4294967295
%arrayidx41 = getelementptr inbounds i8, ptr %s, i64 %idxprom40
%8 = load i8, ptr %arrayidx41, align 1, !tbaa !9
%idxprom43 = sext i8 %8 to i64
%arrayidx44 = getelementptr inbounds i16, ptr %6, i64 %idxprom43
%9 = load i16, ptr %arrayidx44, align 2, !tbaa !12
%10 = and i16 %9, 2048
%tobool47.not = icmp eq i16 %10, 0
br i1 %tobool47.not, label %if.else55, label %if.then48
if.then48: ; preds = %if.end37
%conv42 = sext i8 %8 to i32
%sub53 = add nsw i32 %conv42, -48
store i32 %sub53, ptr %arrayidx54, align 4, !tbaa !5
br label %sw.epilog
if.else55: ; preds = %if.end37
store i32 1, ptr %arrayidx54, align 4, !tbaa !5
br label %sw.epilog
if.end68: ; preds = %for.body
%call69 = tail call ptr @__ctype_b_loc() #10
%11 = load ptr, ptr %call69, align 8, !tbaa !10
%12 = add nuw i64 %indvars.iv, 4294967295
%idxprom71 = and i64 %12, 4294967295
%arrayidx72 = getelementptr inbounds i8, ptr %s, i64 %idxprom71
%13 = load i8, ptr %arrayidx72, align 1, !tbaa !9
%idxprom74 = sext i8 %13 to i64
%arrayidx75 = getelementptr inbounds i16, ptr %11, i64 %idxprom74
%14 = load i16, ptr %arrayidx75, align 2, !tbaa !12
%15 = and i16 %14, 2048
%tobool78.not = icmp eq i16 %15, 0
br i1 %tobool78.not, label %if.else86, label %if.then79
if.then79: ; preds = %if.end68
%conv73 = sext i8 %13 to i32
%sub84 = add nsw i32 %conv73, -48
store i32 %sub84, ptr %arrayidx85, align 4, !tbaa !5
br label %sw.epilog
if.else86: ; preds = %if.end68
store i32 1, ptr %arrayidx85, align 4, !tbaa !5
br label %sw.epilog
if.end99: ; preds = %for.body
%call100 = tail call ptr @__ctype_b_loc() #10
%16 = load ptr, ptr %call100, align 8, !tbaa !10
%17 = add nuw i64 %indvars.iv, 4294967295
%idxprom102 = and i64 %17, 4294967295
%arrayidx103 = getelementptr inbounds i8, ptr %s, i64 %idxprom102
%18 = load i8, ptr %arrayidx103, align 1, !tbaa !9
%idxprom105 = sext i8 %18 to i64
%arrayidx106 = getelementptr inbounds i16, ptr %16, i64 %idxprom105
%19 = load i16, ptr %arrayidx106, align 2, !tbaa !12
%20 = and i16 %19, 2048
%tobool109.not = icmp eq i16 %20, 0
br i1 %tobool109.not, label %if.else117, label %if.then110
if.then110: ; preds = %if.end99
%conv104 = sext i8 %18 to i32
%sub115 = add nsw i32 %conv104, -48
store i32 %sub115, ptr %arrayidx116, align 4, !tbaa !5
br label %sw.epilog
if.else117: ; preds = %if.end99
store i32 1, ptr %arrayidx116, align 4, !tbaa !5
br label %sw.epilog
sw.epilog: ; preds = %for.body, %if.then110, %if.else117, %if.then79, %if.else86, %if.then48, %if.else55, %if.then18, %if.else
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #9
%cmp = icmp ugt i64 %call, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #3
; Function Attrs: mustprogress 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: readwrite) uwtable
define dso_local void @sum(ptr nocapture noundef readonly %nums, ptr nocapture noundef readonly %numt, ptr nocapture noundef %ans) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %nums, align 4, !tbaa !5
%1 = load i32, ptr %numt, align 4, !tbaa !5
%add = add nsw i32 %1, %0
store i32 %add, ptr %ans, align 4, !tbaa !5
%arrayidx.1 = getelementptr inbounds i32, ptr %nums, i64 1
%2 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%arrayidx2.1 = getelementptr inbounds i32, ptr %numt, i64 1
%3 = load i32, ptr %arrayidx2.1, align 4, !tbaa !5
%add.1 = add nsw i32 %3, %2
%arrayidx4.1 = getelementptr inbounds i32, ptr %ans, i64 1
store i32 %add.1, ptr %arrayidx4.1, align 4, !tbaa !5
%arrayidx.2 = getelementptr inbounds i32, ptr %nums, i64 2
%4 = load i32, ptr %arrayidx.2, align 4, !tbaa !5
%arrayidx2.2 = getelementptr inbounds i32, ptr %numt, i64 2
%5 = load i32, ptr %arrayidx2.2, align 4, !tbaa !5
%add.2 = add nsw i32 %5, %4
%arrayidx4.2 = getelementptr inbounds i32, ptr %ans, i64 2
store i32 %add.2, ptr %arrayidx4.2, align 4, !tbaa !5
%arrayidx.3 = getelementptr inbounds i32, ptr %nums, i64 3
%6 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%arrayidx2.3 = getelementptr inbounds i32, ptr %numt, i64 3
%7 = load i32, ptr %arrayidx2.3, align 4, !tbaa !5
%add.3 = add nsw i32 %7, %6
%arrayidx4.3 = getelementptr inbounds i32, ptr %ans, i64 3
store i32 %add.3, ptr %arrayidx4.3, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %add.3, 9
br i1 %cmp12, label %if.then, label %for.inc20
if.then: ; preds = %entry
%rem = urem i32 %add.3, 10
store i32 %rem, ptr %arrayidx4.3, align 4, !tbaa !5
%inc19 = add nsw i32 %add.2, 1
store i32 %inc19, ptr %arrayidx4.2, align 4, !tbaa !5
br label %for.inc20
for.inc20: ; preds = %entry, %if.then
%8 = phi i32 [ %add.2, %entry ], [ %inc19, %if.then ]
%cmp12.1 = icmp sgt i32 %8, 9
br i1 %cmp12.1, label %if.then.1, label %for.inc20.1
if.then.1: ; preds = %for.inc20
%rem.1 = urem i32 %8, 10
store i32 %rem.1, ptr %arrayidx4.2, align 4, !tbaa !5
%inc19.1 = add nsw i32 %add.1, 1
store i32 %inc19.1, ptr %arrayidx4.1, align 4, !tbaa !5
br label %for.inc20.1
for.inc20.1: ; preds = %if.then.1, %for.inc20
%9 = phi i32 [ %inc19.1, %if.then.1 ], [ %add.1, %for.inc20 ]
%cmp12.2 = icmp sgt i32 %9, 9
br i1 %cmp12.2, label %if.then.2, label %for.inc20.2
if.then.2: ; preds = %for.inc20.1
%rem.2 = urem i32 %9, 10
store i32 %rem.2, ptr %arrayidx4.1, align 4, !tbaa !5
%inc19.2 = add nsw i32 %add, 1
store i32 %inc19.2, ptr %ans, align 4, !tbaa !5
br label %for.inc20.2
for.inc20.2: ; preds = %if.then.2, %for.inc20.1
%10 = phi i32 [ %inc19.2, %if.then.2 ], [ %add, %for.inc20.1 ]
%cmp12.3 = icmp sgt i32 %10, 9
br i1 %cmp12.3, label %if.then.3, label %for.inc20.3
if.then.3: ; preds = %for.inc20.2
%rem.3 = urem i32 %10, 10
store i32 %rem.3, ptr %ans, align 4, !tbaa !5
%arrayidx18.3 = getelementptr inbounds i32, ptr %ans, i64 -1
%11 = load i32, ptr %arrayidx18.3, align 4, !tbaa !5
%inc19.3 = add nsw i32 %11, 1
store i32 %inc19.3, ptr %arrayidx18.3, align 4, !tbaa !5
br label %for.inc20.3
for.inc20.3: ; preds = %if.then.3, %for.inc20.2
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #5 {
entry:
%n = alloca i32, align 4
%s = alloca [10 x i8], align 1
%t = alloca [10 x i8], align 1
%nums = alloca [4 x i32], align 16
%numt = alloca [4 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #11
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load ptr, ptr @stdin, align 8, !tbaa !10
%call.i = call i32 @getc(ptr noundef %0)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp46 = icmp sgt i32 %1, 0
br i1 %cmp46, label %for.body.lr.ph, label %for.cond.cleanup
for.body.lr.ph: ; preds = %entry
%arrayidx.1.i = getelementptr inbounds i32, ptr %nums, i64 1
%arrayidx2.1.i = getelementptr inbounds i32, ptr %numt, i64 1
%arrayidx.2.i = getelementptr inbounds i32, ptr %nums, i64 2
%arrayidx2.2.i = getelementptr inbounds i32, ptr %numt, i64 2
%arrayidx.3.i = getelementptr inbounds i32, ptr %nums, i64 3
%arrayidx2.3.i = getelementptr inbounds i32, ptr %numt, i64 3
br label %for.body
for.cond.cleanup: ; preds = %for.inc.3, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #11
ret i32 0
for.body: ; preds = %for.body.lr.ph, %for.inc.3
%i.047 = phi i32 [ 0, %for.body.lr.ph ], [ %inc34, %for.inc.3 ]
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %s) #11
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %t) #11
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s, ptr noundef nonnull %t)
%2 = load ptr, ptr @stdin, align 8, !tbaa !10
%call.i44 = call i32 @getc(ptr noundef %2)
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %nums) #11
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %nums, i8 0, i64 16, i1 false)
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %numt) #11
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %numt, i8 0, i64 16, i1 false)
call void @to_num(ptr noundef nonnull %nums, ptr noundef nonnull %s)
call void @to_num(ptr noundef nonnull %numt, ptr noundef nonnull %t)
%3 = load i32, ptr %nums, align 16, !tbaa !5
%4 = load i32, ptr %numt, align 16, !tbaa !5
%add.i = add nsw i32 %4, %3
%5 = load i32, ptr %arrayidx.1.i, align 4, !tbaa !5
%6 = load i32, ptr %arrayidx2.1.i, align 4, !tbaa !5
%add.1.i = add nsw i32 %6, %5
%7 = load i32, ptr %arrayidx.2.i, align 8, !tbaa !5
%8 = load i32, ptr %arrayidx2.2.i, align 8, !tbaa !5
%add.2.i = add nsw i32 %8, %7
%9 = load i32, ptr %arrayidx.3.i, align 4, !tbaa !5
%10 = load i32, ptr %arrayidx2.3.i, align 4, !tbaa !5
%add.3.i = add nsw i32 %10, %9
%cmp12.i = icmp sgt i32 %add.3.i, 9
br i1 %cmp12.i, label %if.then.i, label %for.inc20.i
if.then.i: ; preds = %for.body
%rem.i = urem i32 %add.3.i, 10
%inc19.i = add nsw i32 %add.2.i, 1
br label %for.inc20.i
for.inc20.i: ; preds = %if.then.i, %for.body
%ans.sroa.11.1 = phi i32 [ %inc19.i, %if.then.i ], [ %add.2.i, %for.body ]
%ans.sroa.15.1 = phi i32 [ %rem.i, %if.then.i ], [ %add.3.i, %for.body ]
%cmp12.1.i = icmp sgt i32 %ans.sroa.11.1, 9
br i1 %cmp12.1.i, label %if.then.1.i, label %for.inc20.1.i
if.then.1.i: ; preds = %for.inc20.i
%rem.1.i = urem i32 %ans.sroa.11.1, 10
%inc19.1.i = add nsw i32 %add.1.i, 1
br label %for.inc20.1.i
for.inc20.1.i: ; preds = %if.then.1.i, %for.inc20.i
%ans.sroa.7.1 = phi i32 [ %inc19.1.i, %if.then.1.i ], [ %add.1.i, %for.inc20.i ]
%ans.sroa.11.2 = phi i32 [ %rem.1.i, %if.then.1.i ], [ %ans.sroa.11.1, %for.inc20.i ]
%cmp12.2.i = icmp sgt i32 %ans.sroa.7.1, 9
br i1 %cmp12.2.i, label %if.then.2.i, label %for.inc20.2.i
if.then.2.i: ; preds = %for.inc20.1.i
%rem.2.i = urem i32 %ans.sroa.7.1, 10
%inc19.2.i = add nsw i32 %add.i, 1
br label %for.inc20.2.i
for.inc20.2.i: ; preds = %if.then.2.i, %for.inc20.1.i
%ans.sroa.0.1 = phi i32 [ %inc19.2.i, %if.then.2.i ], [ %add.i, %for.inc20.1.i ]
%ans.sroa.7.2 = phi i32 [ %rem.2.i, %if.then.2.i ], [ %ans.sroa.7.1, %for.inc20.1.i ]
%cmp12.3.i = icmp sgt i32 %ans.sroa.0.1, 9
%rem.3.i = urem i32 %ans.sroa.0.1, 10
%ans.sroa.0.2 = select i1 %cmp12.3.i, i32 %rem.3.i, i32 %ans.sroa.0.1
%cmp16 = icmp sgt i32 %ans.sroa.0.2, 1
br i1 %cmp16, label %if.then, label %if.else
if.then: ; preds = %for.inc20.2.i
%11 = load i8, ptr @digit, align 1, !tbaa !9
%conv = sext i8 %11 to i32
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.sroa.0.2, i32 noundef %conv)
br label %for.inc
if.else: ; preds = %for.inc20.2.i
%cmp24 = icmp eq i32 %ans.sroa.0.2, 1
br i1 %cmp24, label %if.then26, label %for.inc
if.then26: ; preds = %if.else
%12 = load i8, ptr @digit, align 1, !tbaa !9
%conv29 = sext i8 %12 to i32
%putchar43 = call i32 @putchar(i32 %conv29)
br label %for.inc
for.inc: ; preds = %if.then, %if.then26, %if.else
%cmp16.1 = icmp sgt i32 %ans.sroa.7.2, 1
br i1 %cmp16.1, label %if.then.1, label %if.else.1
if.else.1: ; preds = %for.inc
%cmp24.1 = icmp eq i32 %ans.sroa.7.2, 1
br i1 %cmp24.1, label %if.then26.1, label %for.inc.1
if.then26.1: ; preds = %if.else.1
%13 = load i8, ptr getelementptr inbounds ([4 x i8], ptr @digit, i64 0, i64 1), align 1, !tbaa !9
%conv29.1 = sext i8 %13 to i32
%putchar43.1 = call i32 @putchar(i32 %conv29.1)
br label %for.inc.1
if.then.1: ; preds = %for.inc
%14 = load i8, ptr getelementptr inbounds ([4 x i8], ptr @digit, i64 0, i64 1), align 1, !tbaa !9
%conv.1 = sext i8 %14 to i32
%call21.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.sroa.7.2, i32 noundef %conv.1)
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %if.then26.1, %if.else.1
%cmp16.2 = icmp sgt i32 %ans.sroa.11.2, 1
br i1 %cmp16.2, label %if.then.2, label %if.else.2
if.else.2: ; preds = %for.inc.1
%cmp24.2 = icmp eq i32 %ans.sroa.11.2, 1
br i1 %cmp24.2, label %if.then26.2, label %for.inc.2
if.then26.2: ; preds = %if.else.2
%15 = load i8, ptr getelementptr inbounds ([4 x i8], ptr @digit, i64 0, i64 2), align 1, !tbaa !9
%conv29.2 = sext i8 %15 to i32
%putchar43.2 = call i32 @putchar(i32 %conv29.2)
br label %for.inc.2
if.then.2: ; preds = %for.inc.1
%16 = load i8, ptr getelementptr inbounds ([4 x i8], ptr @digit, i64 0, i64 2), align 1, !tbaa !9
%conv.2 = sext i8 %16 to i32
%call21.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.sroa.11.2, i32 noundef %conv.2)
br label %for.inc.2
for.inc.2: ; preds = %if.then.2, %if.then26.2, %if.else.2
%cmp16.3 = icmp sgt i32 %ans.sroa.15.1, 1
br i1 %cmp16.3, label %if.then.3, label %if.else.3
if.else.3: ; preds = %for.inc.2
%cmp24.3 = icmp eq i32 %ans.sroa.15.1, 1
br i1 %cmp24.3, label %if.then26.3, label %for.inc.3
if.then26.3: ; preds = %if.else.3
%17 = load i8, ptr getelementptr inbounds ([4 x i8], ptr @digit, i64 0, i64 3), align 1, !tbaa !9
%conv29.3 = sext i8 %17 to i32
%putchar43.3 = call i32 @putchar(i32 %conv29.3)
br label %for.inc.3
if.then.3: ; preds = %for.inc.2
%18 = load i8, ptr getelementptr inbounds ([4 x i8], ptr @digit, i64 0, i64 3), align 1, !tbaa !9
%conv.3 = sext i8 %18 to i32
%call21.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.sroa.15.1, i32 noundef %conv.3)
br label %for.inc.3
for.inc.3: ; preds = %if.then.3, %if.then26.3, %if.else.3
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %numt) #11
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %nums) #11
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %t) #11
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %s) #11
%inc34 = add nuw nsw i32 %i.047, 1
%19 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc34, %19
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !17
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #8
attributes #0 = { nofree 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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nofree nounwind }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { nounwind willreturn memory(none) }
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 = !{!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 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = distinct !{!14, !15, !16}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!"llvm.loop.peeled.count", i32 1}
!17 = distinct !{!17, !15}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i, n, time;
int flag = 0;
scanf("%d", &n);
int t[n], x[n], y[n];
int mem=0, xma=0, yma=0;
for(i=0; i<n; i++)
{
scanf("%d %d %d", &t[i], &x[i], &y[i]);
}
mem = x[0] + y[0];
if(mem > t[0])
{
flag = 1;
}
else
{
if((t[0] - mem) % 2 != 0)
{
flag = 1;
}
}
for(i=1; i<n; i++)
{
time = t[i] - t[i-1];
xma = x[i] - x[i-1];
yma = y[i] - y[i-1];
mem = abs(xma) + abs(yma);
if(mem > t[i])
{
flag = 1;
}
else
{
if((time - mem) % 2 != 0)
{
flag = 1;
}
}
}
if(flag == 0)
{
printf("Yes\n");
}
else
{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324289/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324289/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%vla2 = alloca i32, i64 %4, align 16
%cmp77 = icmp sgt i32 %3, 0
br i1 %cmp77, label %for.body, label %if.else55
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv
%arrayidx6 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx6)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%.pre = load i32, ptr %vla1, align 16, !tbaa !5
%.pre89 = load i32, ptr %vla2, align 16, !tbaa !5
%.pre90 = load i32, ptr %vla, align 16, !tbaa !5
%add = add nsw i32 %.pre89, %.pre
%cmp11 = icmp sgt i32 %add, %.pre90
%sub = sub nsw i32 %.pre90, %add
%7 = and i32 %sub, 1
%flag.0 = select i1 %cmp11, i32 1, i32 %7
%cmp1779 = icmp sgt i32 %5, 1
br i1 %cmp1779, label %for.body18.preheader, label %for.end51
for.body18.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %5 to i64
%invariant.gep = getelementptr i32, ptr %vla, i64 -1
br label %for.body18
for.body18: ; preds = %for.body18.preheader, %for.inc49
%8 = phi i32 [ %.pre89, %for.body18.preheader ], [ %12, %for.inc49 ]
%9 = phi i32 [ %.pre, %for.body18.preheader ], [ %11, %for.inc49 ]
%indvars.iv85 = phi i64 [ 1, %for.body18.preheader ], [ %indvars.iv.next86, %for.inc49 ]
%flag.180 = phi i32 [ %flag.0, %for.body18.preheader ], [ %flag.2, %for.inc49 ]
%arrayidx20 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv85
%10 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%arrayidx26 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv85
%11 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%sub30 = sub nsw i32 %11, %9
%arrayidx32 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv85
%12 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%sub36 = sub nsw i32 %12, %8
%13 = call i32 @llvm.abs.i32(i32 %sub30, i1 true)
%14 = call i32 @llvm.abs.i32(i32 %sub36, i1 true)
%add37 = add nuw nsw i32 %14, %13
%cmp40 = icmp sgt i32 %add37, %10
br i1 %cmp40, label %for.inc49, label %if.else42
if.else42: ; preds = %for.body18
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv85
%15 = load i32, ptr %gep, align 4, !tbaa !5
%16 = add i32 %add37, %15
%sub43 = sub i32 %10, %16
%17 = and i32 %sub43, 1
%cmp45.not = icmp eq i32 %17, 0
%spec.select75 = select i1 %cmp45.not, i32 %flag.180, i32 1
br label %for.inc49
for.inc49: ; preds = %if.else42, %for.body18
%flag.2 = phi i32 [ 1, %for.body18 ], [ %spec.select75, %if.else42 ]
%indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
%exitcond.not = icmp eq i64 %indvars.iv.next86, %wide.trip.count
br i1 %exitcond.not, label %for.end51, label %for.body18, !llvm.loop !11
for.end51: ; preds = %for.inc49, %for.end
%flag.1.lcssa = phi i32 [ %flag.0, %for.end ], [ %flag.2, %for.inc49 ]
%cmp52 = icmp eq i32 %flag.1.lcssa, 0
br i1 %cmp52, label %if.end57, label %if.else55
if.else55: ; preds = %entry, %for.end51
br label %if.end57
if.end57: ; preds = %for.end51, %if.else55
%str.sink = phi ptr [ @str, %if.else55 ], [ @str.4, %for.end51 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
int main(void)
{
int n, t[100001], x[100001], y[100001];
int i, dt, dist;
bool flag = false;
scanf("%d", &n);
t[0] = x[0] = y[0] = 0;
for (i=1; i<n+1; i++)
{
scanf("%d %d %d", &t[i], &x[i], &y[i]);
}
for (i=1; i<n+1; i++)
{
dt = t[i] - t[i-1];
dist = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1]);
if (dt < dist) {
flag = true;
break;
}
if (dt%2 != dist%2) {
flag = true;
break;
}
}
if (flag == true) {
printf("No\n");
} else {
printf("Yes\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324331/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324331/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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\00", align 1
@str = 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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%t = alloca [100001 x i32], align 16
%x = alloca [100001 x i32], align 16
%y = alloca [100001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %t) #5
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %y) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
store i32 0, ptr %y, align 16, !tbaa !5
store i32 0, ptr %x, align 16, !tbaa !5
store i32 0, ptr %t, align 16, !tbaa !5
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not60 = icmp slt i32 %0, 1
br i1 %cmp.not60, label %if.end44, label %for.body
for.cond9.preheader: ; preds = %for.body
%cmp11.not.not62 = icmp slt i32 %2, 1
br i1 %cmp11.not.not62, label %if.end44, label %for.body12.preheader
for.body12.preheader: ; preds = %for.cond9.preheader
%1 = add nuw i32 %2, 1
%wide.trip.count = zext i32 %1 to i64
%.pre = load i32, ptr %t, align 16, !tbaa !5
%.pre70 = load i32, ptr %x, align 16, !tbaa !5
%.pre71 = load i32, ptr %y, align 16, !tbaa !5
br label %for.body12
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx3 = getelementptr inbounds [100001 x i32], ptr %t, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [100001 x i32], ptr %x, i64 0, i64 %indvars.iv
%arrayidx7 = getelementptr inbounds [100001 x i32], ptr %y, i64 0, i64 %indvars.iv
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx7)
%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.not.not = icmp slt i64 %indvars.iv, %3
br i1 %cmp.not.not, label %for.body, label %for.cond9.preheader, !llvm.loop !9
for.cond9: ; preds = %if.end
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count
br i1 %exitcond.not, label %if.end44, label %for.body12, !llvm.loop !11
for.body12: ; preds = %for.body12.preheader, %for.cond9
%4 = phi i32 [ %.pre71, %for.body12.preheader ], [ %10, %for.cond9 ]
%5 = phi i32 [ %.pre70, %for.body12.preheader ], [ %8, %for.cond9 ]
%6 = phi i32 [ %.pre, %for.body12.preheader ], [ %7, %for.cond9 ]
%indvars.iv66 = phi i64 [ 1, %for.body12.preheader ], [ %indvars.iv.next67, %for.cond9 ]
%arrayidx14 = getelementptr inbounds [100001 x i32], ptr %t, i64 0, i64 %indvars.iv66
%7 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%sub17 = sub nsw i32 %7, %6
%arrayidx19 = getelementptr inbounds [100001 x i32], ptr %x, i64 0, i64 %indvars.iv66
%8 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%sub23 = sub nsw i32 %8, %5
%9 = call i32 @llvm.abs.i32(i32 %sub23, i1 true)
%arrayidx25 = getelementptr inbounds [100001 x i32], ptr %y, i64 0, i64 %indvars.iv66
%10 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%sub29 = sub nsw i32 %10, %4
%11 = call i32 @llvm.abs.i32(i32 %sub29, i1 true)
%add30 = add nuw nsw i32 %11, %9
%cmp31 = icmp slt i32 %sub17, %add30
br i1 %cmp31, label %if.end44, label %if.end
if.end: ; preds = %for.body12
%rem = srem i32 %sub17, 2
%rem32 = and i32 %add30, 1
%cmp33.not = icmp eq i32 %rem, %rem32
br i1 %cmp33.not, label %for.cond9, label %if.end44
if.end44: ; preds = %for.cond9, %if.end, %for.body12, %for.cond9.preheader, %entry
%str.sink = phi ptr [ @str, %entry ], [ @str, %for.cond9.preheader ], [ @str.4, %for.body12 ], [ @str.4, %if.end ], [ @str, %for.cond9 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %t) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
int PreX=0,PreY=0,PreT=0,step,t,x,y;
scanf("%d",&step);
while(step--)
{
scanf("%d %d %d",&t,&x,&y);
if((abs(PreX-x)+abs(PreY-y)>abs(PreT-t))||(abs(PreT-t)%(abs(PreX-x)+abs(PreY-y))!=0))
{
printf("No");
return 0;
}
PreX=x;PreY=y;PreT=t;
}
printf("Yes");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324375/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324375/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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\00", align 1
@.str.2 = 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:
%step = alloca i32, align 4
%t = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %step) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %step)
br label %while.cond
while.cond: ; preds = %lor.lhs.false, %entry
%PreX.0 = phi i32 [ 0, %entry ], [ %1, %lor.lhs.false ]
%PreY.0 = phi i32 [ 0, %entry ], [ %3, %lor.lhs.false ]
%PreT.0 = phi i32 [ 0, %entry ], [ %5, %lor.lhs.false ]
%0 = load i32, ptr %step, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr %step, align 4, !tbaa !5
%tobool.not = icmp eq i32 %0, 0
br i1 %tobool.not, label %cleanup, label %while.body
while.body: ; preds = %while.cond
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t, ptr noundef nonnull %x, ptr noundef nonnull %y)
%1 = load i32, ptr %x, align 4, !tbaa !5
%sub = sub nsw i32 %PreX.0, %1
%2 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%3 = load i32, ptr %y, align 4, !tbaa !5
%sub2 = sub nsw i32 %PreY.0, %3
%4 = call i32 @llvm.abs.i32(i32 %sub2, i1 true)
%add = add nuw nsw i32 %4, %2
%5 = load i32, ptr %t, align 4, !tbaa !5
%sub3 = sub nsw i32 %PreT.0, %5
%6 = call i32 @llvm.abs.i32(i32 %sub3, i1 true)
%cmp = icmp ugt i32 %add, %6
br i1 %cmp, label %cleanup, label %lor.lhs.false
lor.lhs.false: ; preds = %while.body
%rem = urem i32 %6, %add
%cmp8.not = icmp eq i32 %rem, 0
br i1 %cmp8.not, label %while.cond, label %cleanup, !llvm.loop !9
cleanup: ; preds = %while.cond, %while.body, %lor.lhs.false
%.str.3.sink = phi ptr [ @.str.2, %lor.lhs.false ], [ @.str.2, %while.body ], [ @.str.3, %while.cond ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %step) #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 speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
int main(){
int N;
scanf("%d",&N);
int t[N],x[N],y[N];
t[0]=0,x[0]=0,y[0]=0;
for (int i=1;i<=N;i++){
scanf("%d %d %d",&t[i],&x[i],&y[i]);
}
int countX=0,countY=0,sum=0;
for (int i=1;i<=N;i++){
countX=x[i]-x[i-1];
countY=y[i]-y[i-1];
sum=countX+countY;
if(sum>t[i]){
printf("No");
exit(0);
}
if((t[i]-t[i-1])%2==0){
if(sum%2==1){
printf("No");
exit(0);
}
}else{
if(sum%2==0){
printf("No");
exit(0);
}
}
}
printf("Yes");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324418/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324418/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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\00", align 1
@.str.2 = 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: 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
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%vla2 = alloca i32, i64 %4, align 16
store i32 0, ptr %vla, align 16, !tbaa !5
store i32 0, ptr %vla1, align 16, !tbaa !5
store i32 0, ptr %vla2, align 16, !tbaa !5
%cmp.not68 = icmp slt i32 %3, 1
br i1 %cmp.not68, label %for.cond.cleanup14, label %for.body
for.cond12.preheader: ; preds = %for.body
%cmp13.not70 = icmp slt i32 %6, 1
br i1 %cmp13.not70, label %for.cond.cleanup14, label %for.body15.preheader
for.body15.preheader: ; preds = %for.cond12.preheader
%5 = add nuw i32 %6, 1
%wide.trip.count = zext i32 %5 to i64
%.pre = load i32, ptr %vla1, align 16, !tbaa !5
%.pre78 = load i32, ptr %vla2, align 16, !tbaa !5
%invariant.gep = getelementptr i32, ptr %vla, i64 -1
br label %for.body15
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx5 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%arrayidx7 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv
%arrayidx9 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx7, ptr noundef nonnull %arrayidx9)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %N, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.cond12.preheader, !llvm.loop !9
for.cond.cleanup14: ; preds = %for.inc50, %entry, %for.cond12.preheader
%call53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
for.body15: ; preds = %for.body15.preheader, %for.inc50
%8 = phi i32 [ %.pre78, %for.body15.preheader ], [ %11, %for.inc50 ]
%9 = phi i32 [ %.pre, %for.body15.preheader ], [ %10, %for.inc50 ]
%indvars.iv74 = phi i64 [ 1, %for.body15.preheader ], [ %indvars.iv.next75, %for.inc50 ]
%arrayidx17 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv74
%10 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%sub20 = sub nsw i32 %10, %9
%arrayidx22 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv74
%11 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%sub26 = sub nsw i32 %11, %8
%add = add nsw i32 %sub26, %sub20
%arrayidx28 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv74
%12 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %add, %12
br i1 %cmp29, label %if.then, label %if.end
if.then: ; preds = %for.body15
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
call void @exit(i32 noundef 0) #6
unreachable
if.end: ; preds = %for.body15
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv74
%13 = load i32, ptr %gep, align 4, !tbaa !5
%sub36 = sub nsw i32 %12, %13
%14 = and i32 %sub36, 1
%cmp37 = icmp eq i32 %14, 0
br i1 %cmp37, label %if.then38, label %if.else
if.then38: ; preds = %if.end
%15 = and i32 %add, -2147483647
%cmp40 = icmp eq i32 %15, 1
br i1 %cmp40, label %if.then41, label %for.inc50
if.then41: ; preds = %if.then38
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
call void @exit(i32 noundef 0) #6
unreachable
if.else: ; preds = %if.end
%16 = and i32 %add, 1
%cmp45 = icmp eq i32 %16, 0
br i1 %cmp45, label %if.then46, label %for.inc50
if.then46: ; preds = %if.else
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
call void @exit(i32 noundef 0) #6
unreachable
for.inc50: ; preds = %if.then38, %if.else
%indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
%exitcond.not = icmp eq i64 %indvars.iv.next75, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup14, label %for.body15, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
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: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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(){
double r,l;
int i;
int d[2][4]={{0}};
while(scanf("%lf %lf",&l,&r)!=EOF){
if(r<0.2) d[1][3]++;
else if(r<0.6)d[1][2]++;
else if(r<1.1)d[1][1]++;
else d[1][0]++;
if(l<0.2) d[0][3]++;
else if(l<0.6)d[0][2]++;
else if(l<1.1)d[0][1]++;
else d[0][0]++;
}
for(i=0;i<4;i++){
printf("%d %d\n",d[0][i],d[1][i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324498/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324498/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%lf %lf\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:
%r = alloca double, align 8
%l = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %l) #3
%call56 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l, ptr noundef nonnull %r)
%cmp.not57 = icmp eq i32 %call56, -1
br i1 %cmp.not57, label %for.cond.preheader, label %while.body
for.cond.preheader: ; preds = %if.end43, %entry
%d.sroa.5.0 = phi i32 [ 0, %entry ], [ %inc3662, %if.end43 ]
%d.sroa.8.0 = phi i32 [ 0, %entry ], [ %inc3064, %if.end43 ]
%d.sroa.11.0 = phi i32 [ 0, %entry ], [ %inc2466, %if.end43 ]
%d.sroa.14.0 = phi i32 [ 0, %entry ], [ %9, %if.end43 ]
%d.sroa.17.0 = phi i32 [ 0, %entry ], [ %8, %if.end43 ]
%d.sroa.20.0 = phi i32 [ 0, %entry ], [ %7, %if.end43 ]
%d.sroa.23.0 = phi i32 [ 0, %entry ], [ %6, %if.end43 ]
%.lcssa = phi i32 [ 0, %entry ], [ %11, %if.end43 ]
%call50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.lcssa, i32 noundef %d.sroa.14.0)
%call50.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %d.sroa.5.0, i32 noundef %d.sroa.17.0)
%call50.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %d.sroa.8.0, i32 noundef %d.sroa.20.0)
%call50.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %d.sroa.11.0, i32 noundef %d.sroa.23.0)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %l) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r) #3
ret i32 0
while.body: ; preds = %entry, %if.end43
%inc2467 = phi i32 [ %inc2466, %if.end43 ], [ 0, %entry ]
%inc3065 = phi i32 [ %inc3064, %if.end43 ], [ 0, %entry ]
%inc3663 = phi i32 [ %inc3662, %if.end43 ], [ 0, %entry ]
%0 = phi i32 [ %6, %if.end43 ], [ 0, %entry ]
%1 = phi i32 [ %7, %if.end43 ], [ 0, %entry ]
%2 = phi i32 [ %8, %if.end43 ], [ 0, %entry ]
%3 = phi i32 [ %9, %if.end43 ], [ 0, %entry ]
%4 = phi i32 [ %11, %if.end43 ], [ 0, %entry ]
%5 = load double, ptr %r, align 8, !tbaa !5
%cmp1 = fcmp olt double %5, 2.000000e-01
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %while.body
%inc = add nsw i32 %0, 1
br label %if.end19
if.else: ; preds = %while.body
%cmp3 = fcmp olt double %5, 6.000000e-01
br i1 %cmp3, label %if.then4, label %if.else8
if.then4: ; preds = %if.else
%inc7 = add nsw i32 %1, 1
br label %if.end19
if.else8: ; preds = %if.else
%cmp9 = fcmp olt double %5, 1.100000e+00
br i1 %cmp9, label %if.then10, label %if.else14
if.then10: ; preds = %if.else8
%inc13 = add nsw i32 %2, 1
br label %if.end19
if.else14: ; preds = %if.else8
%inc17 = add nsw i32 %3, 1
br label %if.end19
if.end19: ; preds = %if.then4, %if.else14, %if.then10, %if.then
%6 = phi i32 [ %0, %if.then4 ], [ %0, %if.else14 ], [ %0, %if.then10 ], [ %inc, %if.then ]
%7 = phi i32 [ %inc7, %if.then4 ], [ %1, %if.else14 ], [ %1, %if.then10 ], [ %1, %if.then ]
%8 = phi i32 [ %2, %if.then4 ], [ %2, %if.else14 ], [ %inc13, %if.then10 ], [ %2, %if.then ]
%9 = phi i32 [ %3, %if.then4 ], [ %inc17, %if.else14 ], [ %3, %if.then10 ], [ %3, %if.then ]
%10 = load double, ptr %l, align 8, !tbaa !5
%cmp20 = fcmp olt double %10, 2.000000e-01
br i1 %cmp20, label %if.then21, label %if.else25
if.then21: ; preds = %if.end19
%inc24 = add nsw i32 %inc2467, 1
br label %if.end43
if.else25: ; preds = %if.end19
%cmp26 = fcmp olt double %10, 6.000000e-01
br i1 %cmp26, label %if.then27, label %if.else31
if.then27: ; preds = %if.else25
%inc30 = add nsw i32 %inc3065, 1
br label %if.end43
if.else31: ; preds = %if.else25
%cmp32 = fcmp olt double %10, 1.100000e+00
br i1 %cmp32, label %if.then33, label %if.else37
if.then33: ; preds = %if.else31
%inc36 = add nsw i32 %inc3663, 1
br label %if.end43
if.else37: ; preds = %if.else31
%inc40 = add nsw i32 %4, 1
br label %if.end43
if.end43: ; preds = %if.then27, %if.else37, %if.then33, %if.then21
%inc2466 = phi i32 [ %inc2467, %if.then27 ], [ %inc2467, %if.else37 ], [ %inc2467, %if.then33 ], [ %inc24, %if.then21 ]
%inc3064 = phi i32 [ %inc30, %if.then27 ], [ %inc3065, %if.else37 ], [ %inc3065, %if.then33 ], [ %inc3065, %if.then21 ]
%inc3662 = phi i32 [ %inc3663, %if.then27 ], [ %inc3663, %if.else37 ], [ %inc36, %if.then33 ], [ %inc3663, %if.then21 ]
%11 = phi i32 [ %4, %if.then27 ], [ %inc40, %if.else37 ], [ %4, %if.then33 ], [ %4, %if.then21 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l, ptr noundef nonnull %r)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %for.cond.preheader, label %while.body, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#define R (0)
#define L (1)
int check_p(float eye)
{
if (eye >= 1.1) return (0);
else if (eye >= 0.6) return (1);
else if (eye >= 0.2) return (2);
else return (3);
}
int main(void)
{
float in_tmp[2];
int data[4][2] = { 0 };
int i;
while (scanf("%f %f", &in_tmp[L], &in_tmp[R]) != EOF){
data[check_p(in_tmp[R])][R]++;
data[check_p(in_tmp[L])][L]++;
}
for (i = 0; i < 4; i++) printf("%d %d\n", data[i][L], data[i][R]);
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324555/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324555/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%f %f\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @check_p(float noundef %eye) local_unnamed_addr #0 {
entry:
%conv = fpext float %eye to double
%cmp = fcmp ult double %conv, 1.100000e+00
br i1 %cmp, label %if.else, label %return
if.else: ; preds = %entry
%cmp3 = fcmp ult double %conv, 6.000000e-01
br i1 %cmp3, label %if.else6, label %return
if.else6: ; preds = %if.else
%cmp8 = fcmp ult double %conv, 2.000000e-01
%. = select i1 %cmp8, i32 3, i32 2
br label %return
return: ; preds = %if.else6, %if.else, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %if.else ], [ %., %if.else6 ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%in_tmp = alloca [2 x float], align 4
%data = alloca [4 x [2 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %in_tmp) #5
call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %data) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %data, i8 0, i64 32, i1 false)
%arrayidx = getelementptr inbounds [2 x float], ptr %in_tmp, i64 0, i64 1
%call33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %in_tmp)
%cmp.not34 = icmp eq i32 %call33, -1
br i1 %cmp.not34, label %for.cond.preheader, label %while.body
for.cond.preheader.loopexit: ; preds = %check_p.exit32
%arrayidx15.phi.trans.insert = getelementptr inbounds [4 x [2 x i32]], ptr %data, i64 0, i64 0, i64 1
%.pre = load i32, ptr %arrayidx15.phi.trans.insert, align 4, !tbaa !5
%.pre37 = load i32, ptr %data, align 16, !tbaa !5
%arrayidx15.1.phi.trans.insert = getelementptr inbounds [4 x [2 x i32]], ptr %data, i64 0, i64 1, i64 1
%.pre38 = load i32, ptr %arrayidx15.1.phi.trans.insert, align 4, !tbaa !5
%arrayidx14.1.phi.trans.insert = getelementptr inbounds [4 x [2 x i32]], ptr %data, i64 0, i64 1
%.pre39 = load i32, ptr %arrayidx14.1.phi.trans.insert, align 8, !tbaa !5
%arrayidx15.2.phi.trans.insert = getelementptr inbounds [4 x [2 x i32]], ptr %data, i64 0, i64 2, i64 1
%.pre40 = load i32, ptr %arrayidx15.2.phi.trans.insert, align 4, !tbaa !5
%arrayidx14.2.phi.trans.insert = getelementptr inbounds [4 x [2 x i32]], ptr %data, i64 0, i64 2
%.pre41 = load i32, ptr %arrayidx14.2.phi.trans.insert, align 16, !tbaa !5
%arrayidx15.3.phi.trans.insert = getelementptr inbounds [4 x [2 x i32]], ptr %data, i64 0, i64 3, i64 1
%.pre42 = load i32, ptr %arrayidx15.3.phi.trans.insert, align 4, !tbaa !5
%arrayidx14.3.phi.trans.insert = getelementptr inbounds [4 x [2 x i32]], ptr %data, i64 0, i64 3
%.pre43 = load i32, ptr %arrayidx14.3.phi.trans.insert, align 8, !tbaa !5
br label %for.cond.preheader
for.cond.preheader: ; preds = %for.cond.preheader.loopexit, %entry
%0 = phi i32 [ %.pre43, %for.cond.preheader.loopexit ], [ 0, %entry ]
%1 = phi i32 [ %.pre42, %for.cond.preheader.loopexit ], [ 0, %entry ]
%2 = phi i32 [ %.pre41, %for.cond.preheader.loopexit ], [ 0, %entry ]
%3 = phi i32 [ %.pre40, %for.cond.preheader.loopexit ], [ 0, %entry ]
%4 = phi i32 [ %.pre39, %for.cond.preheader.loopexit ], [ 0, %entry ]
%5 = phi i32 [ %.pre38, %for.cond.preheader.loopexit ], [ 0, %entry ]
%6 = phi i32 [ %.pre37, %for.cond.preheader.loopexit ], [ 0, %entry ]
%7 = phi i32 [ %.pre, %for.cond.preheader.loopexit ], [ 0, %entry ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7, i32 noundef %6)
%call19.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5, i32 noundef %4)
%call19.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3, i32 noundef %2)
%call19.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1, i32 noundef %0)
call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %data) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %in_tmp) #5
ret i32 0
while.body: ; preds = %entry, %check_p.exit32
%8 = load float, ptr %in_tmp, align 4, !tbaa !9
%conv.i = fpext float %8 to double
%cmp.i = fcmp ult double %conv.i, 1.100000e+00
br i1 %cmp.i, label %if.else.i, label %check_p.exit
if.else.i: ; preds = %while.body
%cmp3.i = fcmp ult double %conv.i, 6.000000e-01
br i1 %cmp3.i, label %if.else6.i, label %check_p.exit
if.else6.i: ; preds = %if.else.i
%cmp8.i = fcmp ult double %conv.i, 2.000000e-01
%..i = select i1 %cmp8.i, i64 3, i64 2
br label %check_p.exit
check_p.exit: ; preds = %while.body, %if.else.i, %if.else6.i
%retval.0.i = phi i64 [ 0, %while.body ], [ 1, %if.else.i ], [ %..i, %if.else6.i ]
%arrayidx4 = getelementptr inbounds [4 x [2 x i32]], ptr %data, i64 0, i64 %retval.0.i
%9 = load i32, ptr %arrayidx4, align 8, !tbaa !5
%inc = add nsw i32 %9, 1
store i32 %inc, ptr %arrayidx4, align 8, !tbaa !5
%10 = load float, ptr %arrayidx, align 4, !tbaa !9
%conv.i24 = fpext float %10 to double
%cmp.i25 = fcmp ult double %conv.i24, 1.100000e+00
br i1 %cmp.i25, label %if.else.i27, label %check_p.exit32
if.else.i27: ; preds = %check_p.exit
%cmp3.i28 = fcmp ult double %conv.i24, 6.000000e-01
br i1 %cmp3.i28, label %if.else6.i29, label %check_p.exit32
if.else6.i29: ; preds = %if.else.i27
%cmp8.i30 = fcmp ult double %conv.i24, 2.000000e-01
%..i31 = select i1 %cmp8.i30, i64 3, i64 2
br label %check_p.exit32
check_p.exit32: ; preds = %check_p.exit, %if.else.i27, %if.else6.i29
%retval.0.i26 = phi i64 [ 0, %check_p.exit ], [ 1, %if.else.i27 ], [ %..i31, %if.else6.i29 ]
%arrayidx10 = getelementptr inbounds [4 x [2 x i32]], ptr %data, i64 0, i64 %retval.0.i26, i64 1
%11 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%inc11 = add nsw i32 %11, 1
store i32 %inc11, ptr %arrayidx10, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %in_tmp)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %for.cond.preheader.loopexit, label %while.body, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int out[4][2] = {}, i;
double e[2];
while(scanf("%lf%lf", &e[0], &e[1]) != EOF){
for(i = 0;i < 2;i++){
if(e[i] < 0.2) out[3][i]++;
else if(e[i] < 0.6) out[2][i]++;
else if(e[i] < 1.1) out[1][i]++;
else out[0][i]++;
}
}
for(i = 0;i < 4;i++)
printf("%d %d\n", out[i][0], out[i][1]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324599/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324599/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf%lf\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:
%e = alloca [2 x double], align 16
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %e) #3
%arrayidx1 = getelementptr inbounds [2 x double], ptr %e, i64 0, i64 1
%call59 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %e, ptr noundef nonnull %arrayidx1)
%cmp.not60 = icmp eq i32 %call59, -1
br i1 %cmp.not60, label %for.cond33.preheader, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.inc.1
%out.sroa.0.0 = phi i32 [ %out.sroa.0.2, %for.inc.1 ], [ 0, %entry ]
%out.sroa.6.0 = phi i32 [ %out.sroa.6.2, %for.inc.1 ], [ 0, %entry ]
%out.sroa.9.0 = phi i32 [ %out.sroa.9.2, %for.inc.1 ], [ 0, %entry ]
%out.sroa.12.0 = phi i32 [ %out.sroa.12.2, %for.inc.1 ], [ 0, %entry ]
%out.sroa.15.0 = phi i32 [ %out.sroa.15.2, %for.inc.1 ], [ 0, %entry ]
%out.sroa.18.0 = phi i32 [ %out.sroa.18.2, %for.inc.1 ], [ 0, %entry ]
%out.sroa.21.0 = phi i32 [ %out.sroa.21.2, %for.inc.1 ], [ 0, %entry ]
%out.sroa.24.0 = phi i32 [ %out.sroa.24.2, %for.inc.1 ], [ 0, %entry ]
%0 = load double, ptr %e, align 16, !tbaa !5
%cmp4 = fcmp olt double %0, 2.000000e-01
br i1 %cmp4, label %if.then, label %if.else
for.cond33.preheader: ; preds = %for.inc.1, %entry
%out.sroa.0.1 = phi i32 [ 0, %entry ], [ %out.sroa.0.2, %for.inc.1 ]
%out.sroa.6.1 = phi i32 [ 0, %entry ], [ %out.sroa.6.2, %for.inc.1 ]
%out.sroa.9.1 = phi i32 [ 0, %entry ], [ %out.sroa.9.2, %for.inc.1 ]
%out.sroa.12.1 = phi i32 [ 0, %entry ], [ %out.sroa.12.2, %for.inc.1 ]
%out.sroa.15.1 = phi i32 [ 0, %entry ], [ %out.sroa.15.2, %for.inc.1 ]
%out.sroa.18.1 = phi i32 [ 0, %entry ], [ %out.sroa.18.2, %for.inc.1 ]
%out.sroa.21.1 = phi i32 [ 0, %entry ], [ %out.sroa.21.2, %for.inc.1 ]
%out.sroa.24.1 = phi i32 [ 0, %entry ], [ %out.sroa.24.2, %for.inc.1 ]
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %out.sroa.0.1, i32 noundef %out.sroa.6.1)
%call42.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %out.sroa.9.1, i32 noundef %out.sroa.12.1)
%call42.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %out.sroa.15.1, i32 noundef %out.sroa.18.1)
%call42.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %out.sroa.21.1, i32 noundef %out.sroa.24.1)
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %e) #3
ret i32 0
if.then: ; preds = %for.cond.preheader
%inc = add nsw i32 %out.sroa.21.0, 1
br label %for.inc
if.else: ; preds = %for.cond.preheader
%cmp10 = fcmp olt double %0, 6.000000e-01
br i1 %cmp10, label %if.then11, label %if.else16
if.then11: ; preds = %if.else
%inc15 = add nsw i32 %out.sroa.15.0, 1
br label %for.inc
if.else16: ; preds = %if.else
%cmp19 = fcmp olt double %0, 1.100000e+00
br i1 %cmp19, label %if.then20, label %if.else25
if.then20: ; preds = %if.else16
%inc24 = add nsw i32 %out.sroa.9.0, 1
br label %for.inc
if.else25: ; preds = %if.else16
%inc29 = add nsw i32 %out.sroa.0.0, 1
br label %for.inc
for.inc: ; preds = %if.then, %if.then20, %if.else25, %if.then11
%out.sroa.0.2 = phi i32 [ %out.sroa.0.0, %if.then ], [ %out.sroa.0.0, %if.then11 ], [ %out.sroa.0.0, %if.then20 ], [ %inc29, %if.else25 ]
%out.sroa.9.2 = phi i32 [ %out.sroa.9.0, %if.then ], [ %out.sroa.9.0, %if.then11 ], [ %inc24, %if.then20 ], [ %out.sroa.9.0, %if.else25 ]
%out.sroa.15.2 = phi i32 [ %out.sroa.15.0, %if.then ], [ %inc15, %if.then11 ], [ %out.sroa.15.0, %if.then20 ], [ %out.sroa.15.0, %if.else25 ]
%out.sroa.21.2 = phi i32 [ %inc, %if.then ], [ %out.sroa.21.0, %if.then11 ], [ %out.sroa.21.0, %if.then20 ], [ %out.sroa.21.0, %if.else25 ]
%1 = load double, ptr %arrayidx1, align 8, !tbaa !5
%cmp4.1 = fcmp olt double %1, 2.000000e-01
br i1 %cmp4.1, label %if.then.1, label %if.else.1
if.else.1: ; preds = %for.inc
%cmp10.1 = fcmp olt double %1, 6.000000e-01
br i1 %cmp10.1, label %if.then11.1, label %if.else16.1
if.else16.1: ; preds = %if.else.1
%cmp19.1 = fcmp olt double %1, 1.100000e+00
br i1 %cmp19.1, label %if.then20.1, label %if.else25.1
if.else25.1: ; preds = %if.else16.1
%inc29.1 = add nsw i32 %out.sroa.6.0, 1
br label %for.inc.1
if.then20.1: ; preds = %if.else16.1
%inc24.1 = add nsw i32 %out.sroa.12.0, 1
br label %for.inc.1
if.then11.1: ; preds = %if.else.1
%inc15.1 = add nsw i32 %out.sroa.18.0, 1
br label %for.inc.1
if.then.1: ; preds = %for.inc
%inc.1 = add nsw i32 %out.sroa.24.0, 1
br label %for.inc.1
for.inc.1: ; preds = %if.then.1, %if.then11.1, %if.then20.1, %if.else25.1
%out.sroa.6.2 = phi i32 [ %out.sroa.6.0, %if.then.1 ], [ %out.sroa.6.0, %if.then11.1 ], [ %out.sroa.6.0, %if.then20.1 ], [ %inc29.1, %if.else25.1 ]
%out.sroa.12.2 = phi i32 [ %out.sroa.12.0, %if.then.1 ], [ %out.sroa.12.0, %if.then11.1 ], [ %inc24.1, %if.then20.1 ], [ %out.sroa.12.0, %if.else25.1 ]
%out.sroa.18.2 = phi i32 [ %out.sroa.18.0, %if.then.1 ], [ %inc15.1, %if.then11.1 ], [ %out.sroa.18.0, %if.then20.1 ], [ %out.sroa.18.0, %if.else25.1 ]
%out.sroa.24.2 = phi i32 [ %inc.1, %if.then.1 ], [ %out.sroa.24.0, %if.then11.1 ], [ %out.sroa.24.0, %if.then20.1 ], [ %out.sroa.24.0, %if.else25.1 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %e, ptr noundef nonnull %arrayidx1)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %for.cond33.preheader, label %for.cond.preheader, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
int map[19][19],dp[19][19];
int main(){
int i,j,x,y;
long long int ans;
while(1){
scanf("%d%d",&x,&y);
if(x+y==0)break;
memset(dp,0,sizeof(dp));
memset(map,0,sizeof(map));
ans=0;
for(i=1;i<=y;i++){
for(j=1;j<=x;j++){
scanf("%d",&map[i][j]);
if(i==1 && map[1][j]==0)dp[1][j]=1;
}
}
for(i=1;i<=y;i++){
for(j=1;j<=x;j++){
if(map[i][j]==0){
if(map[i+1][j]!=1)dp[i+1][j]+=dp[i][j];
if(i<y){
if(map[i+1][j-1]==0)dp[i+1][j-1]+=dp[i][j];
if(map[i+1][j+1]==0)dp[i+1][j+1]+=dp[i][j];
}
}
else if(map[i][j]==2){
dp[i+2][j]+=dp[i][j];
}
//printf("%2d ",dp[i][j]);
}
//printf("\n");
}
for(j=1;j<=x;j++){
//ans+=dp[y+1][j]+dp[y+2][j];
if(map[y+1][j]!=1)ans+=dp[y+1][j];
if(map[y+2][j]!=1)ans+=dp[y+2][j];
//printf("%2d ",dp[y+1][j]);
}
//printf("\n");
//for(j=1;j<=x;j++)printf("%2d ",dp[y+2][j]);
//printf("\n");
printf("%lld\n",ans);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324641/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324641/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@dp = dso_local local_unnamed_addr global [19 x [19 x i32]] zeroinitializer, align 16
@map = dso_local global [19 x [19 x i32]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = 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
%call210 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%add211 = sub i32 0, %1
%cmp212 = icmp eq i32 %0, %add211
br i1 %cmp212, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end150
%2 = phi i32 [ %38, %for.end150 ], [ %0, %entry ]
%3 = phi i32 [ %39, %for.end150 ], [ %1, %entry ]
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1444) @dp, i8 0, i64 1444, i1 false)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1444) @map, i8 0, i64 1444, i1 false)
%cmp1.not200 = icmp slt i32 %3, 1
br i1 %cmp1.not200, label %for.cond115.preheader, label %for.cond2.preheader.lr.ph
for.cond2.preheader.lr.ph: ; preds = %if.end
%4 = icmp slt i32 %2, 1
br i1 %4, label %for.end150, label %for.cond2.preheader
for.cond19.preheader: ; preds = %for.inc16
%cmp20.not204 = icmp slt i32 %15, 1
br i1 %cmp20.not204, label %for.cond115.preheader, label %for.cond22.preheader.lr.ph
for.cond22.preheader.lr.ph: ; preds = %for.cond19.preheader
%cmp23.not202 = icmp slt i32 %14, 1
br i1 %cmp23.not202, label %for.end150, label %for.cond22.preheader.preheader
for.cond22.preheader.preheader: ; preds = %for.cond22.preheader.lr.ph
%5 = add nuw i32 %14, 1
%6 = zext i32 %15 to i64
%7 = add nuw nsw i32 %15, 1
%wide.trip.count236 = zext i32 %7 to i64
%wide.trip.count = zext i32 %5 to i64
%wide.trip.count230 = zext i32 %5 to i64
br label %for.cond22.preheader
for.cond2.preheader: ; preds = %for.cond2.preheader.lr.ph, %for.inc16
%8 = phi i32 [ %14, %for.inc16 ], [ %2, %for.cond2.preheader.lr.ph ]
%i.0201 = phi i32 [ %inc17, %for.inc16 ], [ 1, %for.cond2.preheader.lr.ph ]
%cmp3.not198 = icmp slt i32 %8, 1
br i1 %cmp3.not198, label %for.inc16, label %for.body4.lr.ph
for.body4.lr.ph: ; preds = %for.cond2.preheader
%idxprom = zext i32 %i.0201 to i64
%cmp8 = icmp eq i32 %i.0201, 1
br i1 %cmp8, label %for.body4.us, label %for.body4
for.body4.us: ; preds = %for.body4.lr.ph, %for.inc.us
%indvars.iv219 = phi i64 [ %indvars.iv.next220, %for.inc.us ], [ 1, %for.body4.lr.ph ]
%arrayidx6.us = getelementptr inbounds [19 x [19 x i32]], ptr @map, i64 0, i64 %idxprom, i64 %indvars.iv219
%call7.us = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6.us)
%arrayidx10.us = getelementptr inbounds [19 x [19 x i32]], ptr @map, i64 0, i64 1, i64 %indvars.iv219
%9 = load i32, ptr %arrayidx10.us, align 4, !tbaa !5
%cmp11.us = icmp eq i32 %9, 0
br i1 %cmp11.us, label %if.then12.us, label %for.inc.us
if.then12.us: ; preds = %for.body4.us
%arrayidx14.us = getelementptr inbounds [19 x [19 x i32]], ptr @dp, i64 0, i64 1, i64 %indvars.iv219
store i32 1, ptr %arrayidx14.us, align 4, !tbaa !5
br label %for.inc.us
for.inc.us: ; preds = %if.then12.us, %for.body4.us
%indvars.iv.next220 = add nuw nsw i64 %indvars.iv219, 1
%10 = load i32, ptr %x, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp3.not.us.not = icmp slt i64 %indvars.iv219, %11
br i1 %cmp3.not.us.not, label %for.body4.us, label %for.inc16, !llvm.loop !9
for.body4: ; preds = %for.body4.lr.ph, %for.body4
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 1, %for.body4.lr.ph ]
%arrayidx6 = getelementptr inbounds [19 x [19 x i32]], ptr @map, i64 0, i64 %idxprom, i64 %indvars.iv
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%12 = load i32, ptr %x, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp3.not.not = icmp slt i64 %indvars.iv, %13
br i1 %cmp3.not.not, label %for.body4, label %for.inc16, !llvm.loop !9
for.inc16: ; preds = %for.body4, %for.inc.us, %for.cond2.preheader
%14 = phi i32 [ %8, %for.cond2.preheader ], [ %10, %for.inc.us ], [ %12, %for.body4 ]
%inc17 = add i32 %i.0201, 1
%15 = load i32, ptr %y, align 4, !tbaa !5
%cmp1.not = icmp sgt i32 %inc17, %15
br i1 %cmp1.not, label %for.cond19.preheader, label %for.cond2.preheader, !llvm.loop !11
for.cond115.preheader: ; preds = %for.cond22.for.inc112_crit_edge, %if.end, %for.cond19.preheader
%.lcssa245 = phi i32 [ %15, %for.cond19.preheader ], [ %3, %if.end ], [ %15, %for.cond22.for.inc112_crit_edge ]
%16 = phi i32 [ %14, %for.cond19.preheader ], [ %2, %if.end ], [ %14, %for.cond22.for.inc112_crit_edge ]
%cmp116.not206 = icmp slt i32 %16, 1
br i1 %cmp116.not206, label %for.end150, label %for.body117.lr.ph
for.body117.lr.ph: ; preds = %for.cond115.preheader
%add118 = add nsw i32 %.lcssa245, 1
%idxprom119 = sext i32 %add118 to i64
%add132 = add nsw i32 %.lcssa245, 2
%idxprom133 = sext i32 %add132 to i64
%17 = add nuw i32 %16, 1
%wide.trip.count241 = zext i32 %17 to i64
br label %for.body117
for.cond22.preheader: ; preds = %for.cond22.preheader.preheader, %for.cond22.for.inc112_crit_edge
%indvars.iv232 = phi i64 [ 1, %for.cond22.preheader.preheader ], [ %indvars.iv.next233, %for.cond22.for.inc112_crit_edge ]
%18 = add nuw nsw i64 %indvars.iv232, 2
%indvars.iv.next233 = add nuw nsw i64 %indvars.iv232, 1
%cmp49 = icmp ult i64 %indvars.iv232, %6
%cmp49.fr = freeze i1 %cmp49
br i1 %cmp49.fr, label %for.body24.us, label %for.body24
for.body24.us: ; preds = %for.cond22.preheader, %for.inc109.us
%indvars.iv225 = phi i64 [ %indvars.iv.next226, %for.inc109.us ], [ 1, %for.cond22.preheader ]
%arrayidx28.us = getelementptr inbounds [19 x [19 x i32]], ptr @map, i64 0, i64 %indvars.iv232, i64 %indvars.iv225
%19 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5
switch i32 %19, label %for.inc109.us [
i32 0, label %if.then30.us
i32 2, label %if.then96.us
]
if.then96.us: ; preds = %for.body24.us
%arrayidx105.us = getelementptr inbounds [19 x [19 x i32]], ptr @dp, i64 0, i64 %18, i64 %indvars.iv225
br label %for.inc109.us.sink.split
if.then30.us: ; preds = %for.body24.us
%arrayidx35.us = getelementptr inbounds [19 x [19 x i32]], ptr @map, i64 0, i64 %indvars.iv.next233, i64 %indvars.iv225
%20 = load i32, ptr %arrayidx35.us, align 4, !tbaa !5
%cmp36.not.us = icmp eq i32 %20, 1
br i1 %cmp36.not.us, label %if.end48.us, label %if.then37.us
if.then37.us: ; preds = %if.then30.us
%arrayidx41.us = getelementptr inbounds [19 x [19 x i32]], ptr @dp, i64 0, i64 %indvars.iv232, i64 %indvars.iv225
%21 = load i32, ptr %arrayidx41.us, align 4, !tbaa !5
%arrayidx46.us = getelementptr inbounds [19 x [19 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next233, i64 %indvars.iv225
%22 = load i32, ptr %arrayidx46.us, align 4, !tbaa !5
%add47.us = add nsw i32 %22, %21
store i32 %add47.us, ptr %arrayidx46.us, align 4, !tbaa !5
br label %if.end48.us
if.end48.us: ; preds = %if.then37.us, %if.then30.us
%23 = add nsw i64 %indvars.iv225, -1
%arrayidx55.us = getelementptr inbounds [19 x [19 x i32]], ptr @map, i64 0, i64 %indvars.iv.next233, i64 %23
%24 = load i32, ptr %arrayidx55.us, align 4, !tbaa !5
%cmp56.us = icmp eq i32 %24, 0
br i1 %cmp56.us, label %if.then57.us, label %if.end69.us
if.then57.us: ; preds = %if.end48.us
%arrayidx61.us = getelementptr inbounds [19 x [19 x i32]], ptr @dp, i64 0, i64 %indvars.iv232, i64 %indvars.iv225
%25 = load i32, ptr %arrayidx61.us, align 4, !tbaa !5
%arrayidx67.us = getelementptr inbounds [19 x [19 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next233, i64 %23
%26 = load i32, ptr %arrayidx67.us, align 4, !tbaa !5
%add68.us = add nsw i32 %26, %25
store i32 %add68.us, ptr %arrayidx67.us, align 4, !tbaa !5
br label %if.end69.us
if.end69.us: ; preds = %if.then57.us, %if.end48.us
%27 = add nuw i64 %indvars.iv225, 1
%idxprom74.us = and i64 %27, 4294967295
%arrayidx75.us = getelementptr inbounds [19 x [19 x i32]], ptr @map, i64 0, i64 %indvars.iv.next233, i64 %idxprom74.us
%28 = load i32, ptr %arrayidx75.us, align 4, !tbaa !5
%cmp76.us = icmp eq i32 %28, 0
br i1 %cmp76.us, label %if.then77.us, label %for.inc109.us
if.then77.us: ; preds = %if.end69.us
%arrayidx87.us = getelementptr inbounds [19 x [19 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next233, i64 %idxprom74.us
br label %for.inc109.us.sink.split
for.inc109.us.sink.split: ; preds = %if.then96.us, %if.then77.us
%arrayidx87.us.sink261 = phi ptr [ %arrayidx87.us, %if.then77.us ], [ %arrayidx105.us, %if.then96.us ]
%.sink260.in = getelementptr inbounds [19 x [19 x i32]], ptr @dp, i64 0, i64 %indvars.iv232, i64 %indvars.iv225
%.sink260 = load i32, ptr %.sink260.in, align 4, !tbaa !5
%29 = load i32, ptr %arrayidx87.us.sink261, align 4, !tbaa !5
%add88.us = add nsw i32 %29, %.sink260
store i32 %add88.us, ptr %arrayidx87.us.sink261, align 4, !tbaa !5
br label %for.inc109.us
for.inc109.us: ; preds = %for.inc109.us.sink.split, %if.end69.us, %for.body24.us
%indvars.iv.next226 = add nuw nsw i64 %indvars.iv225, 1
%exitcond231.not = icmp eq i64 %indvars.iv.next226, %wide.trip.count230
br i1 %exitcond231.not, label %for.cond22.for.inc112_crit_edge, label %for.body24.us, !llvm.loop !13
for.body24: ; preds = %for.cond22.preheader, %for.inc109
%indvars.iv222 = phi i64 [ %indvars.iv.next223, %for.inc109 ], [ 1, %for.cond22.preheader ]
%arrayidx28 = getelementptr inbounds [19 x [19 x i32]], ptr @map, i64 0, i64 %indvars.iv232, i64 %indvars.iv222
%30 = load i32, ptr %arrayidx28, align 4, !tbaa !5
switch i32 %30, label %for.inc109 [
i32 0, label %if.then30
i32 2, label %for.inc109.sink.split
]
if.then30: ; preds = %for.body24
%arrayidx35 = getelementptr inbounds [19 x [19 x i32]], ptr @map, i64 0, i64 %indvars.iv.next233, i64 %indvars.iv222
%31 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%cmp36.not = icmp eq i32 %31, 1
br i1 %cmp36.not, label %for.inc109, label %for.inc109.sink.split
for.inc109.sink.split: ; preds = %for.body24, %if.then30
%.sink = phi i64 [ %indvars.iv.next233, %if.then30 ], [ %18, %for.body24 ]
%arrayidx100 = getelementptr inbounds [19 x [19 x i32]], ptr @dp, i64 0, i64 %indvars.iv232, i64 %indvars.iv222
%32 = load i32, ptr %arrayidx100, align 4, !tbaa !5
%arrayidx105 = getelementptr inbounds [19 x [19 x i32]], ptr @dp, i64 0, i64 %.sink, i64 %indvars.iv222
%33 = load i32, ptr %arrayidx105, align 4, !tbaa !5
%add47 = add nsw i32 %33, %32
store i32 %add47, ptr %arrayidx105, align 4, !tbaa !5
br label %for.inc109
for.inc109: ; preds = %for.inc109.sink.split, %if.then30, %for.body24
%indvars.iv.next223 = add nuw nsw i64 %indvars.iv222, 1
%exitcond.not = icmp eq i64 %indvars.iv.next223, %wide.trip.count
br i1 %exitcond.not, label %for.cond22.for.inc112_crit_edge, label %for.body24, !llvm.loop !13
for.cond22.for.inc112_crit_edge: ; preds = %for.inc109, %for.inc109.us
%exitcond237.not = icmp eq i64 %indvars.iv.next233, %wide.trip.count236
br i1 %exitcond237.not, label %for.cond115.preheader, label %for.cond22.preheader, !llvm.loop !14
for.body117: ; preds = %for.body117.lr.ph, %for.inc148
%indvars.iv238 = phi i64 [ 1, %for.body117.lr.ph ], [ %indvars.iv.next239, %for.inc148 ]
%ans.0208 = phi i64 [ 0, %for.body117.lr.ph ], [ %ans.2, %for.inc148 ]
%arrayidx122 = getelementptr inbounds [19 x [19 x i32]], ptr @map, i64 0, i64 %idxprom119, i64 %indvars.iv238
%34 = load i32, ptr %arrayidx122, align 4, !tbaa !5
%cmp123.not = icmp eq i32 %34, 1
br i1 %cmp123.not, label %if.end131, label %if.then124
if.then124: ; preds = %for.body117
%arrayidx129 = getelementptr inbounds [19 x [19 x i32]], ptr @dp, i64 0, i64 %idxprom119, i64 %indvars.iv238
%35 = load i32, ptr %arrayidx129, align 4, !tbaa !5
%conv = sext i32 %35 to i64
%add130 = add nsw i64 %ans.0208, %conv
br label %if.end131
if.end131: ; preds = %if.then124, %for.body117
%ans.1 = phi i64 [ %add130, %if.then124 ], [ %ans.0208, %for.body117 ]
%arrayidx136 = getelementptr inbounds [19 x [19 x i32]], ptr @map, i64 0, i64 %idxprom133, i64 %indvars.iv238
%36 = load i32, ptr %arrayidx136, align 4, !tbaa !5
%cmp137.not = icmp eq i32 %36, 1
br i1 %cmp137.not, label %for.inc148, label %if.then139
if.then139: ; preds = %if.end131
%arrayidx144 = getelementptr inbounds [19 x [19 x i32]], ptr @dp, i64 0, i64 %idxprom133, i64 %indvars.iv238
%37 = load i32, ptr %arrayidx144, align 4, !tbaa !5
%conv145 = sext i32 %37 to i64
%add146 = add nsw i64 %ans.1, %conv145
br label %for.inc148
for.inc148: ; preds = %if.end131, %if.then139
%ans.2 = phi i64 [ %add146, %if.then139 ], [ %ans.1, %if.end131 ]
%indvars.iv.next239 = add nuw nsw i64 %indvars.iv238, 1
%exitcond242.not = icmp eq i64 %indvars.iv.next239, %wide.trip.count241
br i1 %exitcond242.not, label %for.end150, label %for.body117, !llvm.loop !15
for.end150: ; preds = %for.inc148, %for.cond2.preheader.lr.ph, %for.cond22.preheader.lr.ph, %for.cond115.preheader
%ans.0.lcssa = phi i64 [ 0, %for.cond115.preheader ], [ 0, %for.cond22.preheader.lr.ph ], [ 0, %for.cond2.preheader.lr.ph ], [ %ans.2, %for.inc148 ]
%call151 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%38 = load i32, ptr %x, align 4, !tbaa !5
%39 = load i32, ptr %y, align 4, !tbaa !5
%add = sub i32 0, %39
%cmp = icmp eq i32 %38, %add
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %for.end150, %entry
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: 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
#include<math.h>
int main(void){
int X1,X2,X3,Y1,Y2,Y3;
unsigned long long int S,sa;
scanf("%llu",&S);
X1=0;Y1=0;
X2=(int)sqrt(S)+1;
Y3=(int)sqrt(S)+1;
sa=X2*Y3-S;
X3=sa;
Y2=1;
if(S==1000000000000000000){
X2=1000000000,Y3=1000000000,X3=0,Y2=0;
}
printf("%d %d %d %d %d %d",X1,Y1,X2,Y2,X3,Y3);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324685/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324685/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%llu\00", align 1
@.str.1 = private unnamed_addr constant [18 x i8] c"%d %d %d %d %d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %S) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%0 = load i64, ptr %S, align 8, !tbaa !5
%conv = uitofp i64 %0 to double
%sqrt13 = call double @llvm.sqrt.f64(double %conv)
%conv2 = fptosi double %sqrt13 to i32
%add = add nsw i32 %conv2, 1
%mul = mul nsw i32 %add, %add
%1 = trunc i64 %0 to i32
%conv8 = sub i32 %mul, %1
%cmp = icmp ne i64 %0, 1000000000000000000
%X3.0 = select i1 %cmp, i32 %conv8, i32 0
%Y2.0 = zext i1 %cmp to i32
%Y3.0 = select i1 %cmp, i32 %add, i32 1000000000
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 0, i32 noundef 0, i32 noundef %Y3.0, i32 noundef %Y2.0, i32 noundef %X3.0, i32 noundef %Y3.0)
call void @llvm.lifetime.end.p0(i64 8, 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 double @llvm.sqrt.f64(double) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
int compare(const void *a,const void *b){
if(*(int *)a>*(int *)b)return -1;
return 1;
}
int main(int argc, const char * argv[]) {
int a,b,c,x,y;
scanf("%d%d%d%d%d",&x,&y,&a,&b,&c);
int p[a],q[b],r[c];
for(int i=0;i<a;i++){
scanf("%d",&p[i]);
}
qsort(p,a,sizeof(int),compare);
for(int i=0;i<b;i++){
scanf("%d",&q[i]);
}
qsort(q,b,sizeof(int),compare);
for(int i=0;i<c;i++){
scanf("%d",&r[i]);
}
qsort(r,c,sizeof(int),compare);
int array[x+y];
for(int i=0;i<x;i++){
array[i]=p[i];
}
for(int i=0;i<y;i++){
array[x+i]=q[i];
}
qsort(array,x+y,sizeof(int),compare);
int ir=0;
for(int i=x+y-1;i>=0;i--){
if(array[i]<r[ir]){
array[i]=r[ir];
ir++;
}else{
break;
}
}
long long ans=0;
for(int i=0;i<x+y;i++){
ans+=array[i];
}
printf("%lld",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324728/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324728/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [11 x i8] c"%d%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%. = select i1 %cmp, i32 -1, i32 1
ret i32 %.
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #1 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, 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 %b, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%5 = load i32, ptr %c, align 4, !tbaa !5
%6 = zext i32 %5 to i64
%vla2 = alloca i32, i64 %6, align 16
%7 = load i32, ptr %a, align 4, !tbaa !5
%cmp130 = icmp sgt i32 %7, 0
br i1 %cmp130, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %7 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %10, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @compare) #8
%8 = load i32, ptr %b, align 4, !tbaa !5
%cmp6132 = icmp sgt i32 %8, 0
br i1 %cmp6132, label %for.body9, label %for.cond.cleanup.for.cond.cleanup8_crit_edge
for.cond.cleanup.for.cond.cleanup8_crit_edge: ; preds = %for.cond.cleanup
%.pre180 = sext i32 %8 to i64
br label %for.cond.cleanup8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = load i32, ptr %a, 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 !9
for.cond.cleanup8: ; preds = %for.body9, %for.cond.cleanup.for.cond.cleanup8_crit_edge
%conv16.pre-phi = phi i64 [ %.pre180, %for.cond.cleanup.for.cond.cleanup8_crit_edge ], [ %13, %for.body9 ]
call void @qsort(ptr noundef nonnull %vla1, i64 noundef %conv16.pre-phi, i64 noundef 4, ptr noundef nonnull @compare) #8
%11 = load i32, ptr %c, align 4, !tbaa !5
%cmp19135 = icmp sgt i32 %11, 0
br i1 %cmp19135, label %for.body22, label %for.cond.cleanup8.for.cond.cleanup21_crit_edge
for.cond.cleanup8.for.cond.cleanup21_crit_edge: ; preds = %for.cond.cleanup8
%.pre181 = sext i32 %11 to i64
br label %for.cond.cleanup21
for.body9: ; preds = %for.cond.cleanup, %for.body9
%indvars.iv154 = phi i64 [ %indvars.iv.next155, %for.body9 ], [ 0, %for.cond.cleanup ]
%arrayidx11 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv154
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx11)
%indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
%12 = load i32, ptr %b, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp6 = icmp slt i64 %indvars.iv.next155, %13
br i1 %cmp6, label %for.body9, label %for.cond.cleanup8, !llvm.loop !11
for.cond.cleanup21: ; preds = %for.body22, %for.cond.cleanup8.for.cond.cleanup21_crit_edge
%conv29.pre-phi = phi i64 [ %.pre181, %for.cond.cleanup8.for.cond.cleanup21_crit_edge ], [ %20, %for.body22 ]
call void @qsort(ptr noundef nonnull %vla2, i64 noundef %conv29.pre-phi, i64 noundef 4, ptr noundef nonnull @compare) #8
%14 = load i32, ptr %x, align 4, !tbaa !5
%15 = load i32, ptr %y, align 4, !tbaa !5
%add = add nsw i32 %15, %14
%16 = zext i32 %add to i64
%vla30 = alloca i32, i64 %16, align 16
%cmp33138 = icmp sgt i32 %14, 0
br i1 %cmp33138, label %for.body36.preheader, label %for.cond45.preheader
for.body36.preheader: ; preds = %for.cond.cleanup21
%17 = zext i32 %14 to i64
%18 = shl nuw nsw i64 %17, 2
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %vla30, ptr nonnull align 16 %vla, i64 %18, i1 false), !tbaa !5
br label %for.cond45.preheader
for.body22: ; preds = %for.cond.cleanup8, %for.body22
%indvars.iv157 = phi i64 [ %indvars.iv.next158, %for.body22 ], [ 0, %for.cond.cleanup8 ]
%arrayidx24 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv157
%call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx24)
%indvars.iv.next158 = add nuw nsw i64 %indvars.iv157, 1
%19 = load i32, ptr %c, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp19 = icmp slt i64 %indvars.iv.next158, %20
br i1 %cmp19, label %for.body22, label %for.cond.cleanup21, !llvm.loop !12
for.cond45.preheader: ; preds = %for.body36.preheader, %for.cond.cleanup21
%cmp46140 = icmp sgt i32 %15, 0
br i1 %cmp46140, label %for.body49.preheader, label %for.cond.cleanup48
for.body49.preheader: ; preds = %for.cond45.preheader
%21 = sext i32 %14 to i64
%22 = shl nsw i64 %21, 2
%scevgep = getelementptr i8, ptr %vla30, i64 %22
%23 = zext i32 %15 to i64
%24 = shl nuw nsw i64 %23, 2
call void @llvm.memcpy.p0.p0.i64(ptr align 4 %scevgep, ptr nonnull align 16 %vla1, i64 %24, i1 false), !tbaa !5
br label %for.cond.cleanup48
for.cond.cleanup48: ; preds = %for.body49.preheader, %for.cond45.preheader
%conv59 = sext i32 %add to i64
call void @qsort(ptr noundef nonnull %vla30, i64 noundef %conv59, i64 noundef 4, ptr noundef nonnull @compare) #8
%25 = load i32, ptr %x, align 4, !tbaa !5
%26 = load i32, ptr %y, align 4, !tbaa !5
%add61 = add nsw i32 %26, %25
%cmp63143 = icmp sgt i32 %add61, 0
br i1 %cmp63143, label %for.body66.preheader, label %for.cond.cleanup85
for.body66.preheader: ; preds = %for.cond.cleanup48
%27 = zext i32 %add61 to i64
br label %for.body66
for.body66: ; preds = %for.body66.preheader, %if.then
%indvars.iv169 = phi i64 [ 0, %for.body66.preheader ], [ %indvars.iv.next170, %if.then ]
%indvars.iv167 = phi i64 [ %27, %for.body66.preheader ], [ %indvars.iv.next168, %if.then ]
%indvars.iv.next168 = add nsw i64 %indvars.iv167, -1
%idxprom67 = and i64 %indvars.iv.next168, 4294967295
%arrayidx68 = getelementptr inbounds i32, ptr %vla30, i64 %idxprom67
%28 = load i32, ptr %arrayidx68, align 4, !tbaa !5
%arrayidx70 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv169
%29 = load i32, ptr %arrayidx70, align 4, !tbaa !5
%cmp71 = icmp slt i32 %28, %29
br i1 %cmp71, label %if.then, label %cleanup
if.then: ; preds = %for.body66
store i32 %29, ptr %arrayidx68, align 4, !tbaa !5
%indvars.iv.next170 = add nuw nsw i64 %indvars.iv169, 1
%exitcond.not = icmp eq i64 %indvars.iv.next170, %27
br i1 %exitcond.not, label %cleanup, label %for.body66, !llvm.loop !13
cleanup: ; preds = %if.then, %for.body66
br i1 %cmp63143, label %for.body86.preheader, label %for.cond.cleanup85
for.body86.preheader: ; preds = %cleanup
%wide.trip.count178 = zext i32 %add61 to i64
%min.iters.check = icmp ult i32 %add61, 4
br i1 %min.iters.check, label %for.body86.preheader188, label %vector.ph
vector.ph: ; preds = %for.body86.preheader
%n.vec = and i64 %27, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %34, %vector.body ]
%vec.phi186 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %35, %vector.body ]
%30 = getelementptr inbounds i32, ptr %vla30, i64 %index
%wide.load = load <2 x i32>, ptr %30, align 16, !tbaa !5
%31 = getelementptr inbounds i32, ptr %30, i64 2
%wide.load187 = load <2 x i32>, ptr %31, align 8, !tbaa !5
%32 = sext <2 x i32> %wide.load to <2 x i64>
%33 = sext <2 x i32> %wide.load187 to <2 x i64>
%34 = add <2 x i64> %vec.phi, %32
%35 = add <2 x i64> %vec.phi186, %33
%index.next = add nuw i64 %index, 4
%36 = icmp eq i64 %index.next, %n.vec
br i1 %36, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %35, %34
%37 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %27
br i1 %cmp.n, label %for.cond.cleanup85, label %for.body86.preheader188
for.body86.preheader188: ; preds = %for.body86.preheader, %middle.block
%indvars.iv174.ph = phi i64 [ 0, %for.body86.preheader ], [ %n.vec, %middle.block ]
%ans.0147.ph = phi i64 [ 0, %for.body86.preheader ], [ %37, %middle.block ]
br label %for.body86
for.cond.cleanup85: ; preds = %for.body86, %middle.block, %for.cond.cleanup48, %cleanup
%ans.0.lcssa = phi i64 [ 0, %cleanup ], [ 0, %for.cond.cleanup48 ], [ %37, %middle.block ], [ %add90, %for.body86 ]
%call95 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #8
ret i32 0
for.body86: ; preds = %for.body86.preheader188, %for.body86
%indvars.iv174 = phi i64 [ %indvars.iv.next175, %for.body86 ], [ %indvars.iv174.ph, %for.body86.preheader188 ]
%ans.0147 = phi i64 [ %add90, %for.body86 ], [ %ans.0147.ph, %for.body86.preheader188 ]
%arrayidx88 = getelementptr inbounds i32, ptr %vla30, i64 %indvars.iv174
%38 = load i32, ptr %arrayidx88, align 4, !tbaa !5
%conv89 = sext i32 %38 to i64
%add90 = add nsw i64 %ans.0147, %conv89
%indvars.iv.next175 = add nuw nsw i64 %indvars.iv174, 1
%exitcond179.not = icmp eq i64 %indvars.iv.next175, %wide.trip.count178
br i1 %exitcond179.not, label %for.cond.cleanup85, label %for.body86, !llvm.loop !17
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: 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 #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #7
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10, !16, !15}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define ll long long
int comp(const void *a, const void *b) //昇順
{
return *(ll *)a - *(ll *)b;
}
int compr(const void *a, const void *b) //降順
{
return *(ll *)b - *(ll *)a;
}
int main(void)
{
ll p[120000] = {0};
ll q[120000] = {0};
ll r[120000] = {0};
int X, Y, A, B, C;
int n, m, i;
ll max = 0, t;
scanf("%d%d%d%d%d", &X, &Y, &A, &B, &C);
for (i = 0; i < A; i++)
{
scanf("%lld", &t);
p[i] = t;
}
for (i = 0; i < B; i++)
{
scanf("%lld", &t);
q[i] = t;
}
for (i = 0; i < C; i++)
{
scanf("%lld", &t);
r[i] = t;
}
qsort(p, A, sizeof(ll), compr);
qsort(q, B, sizeof(ll), compr);
qsort(r, C, sizeof(ll), compr);
int x = X - 1;
int y = Y - 1;
int j = 0;
while (j < C)
{
if (x >= 0 && y >= 0 && p[x] < r[j] && q[y] < r[j])
{
if (p[x] < q[y])
{
x--;
}
else
{
y--;
}
}
else if (x >= 0 && p[x] < r[j])
{
x--;
}
else if (y >= 0 && q[y] < r[j])
{
y--;
}
else
{
break;
}
j++;
}
/*
while (j < C)
{
if ((p[x] < q[y]) && (p[x] < r[j]) && x >= 0)
{
//p[x] = r[j];
x--;
}
else if ((p[x] > q[y]) && (q[y] < r[j]) && y >= 0)
{
//q[y] = r[j];
y--;
}
else
{
break;
}
j++;
}*/
for (i = 0; i <= x; i++)
{
max += p[i];
}
for (i = 0; i <= y; i++)
{
max += q[i];
}
for (i = 0; i < j; i++)
{
max += r[i];
}
printf("%lld\n", max);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324771/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324771/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [11 x i8] c"%d%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: 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) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compr(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%p = alloca [120000 x i64], align 16
%q = alloca [120000 x i64], align 16
%r = alloca [120000 x i64], align 16
%X = alloca i32, align 4
%Y = alloca i32, align 4
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
%t = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 960000, ptr nonnull %p) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(960000) %p, i8 0, i64 960000, i1 false)
call void @llvm.lifetime.start.p0(i64 960000, ptr nonnull %q) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(960000) %q, i8 0, i64 960000, i1 false)
call void @llvm.lifetime.start.p0(i64 960000, ptr nonnull %r) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(960000) %r, i8 0, i64 960000, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Y) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X, ptr noundef nonnull %Y, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %C)
%0 = load i32, ptr %A, align 4, !tbaa !9
%cmp154 = icmp sgt i32 %0, 0
br i1 %cmp154, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%1 = load i32, ptr %B, align 4, !tbaa !9
%cmp3156 = icmp sgt i32 %1, 0
br i1 %cmp3156, label %for.body4, label %for.cond11.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t)
%2 = load i64, ptr %t, align 8, !tbaa !5
%arrayidx = getelementptr inbounds [120000 x i64], ptr %p, i64 0, i64 %indvars.iv
store i64 %2, ptr %arrayidx, align 8, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %A, align 4, !tbaa !9
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !11
for.cond11.preheader: ; preds = %for.body4, %for.cond2.preheader
%5 = load i32, ptr %C, align 4, !tbaa !9
%cmp12158 = icmp sgt i32 %5, 0
br i1 %cmp12158, label %for.body13, label %for.end19
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv185 = phi i64 [ %indvars.iv.next186, %for.body4 ], [ 0, %for.cond2.preheader ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t)
%6 = load i64, ptr %t, align 8, !tbaa !5
%arrayidx7 = getelementptr inbounds [120000 x i64], ptr %q, i64 0, i64 %indvars.iv185
store i64 %6, ptr %arrayidx7, align 8, !tbaa !5
%indvars.iv.next186 = add nuw nsw i64 %indvars.iv185, 1
%7 = load i32, ptr %B, align 4, !tbaa !9
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next186, %8
br i1 %cmp3, label %for.body4, label %for.cond11.preheader, !llvm.loop !13
for.body13: ; preds = %for.cond11.preheader, %for.body13
%indvars.iv188 = phi i64 [ %indvars.iv.next189, %for.body13 ], [ 0, %for.cond11.preheader ]
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t)
%9 = load i64, ptr %t, align 8, !tbaa !5
%arrayidx16 = getelementptr inbounds [120000 x i64], ptr %r, i64 0, i64 %indvars.iv188
store i64 %9, ptr %arrayidx16, align 8, !tbaa !5
%indvars.iv.next189 = add nuw nsw i64 %indvars.iv188, 1
%10 = load i32, ptr %C, align 4, !tbaa !9
%11 = sext i32 %10 to i64
%cmp12 = icmp slt i64 %indvars.iv.next189, %11
br i1 %cmp12, label %for.body13, label %for.end19, !llvm.loop !14
for.end19: ; preds = %for.body13, %for.cond11.preheader
%12 = load i32, ptr %A, align 4, !tbaa !9
%conv = sext i32 %12 to i64
call void @qsort(ptr noundef nonnull %p, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @compr) #7
%13 = load i32, ptr %B, align 4, !tbaa !9
%conv21 = sext i32 %13 to i64
call void @qsort(ptr noundef nonnull %q, i64 noundef %conv21, i64 noundef 8, ptr noundef nonnull @compr) #7
%14 = load i32, ptr %C, align 4, !tbaa !9
%conv23 = sext i32 %14 to i64
call void @qsort(ptr noundef nonnull %r, i64 noundef %conv23, i64 noundef 8, ptr noundef nonnull @compr) #7
%15 = load i32, ptr %X, align 4, !tbaa !9
%sub = add nsw i32 %15, -1
%16 = load i32, ptr %Y, align 4, !tbaa !9
%sub24 = add nsw i32 %16, -1
%17 = load i32, ptr %C, align 4, !tbaa !9
%cmp25160 = icmp sgt i32 %17, 0
br i1 %cmp25160, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %for.end19
%wide.trip.count = zext i32 %17 to i64
br label %while.body
while.body: ; preds = %while.body.preheader, %if.end80
%indvars.iv191 = phi i64 [ 0, %while.body.preheader ], [ %indvars.iv.next192, %if.end80 ]
%y.0162 = phi i32 [ %sub24, %while.body.preheader ], [ %y.1, %if.end80 ]
%x.0161 = phi i32 [ %sub, %while.body.preheader ], [ %x.1, %if.end80 ]
%cmp27 = icmp sgt i32 %x.0161, -1
%cmp29 = icmp sgt i32 %y.0162, -1
%or.cond = select i1 %cmp27, i1 %cmp29, i1 false
br i1 %or.cond, label %land.lhs.true31, label %if.else53
land.lhs.true31: ; preds = %while.body
%idxprom32 = zext i32 %x.0161 to i64
%arrayidx33 = getelementptr inbounds [120000 x i64], ptr %p, i64 0, i64 %idxprom32
%18 = load i64, ptr %arrayidx33, align 8, !tbaa !5
%arrayidx35 = getelementptr inbounds [120000 x i64], ptr %r, i64 0, i64 %indvars.iv191
%19 = load i64, ptr %arrayidx35, align 8, !tbaa !5
%cmp36 = icmp slt i64 %18, %19
br i1 %cmp36, label %land.lhs.true38, label %land.lhs.true56
land.lhs.true38: ; preds = %land.lhs.true31
%idxprom39 = zext i32 %y.0162 to i64
%arrayidx40 = getelementptr inbounds [120000 x i64], ptr %q, i64 0, i64 %idxprom39
%20 = load i64, ptr %arrayidx40, align 8, !tbaa !5
%cmp43 = icmp slt i64 %20, %19
br i1 %cmp43, label %if.then, label %land.lhs.true56
if.then: ; preds = %land.lhs.true38
%cmp49 = icmp slt i64 %18, %20
br i1 %cmp49, label %if.then51, label %if.else
if.then51: ; preds = %if.then
%dec = add nsw i32 %x.0161, -1
br label %if.end80
if.else: ; preds = %if.then
%dec52 = add nsw i32 %y.0162, -1
br label %if.end80
if.else53: ; preds = %while.body
br i1 %cmp27, label %if.else53.land.lhs.true56_crit_edge, label %if.else65
if.else53.land.lhs.true56_crit_edge: ; preds = %if.else53
%idxprom57.phi.trans.insert = zext i32 %x.0161 to i64
%arrayidx58.phi.trans.insert = getelementptr inbounds [120000 x i64], ptr %p, i64 0, i64 %idxprom57.phi.trans.insert
%.pre = load i64, ptr %arrayidx58.phi.trans.insert, align 8, !tbaa !5
%arrayidx60.phi.trans.insert = getelementptr inbounds [120000 x i64], ptr %r, i64 0, i64 %indvars.iv191
%.pre209 = load i64, ptr %arrayidx60.phi.trans.insert, align 8, !tbaa !5
br label %land.lhs.true56
land.lhs.true56: ; preds = %if.else53.land.lhs.true56_crit_edge, %land.lhs.true31, %land.lhs.true38
%21 = phi i64 [ %.pre209, %if.else53.land.lhs.true56_crit_edge ], [ %19, %land.lhs.true31 ], [ %19, %land.lhs.true38 ]
%22 = phi i64 [ %.pre, %if.else53.land.lhs.true56_crit_edge ], [ %18, %land.lhs.true31 ], [ %18, %land.lhs.true38 ]
%cmp61 = icmp slt i64 %22, %21
br i1 %cmp61, label %if.then63, label %if.else65
if.then63: ; preds = %land.lhs.true56
%dec64 = add nsw i32 %x.0161, -1
br label %if.end80
if.else65: ; preds = %land.lhs.true56, %if.else53
br i1 %cmp29, label %land.lhs.true68, label %while.end.loopexit.split.loop.exit
land.lhs.true68: ; preds = %if.else65
%idxprom69 = zext i32 %y.0162 to i64
%arrayidx70 = getelementptr inbounds [120000 x i64], ptr %q, i64 0, i64 %idxprom69
%23 = load i64, ptr %arrayidx70, align 8, !tbaa !5
%arrayidx72 = getelementptr inbounds [120000 x i64], ptr %r, i64 0, i64 %indvars.iv191
%24 = load i64, ptr %arrayidx72, align 8, !tbaa !5
%cmp73 = icmp slt i64 %23, %24
br i1 %cmp73, label %if.then75, label %while.end.loopexit.split.loop.exit210
if.then75: ; preds = %land.lhs.true68
%dec76 = add nsw i32 %y.0162, -1
br label %if.end80
if.end80: ; preds = %if.then63, %if.then75, %if.then51, %if.else
%x.1 = phi i32 [ %dec, %if.then51 ], [ %x.0161, %if.else ], [ %dec64, %if.then63 ], [ %x.0161, %if.then75 ]
%y.1 = phi i32 [ %y.0162, %if.then51 ], [ %dec52, %if.else ], [ %y.0162, %if.then63 ], [ %dec76, %if.then75 ]
%indvars.iv.next192 = add nuw nsw i64 %indvars.iv191, 1
%exitcond.not = icmp eq i64 %indvars.iv.next192, %wide.trip.count
br i1 %exitcond.not, label %while.end, label %while.body, !llvm.loop !15
while.end.loopexit.split.loop.exit: ; preds = %if.else65
%25 = trunc i64 %indvars.iv191 to i32
br label %while.end
while.end.loopexit.split.loop.exit210: ; preds = %land.lhs.true68
%26 = trunc i64 %indvars.iv191 to i32
br label %while.end
while.end: ; preds = %if.end80, %while.end.loopexit.split.loop.exit, %while.end.loopexit.split.loop.exit210, %for.end19
%x.0.lcssa = phi i32 [ %sub, %for.end19 ], [ %x.0161, %while.end.loopexit.split.loop.exit ], [ %x.0161, %while.end.loopexit.split.loop.exit210 ], [ %x.1, %if.end80 ]
%y.0.lcssa = phi i32 [ %sub24, %for.end19 ], [ %y.0162, %while.end.loopexit.split.loop.exit ], [ %y.0162, %while.end.loopexit.split.loop.exit210 ], [ %y.1, %if.end80 ]
%j.0.lcssa = phi i32 [ 0, %for.end19 ], [ %25, %while.end.loopexit.split.loop.exit ], [ %26, %while.end.loopexit.split.loop.exit210 ], [ %17, %if.end80 ]
%cmp83.not172 = icmp slt i32 %x.0.lcssa, 0
br i1 %cmp83.not172, label %for.cond91.preheader, label %for.body85.preheader
for.body85.preheader: ; preds = %while.end
%27 = add nuw i32 %x.0.lcssa, 1
%wide.trip.count197 = zext i32 %27 to i64
%min.iters.check = icmp ult i32 %x.0.lcssa, 3
br i1 %min.iters.check, label %for.body85.preheader266, label %vector.ph
vector.ph: ; preds = %for.body85.preheader
%n.vec = and i64 %wide.trip.count197, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %30, %vector.body ]
%vec.phi225 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %31, %vector.body ]
%28 = getelementptr inbounds [120000 x i64], ptr %p, i64 0, i64 %index
%wide.load = load <2 x i64>, ptr %28, align 16, !tbaa !5
%29 = getelementptr inbounds i64, ptr %28, i64 2
%wide.load226 = load <2 x i64>, ptr %29, align 16, !tbaa !5
%30 = add <2 x i64> %wide.load, %vec.phi
%31 = add <2 x i64> %wide.load226, %vec.phi225
%index.next = add nuw i64 %index, 4
%32 = icmp eq i64 %index.next, %n.vec
br i1 %32, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %31, %30
%33 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count197
br i1 %cmp.n, label %for.cond91.preheader, label %for.body85.preheader266
for.body85.preheader266: ; preds = %for.body85.preheader, %middle.block
%indvars.iv194.ph = phi i64 [ 0, %for.body85.preheader ], [ %n.vec, %middle.block ]
%max.0174.ph = phi i64 [ 0, %for.body85.preheader ], [ %33, %middle.block ]
br label %for.body85
for.cond91.preheader: ; preds = %for.body85, %middle.block, %while.end
%max.0.lcssa = phi i64 [ 0, %while.end ], [ %33, %middle.block ], [ %add, %for.body85 ]
%cmp92.not176 = icmp slt i32 %y.0.lcssa, 0
br i1 %cmp92.not176, label %for.cond101.preheader, label %for.body94.preheader
for.body94.preheader: ; preds = %for.cond91.preheader
%34 = add nuw i32 %y.0.lcssa, 1
%wide.trip.count202 = zext i32 %34 to i64
%min.iters.check229 = icmp ult i32 %y.0.lcssa, 3
br i1 %min.iters.check229, label %for.body94.preheader263, label %vector.ph230
vector.ph230: ; preds = %for.body94.preheader
%n.vec232 = and i64 %wide.trip.count202, 4294967292
%35 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %max.0.lcssa, i64 0
br label %vector.body235
vector.body235: ; preds = %vector.body235, %vector.ph230
%index236 = phi i64 [ 0, %vector.ph230 ], [ %index.next241, %vector.body235 ]
%vec.phi237 = phi <2 x i64> [ %35, %vector.ph230 ], [ %38, %vector.body235 ]
%vec.phi238 = phi <2 x i64> [ zeroinitializer, %vector.ph230 ], [ %39, %vector.body235 ]
%36 = getelementptr inbounds [120000 x i64], ptr %q, i64 0, i64 %index236
%wide.load239 = load <2 x i64>, ptr %36, align 16, !tbaa !5
%37 = getelementptr inbounds i64, ptr %36, i64 2
%wide.load240 = load <2 x i64>, ptr %37, align 16, !tbaa !5
%38 = add <2 x i64> %wide.load239, %vec.phi237
%39 = add <2 x i64> %wide.load240, %vec.phi238
%index.next241 = add nuw i64 %index236, 4
%40 = icmp eq i64 %index.next241, %n.vec232
br i1 %40, label %middle.block227, label %vector.body235, !llvm.loop !19
middle.block227: ; preds = %vector.body235
%bin.rdx242 = add <2 x i64> %39, %38
%41 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx242)
%cmp.n234 = icmp eq i64 %n.vec232, %wide.trip.count202
br i1 %cmp.n234, label %for.cond101.preheader, label %for.body94.preheader263
for.body94.preheader263: ; preds = %for.body94.preheader, %middle.block227
%indvars.iv199.ph = phi i64 [ 0, %for.body94.preheader ], [ %n.vec232, %middle.block227 ]
%max.1178.ph = phi i64 [ %max.0.lcssa, %for.body94.preheader ], [ %41, %middle.block227 ]
br label %for.body94
for.body85: ; preds = %for.body85.preheader266, %for.body85
%indvars.iv194 = phi i64 [ %indvars.iv.next195, %for.body85 ], [ %indvars.iv194.ph, %for.body85.preheader266 ]
%max.0174 = phi i64 [ %add, %for.body85 ], [ %max.0174.ph, %for.body85.preheader266 ]
%arrayidx87 = getelementptr inbounds [120000 x i64], ptr %p, i64 0, i64 %indvars.iv194
%42 = load i64, ptr %arrayidx87, align 8, !tbaa !5
%add = add nsw i64 %42, %max.0174
%indvars.iv.next195 = add nuw nsw i64 %indvars.iv194, 1
%exitcond198.not = icmp eq i64 %indvars.iv.next195, %wide.trip.count197
br i1 %exitcond198.not, label %for.cond91.preheader, label %for.body85, !llvm.loop !20
for.cond101.preheader: ; preds = %for.body94, %middle.block227, %for.cond91.preheader
%max.1.lcssa = phi i64 [ %max.0.lcssa, %for.cond91.preheader ], [ %41, %middle.block227 ], [ %add97, %for.body94 ]
%cmp102180.not = icmp eq i32 %j.0.lcssa, 0
br i1 %cmp102180.not, label %for.end110, label %for.body104.preheader
for.body104.preheader: ; preds = %for.cond101.preheader
%wide.trip.count207 = zext i32 %j.0.lcssa to i64
%min.iters.check246 = icmp ult i32 %j.0.lcssa, 4
br i1 %min.iters.check246, label %for.body104.preheader261, label %vector.ph247
vector.ph247: ; preds = %for.body104.preheader
%n.vec249 = and i64 %wide.trip.count207, 4294967292
%43 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %max.1.lcssa, i64 0
br label %vector.body252
vector.body252: ; preds = %vector.body252, %vector.ph247
%index253 = phi i64 [ 0, %vector.ph247 ], [ %index.next258, %vector.body252 ]
%vec.phi254 = phi <2 x i64> [ %43, %vector.ph247 ], [ %46, %vector.body252 ]
%vec.phi255 = phi <2 x i64> [ zeroinitializer, %vector.ph247 ], [ %47, %vector.body252 ]
%44 = getelementptr inbounds [120000 x i64], ptr %r, i64 0, i64 %index253
%wide.load256 = load <2 x i64>, ptr %44, align 16, !tbaa !5
%45 = getelementptr inbounds i64, ptr %44, i64 2
%wide.load257 = load <2 x i64>, ptr %45, align 16, !tbaa !5
%46 = add <2 x i64> %wide.load256, %vec.phi254
%47 = add <2 x i64> %wide.load257, %vec.phi255
%index.next258 = add nuw i64 %index253, 4
%48 = icmp eq i64 %index.next258, %n.vec249
br i1 %48, label %middle.block244, label %vector.body252, !llvm.loop !21
middle.block244: ; preds = %vector.body252
%bin.rdx259 = add <2 x i64> %47, %46
%49 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx259)
%cmp.n251 = icmp eq i64 %n.vec249, %wide.trip.count207
br i1 %cmp.n251, label %for.end110, label %for.body104.preheader261
for.body104.preheader261: ; preds = %for.body104.preheader, %middle.block244
%indvars.iv204.ph = phi i64 [ 0, %for.body104.preheader ], [ %n.vec249, %middle.block244 ]
%max.2182.ph = phi i64 [ %max.1.lcssa, %for.body104.preheader ], [ %49, %middle.block244 ]
br label %for.body104
for.body94: ; preds = %for.body94.preheader263, %for.body94
%indvars.iv199 = phi i64 [ %indvars.iv.next200, %for.body94 ], [ %indvars.iv199.ph, %for.body94.preheader263 ]
%max.1178 = phi i64 [ %add97, %for.body94 ], [ %max.1178.ph, %for.body94.preheader263 ]
%arrayidx96 = getelementptr inbounds [120000 x i64], ptr %q, i64 0, i64 %indvars.iv199
%50 = load i64, ptr %arrayidx96, align 8, !tbaa !5
%add97 = add nsw i64 %50, %max.1178
%indvars.iv.next200 = add nuw nsw i64 %indvars.iv199, 1
%exitcond203.not = icmp eq i64 %indvars.iv.next200, %wide.trip.count202
br i1 %exitcond203.not, label %for.cond101.preheader, label %for.body94, !llvm.loop !22
for.body104: ; preds = %for.body104.preheader261, %for.body104
%indvars.iv204 = phi i64 [ %indvars.iv.next205, %for.body104 ], [ %indvars.iv204.ph, %for.body104.preheader261 ]
%max.2182 = phi i64 [ %add107, %for.body104 ], [ %max.2182.ph, %for.body104.preheader261 ]
%arrayidx106 = getelementptr inbounds [120000 x i64], ptr %r, i64 0, i64 %indvars.iv204
%51 = load i64, ptr %arrayidx106, align 8, !tbaa !5
%add107 = add nsw i64 %51, %max.2182
%indvars.iv.next205 = add nuw nsw i64 %indvars.iv204, 1
%exitcond208.not = icmp eq i64 %indvars.iv.next205, %wide.trip.count207
br i1 %exitcond208.not, label %for.end110, label %for.body104, !llvm.loop !23
for.end110: ; preds = %for.body104, %middle.block244, %for.cond101.preheader
%max.2.lcssa = phi i64 [ %max.1.lcssa, %for.cond101.preheader ], [ %49, %middle.block244 ], [ %add107, %for.body104 ]
%call111 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %max.2.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %C) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Y) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #7
call void @llvm.lifetime.end.p0(i64 960000, ptr nonnull %r) #7
call void @llvm.lifetime.end.p0(i64 960000, ptr nonnull %q) #7
call void @llvm.lifetime.end.p0(i64 960000, ptr nonnull %p) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12, !17, !18}
!17 = !{!"llvm.loop.isvectorized", i32 1}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = distinct !{!19, !12, !17, !18}
!20 = distinct !{!20, !12, !18, !17}
!21 = distinct !{!21, !12, !17, !18}
!22 = distinct !{!22, !12, !18, !17}
!23 = distinct !{!23, !12, !18, !17}
|
#include <stdio.h>
#include <memory.h>
int main(void){
int n,m,p[100],d,v,i,sum;
while(1){
sum=0;
scanf("%d %d",&n,&m);
if(!n) break;
memset(p,0,sizeof(p));
for(i=0;i<n;i++){
scanf("%d %d",&d,&v);
if(p[d-1]<v){
p[d-1]=v;
}
}
for(i=0;i<m;i++)
sum+=p[i];
printf("%d\n",sum);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324821/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324821/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%n = alloca i32, align 4
%m = alloca i32, align 4
%p = alloca [100 x i32], align 16
%d = alloca i32, align 4
%v = 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 400, ptr nonnull %p) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not28 = icmp eq i32 %0, 0
br i1 %tobool.not28, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end15
%1 = phi i32 [ %14, %for.end15 ], [ %0, %entry ]
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %p, i8 0, i64 400, i1 false)
%cmp22 = icmp sgt i32 %1, 0
br i1 %cmp22, label %for.body, label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.body, %if.end
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp924 = icmp sgt i32 %2, 0
br i1 %cmp924, label %for.body10.preheader, label %for.end15
for.body10.preheader: ; preds = %for.cond8.preheader
%wide.trip.count = zext i32 %2 to i64
%min.iters.check = icmp ult i32 %2, 8
br i1 %min.iters.check, label %for.body10.preheader32, label %vector.ph
vector.ph: ; preds = %for.body10.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %5, %vector.body ]
%vec.phi30 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%3 = getelementptr inbounds [100 x i32], ptr %p, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
%wide.load31 = load <4 x i32>, ptr %4, align 16, !tbaa !5
%5 = add <4 x i32> %wide.load, %vec.phi
%6 = add <4 x i32> %wide.load31, %vec.phi30
%index.next = add nuw i64 %index, 8
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %6, %5
%8 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end15, label %for.body10.preheader32
for.body10.preheader32: ; preds = %for.body10.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body10.preheader ], [ %n.vec, %middle.block ]
%sum.026.ph = phi i32 [ 0, %for.body10.preheader ], [ %8, %middle.block ]
br label %for.body10
for.body: ; preds = %if.end, %for.body
%i.023 = phi i32 [ %inc, %for.body ], [ 0, %if.end ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d, ptr noundef nonnull %v)
%9 = load i32, ptr %d, align 4, !tbaa !5
%sub = add nsw i32 %9, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr %p, i64 0, i64 %idxprom
%10 = load i32, ptr %arrayidx, align 4, !tbaa !5
%11 = load i32, ptr %v, align 4, !tbaa !5
%spec.store.select = call i32 @llvm.smax.i32(i32 %10, i32 %11)
store i32 %spec.store.select, ptr %arrayidx, align 4
%inc = add nuw nsw i32 %i.023, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %12
br i1 %cmp, label %for.body, label %for.cond8.preheader, !llvm.loop !13
for.body10: ; preds = %for.body10.preheader32, %for.body10
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body10 ], [ %indvars.iv.ph, %for.body10.preheader32 ]
%sum.026 = phi i32 [ %add, %for.body10 ], [ %sum.026.ph, %for.body10.preheader32 ]
%arrayidx12 = getelementptr inbounds [100 x i32], ptr %p, i64 0, i64 %indvars.iv
%13 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%add = add nsw i32 %13, %sum.026
%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.end15, label %for.body10, !llvm.loop !14
for.end15: ; preds = %for.body10, %middle.block, %for.cond8.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond8.preheader ], [ %8, %middle.block ], [ %add, %for.body10 ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%14 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %14, 0
br i1 %tobool.not, label %while.end, label %if.end
while.end: ; preds = %for.end15, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %p) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
|
#include <stdio.h>
int main()
{
int n;
scanf("%d", &n);
int A[10000];
int i, lop, cnt = 0;
for(i = 0; i < n; i++){
scanf("%d", &A[i]);
}
do{
lop = 0;
for(i = 0; i < n; i++){
if(A[i] % 2 == 0){
A[i] /= 2;
cnt++;
lop = 1;
}
else{
A[i] *= 3;
}
}
}while(lop);
printf("%d\n", cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324865/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324865/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%A = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %A) #3
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %0, 0
br i1 %cmp25, label %for.body, label %do.end
do.body.preheader: ; preds = %for.body
%cmp327 = icmp sgt i32 %3, 0
br i1 %cmp327, label %do.body.us.preheader, label %do.end
do.body.us.preheader: ; preds = %do.body.preheader
%wide.trip.count = zext i32 %3 to i64
br label %for.body4.us
for.body4.us: ; preds = %for.body4.us.backedge, %do.body.us.preheader
%indvars.iv35 = phi i64 [ 0, %do.body.us.preheader ], [ %indvars.iv35.be, %for.body4.us.backedge ]
%cnt.130.us = phi i32 [ 0, %do.body.us.preheader ], [ %cnt.2.us, %for.body4.us.backedge ]
%lop.029.us = phi i32 [ 0, %do.body.us.preheader ], [ %lop.029.us.be, %for.body4.us.backedge ]
%arrayidx6.us = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv35
%1 = load i32, ptr %arrayidx6.us, align 4, !tbaa !5
%2 = and i32 %1, 1
%cmp7.us = icmp eq i32 %2, 0
br i1 %cmp7.us, label %if.then.us, label %if.else.us
if.else.us: ; preds = %for.body4.us
%mul.us = mul nsw i32 %1, 3
br label %for.inc13.us
if.then.us: ; preds = %for.body4.us
%div.us = sdiv i32 %1, 2
%inc10.us = add nsw i32 %cnt.130.us, 1
br label %for.inc13.us
for.inc13.us: ; preds = %if.then.us, %if.else.us
%mul.us.sink = phi i32 [ %div.us, %if.then.us ], [ %mul.us, %if.else.us ]
%lop.1.us = phi i32 [ 1, %if.then.us ], [ %lop.029.us, %if.else.us ]
%cnt.2.us = phi i32 [ %inc10.us, %if.then.us ], [ %cnt.130.us, %if.else.us ]
store i32 %mul.us.sink, ptr %arrayidx6.us, align 4
%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.cond2.do.cond_crit_edge.us, label %for.body4.us.backedge
for.body4.us.backedge: ; preds = %for.inc13.us, %for.cond2.do.cond_crit_edge.us
%indvars.iv35.be = phi i64 [ %indvars.iv.next36, %for.inc13.us ], [ 0, %for.cond2.do.cond_crit_edge.us ]
%lop.029.us.be = phi i32 [ %lop.1.us, %for.inc13.us ], [ 0, %for.cond2.do.cond_crit_edge.us ]
br label %for.body4.us, !llvm.loop !9
for.cond2.do.cond_crit_edge.us: ; preds = %for.inc13.us
%tobool.not.us = icmp eq i32 %lop.1.us, 0
br i1 %tobool.not.us, label %do.end, label %for.body4.us.backedge
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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 %do.body.preheader, !llvm.loop !11
do.end: ; preds = %for.cond2.do.cond_crit_edge.us, %entry, %do.body.preheader
%.us-phi = phi i32 [ 0, %do.body.preheader ], [ 0, %entry ], [ %cnt.2.us, %for.cond2.do.cond_crit_edge.us ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.us-phi)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void){
int n;
scanf("%d",&n);
int anv[114514];
int i,count=0;
for(i=0;i<n;i++){
scanf("%d",&anv[i]);
while(anv[i]%2==0){
anv[i]/=2;
count++;
}
}
printf("%d",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324915/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324915/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%anv = alloca [114514 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 458056, ptr nonnull %anv) #3
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%count.020 = phi i32 [ %count.1.lcssa, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [114514 x i32], ptr %anv, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%arrayidx.promoted = load i32, ptr %arrayidx, align 4, !tbaa !5
%1 = and i32 %arrayidx.promoted, 1
%cmp415 = icmp eq i32 %1, 0
br i1 %cmp415, label %while.body, label %for.inc
while.body: ; preds = %for.body, %while.body
%count.117 = phi i32 [ %inc, %while.body ], [ %count.020, %for.body ]
%div1416 = phi i32 [ %div, %while.body ], [ %arrayidx.promoted, %for.body ]
%div = sdiv i32 %div1416, 2
%inc = add nsw i32 %count.117, 1
%2 = and i32 %div, 1
%cmp4 = icmp eq i32 %2, 0
br i1 %cmp4, label %while.body, label %while.cond.for.inc_crit_edge, !llvm.loop !9
while.cond.for.inc_crit_edge: ; preds = %while.body
store i32 %div, ptr %arrayidx, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %while.cond.for.inc_crit_edge, %for.body
%count.1.lcssa = phi i32 [ %inc, %while.cond.for.inc_crit_edge ], [ %count.020, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.inc, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %count.1.lcssa, %for.inc ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 458056, ptr nonnull %anv) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
// 内部定数
#define D_ARRAY_MAX 10000 // 最大配列数
// 内部変数 - テスト用
#ifdef D_TEST
static int siRes;
static FILE *szpFpT, *szpFpA;
#endif
// 実行メイン
int
fMain(
int piTNo // <I> テスト番号 1~
)
{
int i;
char lc1Buf[1024], lc1Out[1024];
// テストファイルオープン
#ifdef D_TEST
sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
szpFpT = fopen(lc1Buf, "r");
sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
szpFpA = fopen(lc1Buf, "r");
siRes = 0;
#endif
// 配列数取得
int liACnt;
#ifdef D_TEST
fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
sscanf(lc1Buf, "%d", &liACnt);
// 配列取得
int li1Array[D_ARRAY_MAX];
for (i = 0; i < liACnt; i++) {
#ifdef D_TEST
fscanf(szpFpT, "%d", &li1Array[i]);
#else
fscanf(stdin, "%d", &li1Array[i]);
#endif
}
#ifdef D_TEST
fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
// 割る回数取得
int liDCnt = 0;
for (i = 0; i < liACnt; i++) {
while (li1Array[i] % 2 == 0) {
li1Array[i] /= 2;
liDCnt++;
}
}
// 結果セット
sprintf(lc1Out, "%d\n", liDCnt);
// 結果表示
#ifdef D_TEST
fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
if (strcmp(lc1Buf, lc1Out)) {
siRes = -1;
}
#else
printf("%s", lc1Out);
#endif
// テストファイルクローズ
#ifdef D_TEST
fclose(szpFpT);
fclose(szpFpA);
#endif
// テスト結果
#ifdef D_TEST
if (siRes == 0) {
printf("OK %d\n", piTNo);
}
else {
printf("NG %d\n", piTNo);
}
#endif
return 0;
}
int
main()
{
#ifdef D_TEST
int i;
for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
fMain(i);
}
#else
fMain(0);
#endif
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_324966/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_324966/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [3 x i8] c"%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"%s\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @fMain(i32 %piTNo) local_unnamed_addr #0 {
entry:
%lc1Buf = alloca [1024 x i8], align 16
%lc1Out = alloca [1024 x i8], align 16
%liACnt = alloca i32, align 4
%li1Array = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %lc1Buf) #4
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %lc1Out) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %liACnt) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %lc1Buf, i32 noundef 1024, ptr noundef %0)
%call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %lc1Buf, ptr noundef nonnull @.str, ptr noundef nonnull %liACnt) #4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %li1Array) #4
%1 = load i32, ptr %liACnt, align 4, !tbaa !9
%cmp29 = icmp sgt i32 %1, 0
br i1 %cmp29, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%2 = load ptr, ptr @stdin, align 8, !tbaa !5
%arrayidx = getelementptr inbounds [10000 x i32], ptr %li1Array, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %2, ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) #4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %liACnt, align 4, !tbaa !9
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%5 = load ptr, ptr @stdin, align 8, !tbaa !5
%call5 = call ptr @fgets(ptr noundef nonnull %lc1Buf, i32 noundef 1024, ptr noundef %5)
%6 = load i32, ptr %liACnt, align 4, !tbaa !9
%cmp735 = icmp sgt i32 %6, 0
br i1 %cmp735, label %while.cond.preheader.preheader, label %for.end17
while.cond.preheader.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %6 to i64
br label %while.cond.preheader
while.cond.preheader: ; preds = %while.cond.preheader.preheader, %for.inc15
%indvars.iv40 = phi i64 [ 0, %while.cond.preheader.preheader ], [ %indvars.iv.next41, %for.inc15 ]
%liDCnt.037 = phi i32 [ 0, %while.cond.preheader.preheader ], [ %liDCnt.1.lcssa, %for.inc15 ]
%arrayidx10 = getelementptr inbounds [10000 x i32], ptr %li1Array, i64 0, i64 %indvars.iv40
%arrayidx10.promoted = load i32, ptr %arrayidx10, align 4, !tbaa !9
%7 = and i32 %arrayidx10.promoted, 1
%cmp1132 = icmp eq i32 %7, 0
br i1 %cmp1132, label %while.body, label %for.inc15
while.body: ; preds = %while.cond.preheader, %while.body
%liDCnt.134 = phi i32 [ %inc14, %while.body ], [ %liDCnt.037, %while.cond.preheader ]
%div3133 = phi i32 [ %div, %while.body ], [ %arrayidx10.promoted, %while.cond.preheader ]
%div = sdiv i32 %div3133, 2
%inc14 = add nsw i32 %liDCnt.134, 1
%8 = and i32 %div, 1
%cmp11 = icmp eq i32 %8, 0
br i1 %cmp11, label %while.body, label %while.cond.for.inc15_crit_edge, !llvm.loop !13
while.cond.for.inc15_crit_edge: ; preds = %while.body
store i32 %div, ptr %arrayidx10, align 4, !tbaa !9
br label %for.inc15
for.inc15: ; preds = %while.cond.for.inc15_crit_edge, %while.cond.preheader
%liDCnt.1.lcssa = phi i32 [ %inc14, %while.cond.for.inc15_crit_edge ], [ %liDCnt.037, %while.cond.preheader ]
%indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
%exitcond.not = icmp eq i64 %indvars.iv.next41, %wide.trip.count
br i1 %exitcond.not, label %for.end17, label %while.cond.preheader, !llvm.loop !14
for.end17: ; preds = %for.inc15, %for.end
%liDCnt.0.lcssa = phi i32 [ 0, %for.end ], [ %liDCnt.1.lcssa, %for.inc15 ]
%call19 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %lc1Out, ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %liDCnt.0.lcssa) #4
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %lc1Out)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %li1Array) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %liACnt) #4
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %lc1Out) #4
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %lc1Buf) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, 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: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 @fMain(i32 poison)
ret i32 0
}
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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
|
#include<stdio.h>
int main(){
int n, i, count=0;
fscanf(stdin, "%d", &n);
int a[n];
for(i=0; i<n; i++){
fscanf(stdin, "%d", &a[i]);
while(a[i]%2==0){
count++;
a[i] /= 2;
}
}
printf("%d\n", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325015/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325015/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str, ptr noundef nonnull %n) #5
%1 = load i32, ptr %n, align 4, !tbaa !9
%2 = zext i32 %1 to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %2, align 16
%4 = load i32, ptr %n, align 4, !tbaa !9
%cmp18 = icmp sgt i32 %4, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%count.019 = phi i32 [ %count.1.lcssa, %for.inc ], [ 0, %entry ]
%5 = load ptr, ptr @stdin, align 8, !tbaa !5
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %5, ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) #5
%arrayidx.promoted = load i32, ptr %arrayidx, align 4, !tbaa !9
%6 = and i32 %arrayidx.promoted, 1
%cmp415 = icmp eq i32 %6, 0
br i1 %cmp415, label %while.body, label %for.inc
while.body: ; preds = %for.body, %while.body
%count.117 = phi i32 [ %inc, %while.body ], [ %count.019, %for.body ]
%div1416 = phi i32 [ %div, %while.body ], [ %arrayidx.promoted, %for.body ]
%inc = add nsw i32 %count.117, 1
%div = sdiv i32 %div1416, 2
%7 = and i32 %div, 1
%cmp4 = icmp eq i32 %7, 0
br i1 %cmp4, label %while.body, label %while.cond.for.inc_crit_edge, !llvm.loop !11
while.cond.for.inc_crit_edge: ; preds = %while.body
store i32 %div, ptr %arrayidx, align 4, !tbaa !9
br label %for.inc
for.inc: ; preds = %while.cond.for.inc_crit_edge, %for.body
%count.1.lcssa = phi i32 [ %inc, %while.cond.for.inc_crit_edge ], [ %count.019, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %n, align 4, !tbaa !9
%9 = sext i32 %8 to i64
%cmp = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.inc, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %count.1.lcssa, %for.inc ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.stackrestore.p0(ptr %3)
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
declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) 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 #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static char* str_dream = "dream";
static char* str_dreamer = "dreamer";
static char* str_erase = "erase";
static char* str_eraser = "eraser";
static char* str_mer = "mer";
static char* str_ser = "ser";
int main(int argc, char* argv[]){
char *buf= NULL;
char tmp[256+1]={0};
int spos = -1;
int epos = -1;
buf = (char*)calloc(100000+2, sizeof(char));
if(buf==NULL){
return 1;
}
while(fgets(tmp, sizeof(tmp)-1, stdin)!=NULL){
strcat(buf, tmp);
memset(tmp, 0, sizeof(tmp));
}
epos = strlen(buf) -1;
spos = epos;
int ans = 1;
for(;epos>=0 && spos>=0 && ans!=0;){
if(buf[epos]=='\n'){
epos--;
continue;
}
if(buf[epos]=='m'){ //dream
spos = epos - 5 + 1; //dream
if(spos<0){
ans = 0;
break;
}
else{
if(memcmp((void*)(&buf[spos]), str_dream, 5)!=0){
ans = 0;
}
}
}
else if(buf[epos]=='e'){ //erase
spos = epos - 5 + 1; //erase
if(spos<0){
ans = 0;
}
else{
if(memcmp((void*)(&buf[spos]), str_erase, 5)!=0){
ans = 0;
}
}
}
else if(buf[epos]=='r'){ //dreamer or eraser
spos = epos - 3 + 1; // mer or ser
if(spos<0){
ans = 0;
}
else if(memcmp((void*)(&buf[spos]), str_mer, 3)==0){ //mer
spos = epos - 7 + 1; //dreamer
if(spos<0){
ans = 0;
}
else{
if(memcmp((void*)(&buf[spos]), str_dreamer, 7)!=0){
ans = 0;
}
}
}
else if(memcmp((void*)(&buf[spos]), str_ser, 3)==0){ //ser
spos = epos - 6 + 1; //eraser
if(spos<0){
ans = 0;
}
else{
if(memcmp((void*)(&buf[spos]), str_eraser, 6)!=0){
ans = 0;
}
}
}
else{
ans = 0;
}
}
else{
ans = 0;
}
epos = spos - 1;
}
if(ans==1){
printf("YES\n");
}
else{
printf("NO\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325059/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325059/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = private unnamed_addr constant [6 x i8] c"dream\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"erase\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"mer\00", align 1
@.str.5 = private unnamed_addr constant [8 x i8] c"dreamer\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c"ser\00", align 1
@.str.7 = private unnamed_addr constant [7 x i8] c"eraser\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.8 = private unnamed_addr constant [4 x i8] c"YES\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:
%tmp = alloca [257 x i8], align 16
call void @llvm.lifetime.start.p0(i64 257, ptr nonnull %tmp) #9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(257) %tmp, i8 0, i64 257, i1 false)
%call = tail call noalias dereferenceable_or_null(100002) ptr @calloc(i64 noundef 100002, i64 noundef 1) #10
%cmp = icmp eq ptr %call, null
br i1 %cmp, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %entry
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call1186 = call ptr @fgets(ptr noundef nonnull %tmp, i32 noundef 256, ptr noundef %0)
%cmp2.not187 = icmp eq ptr %call1186, null
br i1 %cmp2.not187, label %while.end, label %while.body
while.body: ; preds = %while.cond.preheader, %while.body
%call4 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %call, ptr noundef nonnull dereferenceable(1) %tmp) #9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(257) %tmp, i8 0, i64 257, i1 false)
%1 = load ptr, ptr @stdin, align 8, !tbaa !5
%call1 = call ptr @fgets(ptr noundef nonnull %tmp, i32 noundef 256, ptr noundef %1)
%cmp2.not = icmp eq ptr %call1, null
br i1 %cmp2.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %while.cond.preheader
%call6 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %call) #11
%2 = trunc i64 %call6 to i32
%conv = add i32 %2, -1
%cmp9197 = icmp sgt i32 %conv, -1
br i1 %cmp9197, label %for.body.lr.ph, label %cleanup.sink.split
for.body.lr.ph: ; preds = %while.end, %if.end118
%cmp9202 = phi i1 [ %cmp9, %if.end118 ], [ true, %while.end ]
%epos.0.ph201 = phi i32 [ %sub119, %if.end118 ], [ %conv, %while.end ]
%cmp9.fr = freeze i1 %cmp9202
%3 = zext i32 %epos.0.ph201 to i64
br i1 %cmp9.fr, label %for.body, label %for.body.lr.ph.split.us
for.body.lr.ph.split.us: ; preds = %for.body.lr.ph
%arrayidx.us = getelementptr inbounds i8, ptr %call, i64 %3
%4 = load i8, ptr %arrayidx.us, align 1, !tbaa !11
switch i8 %4, label %if.else124 [
i8 10, label %cleanup.sink.split
i8 109, label %if.then23
i8 101, label %if.then42
i8 114, label %if.then63
]
for.body: ; preds = %for.body.lr.ph, %if.then16
%indvars.iv = phi i64 [ %indvars.iv.next, %if.then16 ], [ %3, %for.body.lr.ph ]
%arrayidx = getelementptr inbounds i8, ptr %call, i64 %indvars.iv
%5 = load i8, ptr %arrayidx, align 1, !tbaa !11
switch i8 %5, label %if.else124 [
i8 10, label %if.then16
i8 109, label %if.then23.loopexit
i8 101, label %if.then42.loopexit
i8 114, label %if.then63.loopexit
]
if.then16: ; preds = %for.body
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%6 = trunc i64 %indvars.iv to i32
%cmp7 = icmp sgt i32 %6, 0
br i1 %cmp7, label %for.body, label %cleanup.sink.split, !llvm.loop !12
if.then23.loopexit: ; preds = %for.body
%7 = trunc i64 %indvars.iv to i32
br label %if.then23
if.then23: ; preds = %if.then23.loopexit, %for.body.lr.ph.split.us
%.us-phi = phi i32 [ %epos.0.ph201, %for.body.lr.ph.split.us ], [ %7, %if.then23.loopexit ]
%cmp25 = icmp ult i32 %.us-phi, 4
br i1 %cmp25, label %if.else124, label %if.else
if.else: ; preds = %if.then23
%add = add nsw i32 %.us-phi, -4
%idxprom28 = zext i32 %add to i64
%arrayidx29 = getelementptr inbounds i8, ptr %call, i64 %idxprom28
%bcmp171 = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %arrayidx29, ptr noundef nonnull dereferenceable(5) @.str.2, i64 5)
br label %if.end118
if.then42.loopexit: ; preds = %for.body
%8 = trunc i64 %indvars.iv to i32
br label %if.then42
if.then42: ; preds = %if.then42.loopexit, %for.body.lr.ph.split.us
%.us-phi194 = phi i32 [ %epos.0.ph201, %for.body.lr.ph.split.us ], [ %8, %if.then42.loopexit ]
%cmp45 = icmp ult i32 %.us-phi194, 4
br i1 %cmp45, label %if.else124, label %if.else48
if.else48: ; preds = %if.then42
%add44 = add nsw i32 %.us-phi194, -4
%idxprom49 = zext i32 %add44 to i64
%arrayidx50 = getelementptr inbounds i8, ptr %call, i64 %idxprom49
%bcmp170 = call i32 @bcmp(ptr noundef nonnull dereferenceable(5) %arrayidx50, ptr noundef nonnull dereferenceable(5) @.str.3, i64 5)
br label %if.end118
if.then63.loopexit: ; preds = %for.body
%9 = trunc i64 %indvars.iv to i32
br label %if.then63
if.then63: ; preds = %if.then63.loopexit, %for.body.lr.ph.split.us
%.us-phi195 = phi i32 [ %epos.0.ph201, %for.body.lr.ph.split.us ], [ %9, %if.then63.loopexit ]
%cmp66 = icmp ult i32 %.us-phi195, 2
br i1 %cmp66, label %if.else124, label %if.else69
if.else69: ; preds = %if.then63
%add65 = add nsw i32 %.us-phi195, -2
%idxprom70 = zext i32 %add65 to i64
%arrayidx71 = getelementptr inbounds i8, ptr %call, i64 %idxprom70
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(3) %arrayidx71, ptr noundef nonnull dereferenceable(3) @.str.4, i64 3)
%cmp73 = icmp eq i32 %bcmp, 0
br i1 %cmp73, label %if.then75, label %if.else90
if.then75: ; preds = %if.else69
%cmp78 = icmp ult i32 %.us-phi195, 6
br i1 %cmp78, label %if.else124, label %if.else81
if.else81: ; preds = %if.then75
%add77 = add nsw i32 %.us-phi195, -6
%idxprom82 = zext i32 %add77 to i64
%arrayidx83 = getelementptr inbounds i8, ptr %call, i64 %idxprom82
%bcmp169 = call i32 @bcmp(ptr noundef nonnull dereferenceable(7) %arrayidx83, ptr noundef nonnull dereferenceable(7) @.str.5, i64 7)
br label %if.end118
if.else90: ; preds = %if.else69
%bcmp167 = call i32 @bcmp(ptr noundef nonnull dereferenceable(3) %arrayidx71, ptr noundef nonnull dereferenceable(3) @.str.6, i64 3)
%cmp94 = icmp ne i32 %bcmp167, 0
%cmp99 = icmp ult i32 %.us-phi195, 5
%or.cond = or i1 %cmp94, %cmp99
br i1 %or.cond, label %if.else124, label %if.else102
if.else102: ; preds = %if.else90
%add98 = add nsw i32 %.us-phi195, -5
%idxprom103 = zext i32 %add98 to i64
%arrayidx104 = getelementptr inbounds i8, ptr %call, i64 %idxprom103
%bcmp168 = call i32 @bcmp(ptr noundef nonnull dereferenceable(6) %arrayidx104, ptr noundef nonnull dereferenceable(6) @.str.7, i64 6)
br label %if.end118
if.end118: ; preds = %if.else102, %if.else81, %if.else48, %if.else
%bcmp168.sink = phi i32 [ %bcmp168, %if.else102 ], [ %bcmp169, %if.else81 ], [ %bcmp170, %if.else48 ], [ %bcmp171, %if.else ]
%spos.1 = phi i32 [ %add98, %if.else102 ], [ %add77, %if.else81 ], [ %add44, %if.else48 ], [ %add, %if.else ]
%cmp106.not = icmp eq i32 %bcmp168.sink, 0
%sub119 = add nsw i32 %spos.1, -1
%cmp9 = icmp sgt i32 %spos.1, -1
%cmp7188 = icmp sgt i32 %spos.1, 0
%or.cond130191 = and i1 %cmp7188, %cmp106.not
br i1 %or.cond130191, label %for.body.lr.ph, label %for.end, !llvm.loop !12
for.end: ; preds = %if.end118
br i1 %cmp106.not, label %cleanup.sink.split, label %if.else124
if.else124: ; preds = %if.then42, %if.then63, %if.then75, %if.else90, %for.body.lr.ph.split.us, %if.then23, %for.body, %for.end
br label %cleanup.sink.split
cleanup.sink.split: ; preds = %for.body.lr.ph.split.us, %if.then16, %for.end, %while.end, %if.else124
%str.8.sink = phi ptr [ @str, %if.else124 ], [ @str.8, %while.end ], [ @str.8, %for.end ], [ @str.8, %if.then16 ], [ @str.8, %for.body.lr.ph.split.us ]
%puts172 = call i32 @puts(ptr nonnull dereferenceable(1) %str.8.sink)
br label %cleanup
cleanup: ; preds = %cleanup.sink.split, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %cleanup.sink.split ]
call void @llvm.lifetime.end.p0(i64 257, ptr nonnull %tmp) #9
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #6
; 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 willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #8
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-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 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind willreturn memory(argmem: read) }
attributes #8 = { nofree nounwind }
attributes #9 = { nounwind }
attributes #10 = { nounwind allocsize(0,1) }
attributes #11 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
typedef long long ll;
#define abs(x) ((x) > 0 ? (x) : -(x))
int
main(int argc, char *argv[])
{
int n, a[100000] = {}, cost[100000];
scanf("%d", &n);
scanf("%d", &a[0]);
cost[0] = abs(a[0]);
for(int i = 1; i < n; i++){
scanf("%d", &a[i]);
cost[i] = cost[i - 1] + abs(a[i] - a[i - 1]);
}
printf("%d\n", abs(a[n - 1]) + cost[n - 1] - cost[1] + abs(a[1]));
for(int i = 1; i < n - 1; i++){
printf("%d\n", abs(a[n - 1]) + cost[n - 1] - cost[i + 1] + cost[i - 1] + abs(a[i + 1] - a[i - 1]));
}
printf("%d\n", cost[n - 2] + abs(a[n - 2]));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325109/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325109/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [100000 x i32], align 16
%cost = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %a) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400000) %a, i8 0, i64 400000, i1 false)
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %cost) #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)
%0 = load i32, ptr %a, align 16
%cond = call i32 @llvm.abs.i32(i32 %0, i1 true)
store i32 %cond, ptr %cost, align 16, !tbaa !5
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp6181 = icmp sgt i32 %1, 1
br i1 %cmp6181, label %for.body, label %for.cond.cleanup
for.cond.cleanup.loopexit: ; preds = %for.body
%arrayidx57.phi.trans.insert = getelementptr inbounds [100000 x i32], ptr %cost, i64 0, i64 1
%.pre = load i32, ptr %arrayidx57.phi.trans.insert, align 4, !tbaa !5
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
%2 = phi i32 [ undef, %entry ], [ %.pre, %for.cond.cleanup.loopexit ]
%.lcssa180 = phi i32 [ %1, %entry ], [ %11, %for.cond.cleanup.loopexit ]
%sub38 = add nsw i32 %.lcssa180, -1
%idxprom39 = sext i32 %sub38 to i64
%arrayidx40 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %idxprom39
%3 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%cond52 = call i32 @llvm.abs.i32(i32 %3, i1 true)
%arrayidx55 = getelementptr inbounds [100000 x i32], ptr %cost, i64 0, i64 %idxprom39
%4 = load i32, ptr %arrayidx55, align 4, !tbaa !5
%add56 = add nsw i32 %cond52, %4
%sub58 = sub i32 %add56, %2
%arrayidx59 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 1
%5 = load i32, ptr %arrayidx59, align 4
%cond67 = call i32 @llvm.abs.i32(i32 %5, i1 true)
%add68 = add nsw i32 %sub58, %cond67
%call69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add68)
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp73184 = icmp sgt i32 %6, 2
br i1 %cmp73184, label %for.body75.preheader, label %for.cond.cleanup74
for.body75.preheader: ; preds = %for.cond.cleanup
%sub72183 = add nsw i32 %6, -1
br label %for.body75
for.body: ; preds = %entry, %for.body
%7 = phi i32 [ %add, %for.body ], [ %cond, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx7 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%8 = add nsw i64 %indvars.iv, -1
%9 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %8
%10 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%sub17 = sub nsw i32 %9, %10
%cond35 = call i32 @llvm.abs.i32(i32 %sub17, i1 true)
%add = add nuw nsw i32 %cond35, %7
%arrayidx37 = getelementptr inbounds [100000 x i32], ptr %cost, i64 0, i64 %indvars.iv
store i32 %add, ptr %arrayidx37, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp6 = icmp slt i64 %indvars.iv.next, %12
br i1 %cmp6, label %for.body, label %for.cond.cleanup.loopexit, !llvm.loop !9
for.cond.cleanup74: ; preds = %for.body75, %for.cond.cleanup
%.lcssa = phi i32 [ %6, %for.cond.cleanup ], [ %22, %for.body75 ]
%sub135 = add nsw i32 %.lcssa, -2
%idxprom136 = sext i32 %sub135 to i64
%arrayidx137 = getelementptr inbounds [100000 x i32], ptr %cost, i64 0, i64 %idxprom136
%13 = load i32, ptr %arrayidx137, align 4, !tbaa !5
%arrayidx140 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %idxprom136
%14 = load i32, ptr %arrayidx140, align 4, !tbaa !5
%cond152 = call i32 @llvm.abs.i32(i32 %14, i1 true)
%add153 = add nsw i32 %cond152, %13
%call154 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add153)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %cost) #5
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.body75: ; preds = %for.body75.preheader, %for.body75
%indvars.iv192 = phi i64 [ 1, %for.body75.preheader ], [ %indvars.iv.next193, %for.body75 ]
%sub72186 = phi i32 [ %sub72183, %for.body75.preheader ], [ %sub72, %for.body75 ]
%idxprom77 = sext i32 %sub72186 to i64
%arrayidx78 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %idxprom77
%15 = load i32, ptr %arrayidx78, align 4, !tbaa !5
%cond90 = call i32 @llvm.abs.i32(i32 %15, i1 true)
%arrayidx93 = getelementptr inbounds [100000 x i32], ptr %cost, i64 0, i64 %idxprom77
%16 = load i32, ptr %arrayidx93, align 4, !tbaa !5
%add94 = add nsw i32 %cond90, %16
%indvars.iv.next193 = add nuw nsw i64 %indvars.iv192, 1
%arrayidx97 = getelementptr inbounds [100000 x i32], ptr %cost, i64 0, i64 %indvars.iv.next193
%17 = load i32, ptr %arrayidx97, align 4, !tbaa !5
%sub98 = sub i32 %add94, %17
%18 = add nsw i64 %indvars.iv192, -1
%arrayidx101 = getelementptr inbounds [100000 x i32], ptr %cost, i64 0, i64 %18
%19 = load i32, ptr %arrayidx101, align 4, !tbaa !5
%add102 = add nsw i32 %sub98, %19
%arrayidx105 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv.next193
%20 = load i32, ptr %arrayidx105, align 4, !tbaa !5
%arrayidx108 = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %18
%21 = load i32, ptr %arrayidx108, align 4, !tbaa !5
%sub109 = sub nsw i32 %20, %21
%cond129 = call i32 @llvm.abs.i32(i32 %sub109, i1 true)
%add130 = add nsw i32 %add102, %cond129
%call131 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add130)
%22 = load i32, ptr %n, align 4, !tbaa !5
%sub72 = add nsw i32 %22, -1
%23 = sext i32 %sub72 to i64
%cmp73 = icmp slt i64 %indvars.iv.next193, %23
br i1 %cmp73, label %for.body75, label %for.cond.cleanup74, !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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int l1,r1,l2,r2;
scanf("%d%d%d%d",&l1,&r1,&l2,&r2);
if(l1!=r2)printf("%d %d\n",l1,r2);
else printf("%d %d\n",r1,l2);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_32516/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_32516/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = 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:
%t = alloca i32, align 4
%l1 = alloca i32, align 4
%r1 = alloca i32, align 4
%l2 = alloca i32, align 4
%r2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec5 = add nsw i32 %0, -1
store i32 %dec5, ptr %t, align 4, !tbaa !5
%tobool.not6 = icmp eq i32 %0, 0
br i1 %tobool.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l2) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r2) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %l1, ptr noundef nonnull %r1, ptr noundef nonnull %l2, ptr noundef nonnull %r2)
%1 = load i32, ptr %l1, align 4, !tbaa !5
%2 = load i32, ptr %r2, align 4, !tbaa !5
%cmp.not = icmp eq i32 %1, %2
br i1 %cmp.not, label %if.else, label %if.then
if.then: ; preds = %while.body
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %1, i32 noundef %2)
br label %if.end
if.else: ; preds = %while.body
%3 = load i32, ptr %r1, align 4, !tbaa !5
%4 = load i32, ptr %l2, align 4, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %3, i32 noundef %4)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r1) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l1) #3
%5 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %5, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %5, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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 main()
{
long long N;
scanf("%lld", &N);
long long n, sum = 0;
for (n = 1; n * n < N; n++) {
if (N % n == 0 && N / (N / n - 1) == n) sum += N / n - 1;
}
printf("%lld\n", sum);
fflush(stdout);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325224/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325224/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !5
%cmp15 = icmp sgt i64 %0, 1
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%sum.017 = phi i64 [ %sum.1, %for.inc ], [ 0, %entry ]
%n.016 = phi i64 [ %inc, %for.inc ], [ 1, %entry ]
%rem = srem i64 %0, %n.016
%div = sdiv i64 %0, %n.016
%cmp1 = icmp eq i64 %rem, 0
br i1 %cmp1, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%sub = add nsw i64 %div, -1
%div2 = sdiv i64 %0, %sub
%cmp3 = icmp eq i64 %div2, %n.016
%add = select i1 %cmp3, i64 %sub, i64 0
%spec.select = add nsw i64 %add, %sum.017
br label %for.inc
for.inc: ; preds = %land.lhs.true, %for.body
%sum.1 = phi i64 [ %sum.017, %for.body ], [ %spec.select, %land.lhs.true ]
%inc = add nuw nsw i64 %n.016, 1
%mul = mul nsw i64 %inc, %inc
%cmp = icmp slt i64 %mul, %0
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %sum.1, %for.inc ]
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sum.0.lcssa)
%1 = load ptr, ptr @stdout, align 8, !tbaa !11
%call7 = call i32 @fflush(ptr noundef %1)
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: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
|
#include<stdio.h>
int main(){
long int N;
long int x = 1;
long int count = 0;
scanf("%ld",&N);
while(x*x+x < N){
if(N%x==0){count += ((N/x)-1);}
x++;
}
printf("%ld\n",count);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325268/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325268/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !5
%cmp11 = icmp sgt i64 %0, 2
br i1 %cmp11, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%x.01014 = phi i64 [ %x.010, %while.body ], [ 2, %entry ]
%count.013 = phi i64 [ %count.1, %while.body ], [ 0, %entry ]
%x.012 = phi i64 [ %x.01014, %while.body ], [ 1, %entry ]
%rem = srem i64 %0, %x.012
%div = sdiv i64 %0, %x.012
%cmp1 = icmp eq i64 %rem, 0
%sub = add i64 %count.013, -1
%add2 = add i64 %sub, %div
%count.1 = select i1 %cmp1, i64 %add2, i64 %count.013
%x.010 = add nuw i64 %x.01014, 1
%add = mul i64 %x.010, %x.01014
%cmp = icmp slt i64 %add, %0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%count.0.lcssa = phi i64 [ 0, %entry ], [ %count.1, %while.body ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int a,b=0,c;
char s[101];
// 整数の入力
scanf("%d", &a);
// 文字列の入力
scanf("%s",s);
// 出力
for(c=0;c<a;c++){
if (s[c]=='R'){
b++;
}else{
b--;
}
}
if(b>0){
printf("Yes\n");
}
else{
printf("No\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325310/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325310/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%s = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body.preheader, label %if.else9
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader24, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%vec.phi22 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%1 = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %index
%wide.load = load <4 x i8>, ptr %1, align 8, !tbaa !9
%2 = getelementptr inbounds i8, ptr %1, i64 4
%wide.load23 = load <4 x i8>, ptr %2, align 4, !tbaa !9
%3 = icmp eq <4 x i8> %wide.load, <i8 82, i8 82, i8 82, i8 82>
%4 = icmp eq <4 x i8> %wide.load23, <i8 82, i8 82, i8 82, i8 82>
%5 = select <4 x i1> %3, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
%6 = select <4 x i1> %4, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
%7 = add <4 x i32> %5, %vec.phi
%8 = add <4 x i32> %6, %vec.phi22
%index.next = add nuw i64 %index, 8
%9 = icmp eq i64 %index.next, %n.vec
br i1 %9, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %8, %7
%10 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader24
for.body.preheader24: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%b.018.ph = phi i32 [ 0, %for.body.preheader ], [ %10, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader24, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader24 ]
%b.018 = phi i32 [ %b.1, %for.body ], [ %b.018.ph, %for.body.preheader24 ]
%arrayidx = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %indvars.iv
%11 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp2 = icmp eq i8 %11, 82
%b.1.v = select i1 %cmp2, i32 1, i32 -1
%b.1 = add nsw i32 %b.1.v, %b.018
%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 = %for.body, %middle.block
%b.1.lcssa = phi i32 [ %10, %middle.block ], [ %b.1, %for.body ]
%12 = icmp sgt i32 %b.1.lcssa, 0
br i1 %12, label %if.end11, label %if.else9
if.else9: ; preds = %entry, %for.end
br label %if.end11
if.end11: ; preds = %for.end, %if.else9
%str.sink = phi ptr [ @str, %if.else9 ], [ @str.4, %for.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !13, !12}
|
#include<stdio.h>
int main(){
char s[101];
int N;
scanf("%d",&N);
scanf("%s",s);
int i;
int result=0;
for(i=0;i<N;i++){
if(s[i]=='R'){
result+=1;
}
else{
result-=1;
}
}
if(result>0){
printf("Yes\n");
}
else{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325361/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325361/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [101 x i8], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 101, 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)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp16 = icmp sgt i32 %0, 0
br i1 %cmp16, label %for.body.preheader, label %if.else8
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader23, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%vec.phi21 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%1 = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %index
%wide.load = load <4 x i8>, ptr %1, align 8, !tbaa !9
%2 = getelementptr inbounds i8, ptr %1, i64 4
%wide.load22 = load <4 x i8>, ptr %2, align 4, !tbaa !9
%3 = icmp eq <4 x i8> %wide.load, <i8 82, i8 82, i8 82, i8 82>
%4 = icmp eq <4 x i8> %wide.load22, <i8 82, i8 82, i8 82, i8 82>
%5 = select <4 x i1> %3, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
%6 = select <4 x i1> %4, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
%7 = add <4 x i32> %5, %vec.phi
%8 = add <4 x i32> %6, %vec.phi21
%index.next = add nuw i64 %index, 8
%9 = icmp eq i64 %index.next, %n.vec
br i1 %9, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %8, %7
%10 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader23
for.body.preheader23: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%result.018.ph = phi i32 [ 0, %for.body.preheader ], [ %10, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader23, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader23 ]
%result.018 = phi i32 [ %result.1, %for.body ], [ %result.018.ph, %for.body.preheader23 ]
%arrayidx = getelementptr inbounds [101 x i8], ptr %s, i64 0, i64 %indvars.iv
%11 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp2 = icmp eq i8 %11, 82
%result.1.v = select i1 %cmp2, i32 1, i32 -1
%result.1 = add nsw i32 %result.1.v, %result.018
%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 = %for.body, %middle.block
%result.1.lcssa = phi i32 [ %10, %middle.block ], [ %result.1, %for.body ]
%12 = icmp sgt i32 %result.1.lcssa, 0
br i1 %12, label %if.end10, label %if.else8
if.else8: ; preds = %entry, %for.end
br label %if.end10
if.end10: ; preds = %for.end, %if.else8
%str.sink = phi ptr [ @str, %if.else8 ], [ @str.4, %for.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !13, !12}
|
#include <stdio.h>
int
main(void)
{
int count;
char str[256];
int R = 0;
int B = 0;
scanf("%d", &count);
scanf("%s", str);
for (int i = 0; i < count; i++) {
if (str[i] == 'R')
R++;
else
B++;
}
if (R > B)
printf("Yes");
else
printf("No");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325404/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325404/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%count = alloca i32, align 4
%str = alloca [256 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %count) #4
call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %str) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %count)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %str)
%0 = load i32, ptr %count, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body.preheader, label %if.else10
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader32, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%vec.phi26 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%vec.phi27 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%vec.phi28 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%1 = getelementptr inbounds [256 x i8], ptr %str, i64 0, i64 %index
%wide.load = load <4 x i8>, ptr %1, align 8, !tbaa !9
%2 = getelementptr inbounds i8, ptr %1, i64 4
%wide.load29 = load <4 x i8>, ptr %2, align 4, !tbaa !9
%3 = icmp eq <4 x i8> %wide.load, <i8 82, i8 82, i8 82, i8 82>
%4 = icmp eq <4 x i8> %wide.load29, <i8 82, i8 82, i8 82, i8 82>
%5 = zext <4 x i1> %3 to <4 x i32>
%6 = zext <4 x i1> %4 to <4 x i32>
%7 = add <4 x i32> %vec.phi27, %5
%8 = add <4 x i32> %vec.phi28, %6
%9 = xor <4 x i1> %3, <i1 true, i1 true, i1 true, i1 true>
%10 = xor <4 x i1> %4, <i1 true, i1 true, i1 true, i1 true>
%11 = zext <4 x i1> %9 to <4 x i32>
%12 = zext <4 x i1> %10 to <4 x i32>
%13 = add <4 x i32> %vec.phi, %11
%14 = add <4 x i32> %vec.phi26, %12
%index.next = add nuw i64 %index, 8
%15 = icmp eq i64 %index.next, %n.vec
br i1 %15, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%bin.rdx30 = add <4 x i32> %8, %7
%16 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx30)
%bin.rdx = add <4 x i32> %14, %13
%17 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader32
for.body.preheader32: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%B.019.ph = phi i32 [ 0, %for.body.preheader ], [ %17, %middle.block ]
%R.018.ph = phi i32 [ 0, %for.body.preheader ], [ %16, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block
%R.1.lcssa = phi i32 [ %16, %middle.block ], [ %R.1, %for.body ]
%B.1.lcssa = phi i32 [ %17, %middle.block ], [ %B.1, %for.body ]
%cmp6 = icmp ugt i32 %R.1.lcssa, %B.1.lcssa
br i1 %cmp6, label %if.end12, label %if.else10
for.body: ; preds = %for.body.preheader32, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader32 ]
%B.019 = phi i32 [ %B.1, %for.body ], [ %B.019.ph, %for.body.preheader32 ]
%R.018 = phi i32 [ %R.1, %for.body ], [ %R.018.ph, %for.body.preheader32 ]
%arrayidx = getelementptr inbounds [256 x i8], ptr %str, i64 0, i64 %indvars.iv
%18 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp2 = icmp eq i8 %18, 82
%inc = zext i1 %cmp2 to i32
%R.1 = add nuw nsw i32 %R.018, %inc
%not.cmp2 = xor i1 %cmp2, true
%inc4 = zext i1 %not.cmp2 to i32
%B.1 = add nuw nsw i32 %B.019, %inc4
%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 !14
if.else10: ; preds = %entry, %for.cond.cleanup
br label %if.end12
if.end12: ; preds = %for.cond.cleanup, %if.else10
%.str.3.sink = phi ptr [ @.str.3, %if.else10 ], [ @.str.2, %for.cond.cleanup ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %str) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %count) #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !13, !12}
|
#include<stdio.h>
int main()
{
int n;
scanf("%d", &n);
char s[102];
scanf("%s", s);
int i, r, b;
r = b = 0;
for (i = 0; i < n; i++)
if (s[i] == 'R')
r++;
else
b++;
if (r > b)
printf("Yes\n");
else
printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325448/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325448/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [3 x i8] c"No\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = alloca [102 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 102, ptr nonnull %s) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body.preheader, label %if.else10
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader33, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%vec.phi27 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%vec.phi28 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%vec.phi29 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%1 = getelementptr inbounds [102 x i8], ptr %s, i64 0, i64 %index
%wide.load = load <4 x i8>, ptr %1, align 8, !tbaa !9
%2 = getelementptr inbounds i8, ptr %1, i64 4
%wide.load30 = load <4 x i8>, ptr %2, align 4, !tbaa !9
%3 = icmp eq <4 x i8> %wide.load, <i8 82, i8 82, i8 82, i8 82>
%4 = icmp eq <4 x i8> %wide.load30, <i8 82, i8 82, i8 82, i8 82>
%5 = zext <4 x i1> %3 to <4 x i32>
%6 = zext <4 x i1> %4 to <4 x i32>
%7 = add <4 x i32> %vec.phi28, %5
%8 = add <4 x i32> %vec.phi29, %6
%9 = xor <4 x i1> %3, <i1 true, i1 true, i1 true, i1 true>
%10 = xor <4 x i1> %4, <i1 true, i1 true, i1 true, i1 true>
%11 = zext <4 x i1> %9 to <4 x i32>
%12 = zext <4 x i1> %10 to <4 x i32>
%13 = add <4 x i32> %vec.phi, %11
%14 = add <4 x i32> %vec.phi27, %12
%index.next = add nuw i64 %index, 8
%15 = icmp eq i64 %index.next, %n.vec
br i1 %15, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%bin.rdx31 = add <4 x i32> %8, %7
%16 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx31)
%bin.rdx = add <4 x i32> %14, %13
%17 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader33
for.body.preheader33: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%b.021.ph = phi i32 [ 0, %for.body.preheader ], [ %17, %middle.block ]
%r.020.ph = phi i32 [ 0, %for.body.preheader ], [ %16, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader33, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader33 ]
%b.021 = phi i32 [ %b.1, %for.body ], [ %b.021.ph, %for.body.preheader33 ]
%r.020 = phi i32 [ %r.1, %for.body ], [ %r.020.ph, %for.body.preheader33 ]
%arrayidx = getelementptr inbounds [102 x i8], ptr %s, i64 0, i64 %indvars.iv
%18 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp2 = icmp eq i8 %18, 82
%inc = zext i1 %cmp2 to i32
%r.1 = add nuw nsw i32 %r.020, %inc
%not.cmp2 = xor i1 %cmp2, true
%inc4 = zext i1 %not.cmp2 to i32
%b.1 = add nuw nsw i32 %b.021, %inc4
%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 = %for.body, %middle.block
%r.1.lcssa = phi i32 [ %16, %middle.block ], [ %r.1, %for.body ]
%b.1.lcssa = phi i32 [ %17, %middle.block ], [ %b.1, %for.body ]
%cmp6 = icmp ugt i32 %r.1.lcssa, %b.1.lcssa
br i1 %cmp6, label %if.end12, label %if.else10
if.else10: ; preds = %entry, %for.end
br label %if.end12
if.end12: ; preds = %for.end, %if.else10
%str.sink = phi ptr [ @str, %if.else10 ], [ @str.4, %for.end ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 102, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !13, !12}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void){
int n,x,y;
int f;
int min;
scanf("%d %d %d",&n,&x,&y);
int ans[n];
for(int i=0; i<n; i++){
ans[i]=0;
}
for(int i=1; i<n; i++){
for(int j=i+1; j<=n; j++){
min = fmin(abs(i-x)+abs(y-j)+1,j-i);
ans[min]++;
}
}
for(int i=1; i<n; i++){
printf("%d\n",ans[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325505/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325505/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%n = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %x, ptr noundef nonnull %y)
%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
%cmp48 = icmp sgt i32 %3, 0
br i1 %cmp48, label %for.cond2.preheader, label %for.cond.cleanup29
for.cond2.preheader: ; preds = %entry
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla, i8 0, i64 %5, i1 false), !tbaa !5
%cmp352.not = icmp eq i32 %3, 1
br i1 %cmp352.not, label %for.cond.cleanup29, label %for.body5.lr.ph
for.body5.lr.ph: ; preds = %for.cond2.preheader
%6 = load i32, ptr %x, align 4
%7 = load i32, ptr %y, align 4
br label %for.body9.lr.ph
for.cond2.loopexit: ; preds = %for.body9
%exitcond57.not = icmp eq i32 %add, %3
br i1 %exitcond57.not, label %for.cond26.preheader, label %for.body9.lr.ph, !llvm.loop !9
for.cond26.preheader: ; preds = %for.cond2.loopexit
br i1 %cmp352.not, label %for.cond.cleanup29, label %for.body30
for.body9.lr.ph: ; preds = %for.cond2.loopexit, %for.body5.lr.ph
%i1.053 = phi i32 [ 1, %for.body5.lr.ph ], [ %add, %for.cond2.loopexit ]
%add = add nuw nsw i32 %i1.053, 1
%sub = sub nsw i32 %i1.053, %6
%8 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%add11 = add nuw i32 %8, 1
br label %for.body9
for.body9: ; preds = %for.body9.lr.ph, %for.body9
%j.051 = phi i32 [ %add, %for.body9.lr.ph ], [ %inc20, %for.body9 ]
%sub10 = sub nsw i32 %7, %j.051
%9 = call i32 @llvm.abs.i32(i32 %sub10, i1 true)
%add12 = add nuw i32 %add11, %9
%conv = sitofp i32 %add12 to double
%sub13 = sub nuw nsw i32 %j.051, %i1.053
%conv14 = sitofp i32 %sub13 to double
%10 = call double @llvm.minnum.f64(double %conv, double %conv14)
%conv15 = fptosi double %10 to i32
%idxprom16 = sext i32 %conv15 to i64
%arrayidx17 = getelementptr inbounds i32, ptr %vla, i64 %idxprom16
%11 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%inc18 = add nsw i32 %11, 1
store i32 %inc18, ptr %arrayidx17, align 4, !tbaa !5
%inc20 = add nuw i32 %j.051, 1
%exitcond.not = icmp eq i32 %j.051, %3
br i1 %exitcond.not, label %for.cond2.loopexit, label %for.body9, !llvm.loop !11
for.cond.cleanup29: ; preds = %for.body30, %entry, %for.cond2.preheader, %for.cond26.preheader
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
for.body30: ; preds = %for.cond26.preheader, %for.body30
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body30 ], [ 1, %for.cond26.preheader ]
%arrayidx32 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%12 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%13 = load i32, ptr %n, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp27 = icmp slt i64 %indvars.iv.next, %14
br i1 %cmp27, label %for.body30, label %for.cond.cleanup29, !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
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.minnum.f64(double, double) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(void)
{
int a,b,c,d,e,x,y;
scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
x=0;
y=0;
if(a<=b && a<=c){
x=a;
}
else if(b<=a && b<=c){
x=b;
}
else{
x=c;
}
if(d<=e){
y=d;
}
else{
y=e;
}
printf("%d\n",x+y-50);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325549/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325549/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"%d %d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
%e = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %e) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %0, %1
%2 = load i32, ptr %c, align 4
%cmp1.not = icmp sgt i32 %0, %2
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp1.not
%cmp2.not = icmp sgt i32 %1, %0
%cmp4.not = icmp sgt i32 %1, %2
%or.cond16 = select i1 %cmp2.not, i1 true, i1 %cmp4.not
%spec.select = select i1 %or.cond16, i32 %2, i32 %1
%x.0 = select i1 %or.cond, i32 %spec.select, i32 %0
%3 = load i32, ptr %d, align 4, !tbaa !5
%4 = load i32, ptr %e, align 4, !tbaa !5
%. = call i32 @llvm.smin.i32(i32 %3, i32 %4)
%add = add i32 %., -50
%sub = add i32 %add, %x.0
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %e) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int a;
int i;
int min=100000,sum=0;
for(i=0;i<3;i++){
scanf("%d",&a);
if(a<min) min=a;
}
sum=min;
for(i=0;i<2;i++){
scanf("%d",&a);
if(a<min) min=a;
}
sum+=min-50;
printf("%d\n",sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325592/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325592/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%spec.select = call i32 @llvm.smin.i32(i32 %0, i32 %1)
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%2 = load i32, ptr %a, align 4, !tbaa !5
%spec.select.1 = call i32 @llvm.smin.i32(i32 %spec.select, i32 %2)
%spec.select.2 = call i32 @llvm.smin.i32(i32 %spec.select.1, i32 100000)
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%3 = load i32, ptr %a, align 4, !tbaa !5
%spec.select21 = call i32 @llvm.smin.i32(i32 %3, i32 %spec.select.2)
%call5.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%4 = load i32, ptr %a, align 4, !tbaa !5
%spec.select21.1 = call i32 @llvm.smin.i32(i32 %4, i32 %spec.select21)
%sub = add i32 %spec.select.2, -50
%add = add i32 %sub, %spec.select21.1
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#define N 3
#define M 2
int main(){
int i, j, min, x, pasta[N], drink[M];
for(i=0; i<N; i++)
scanf("%d", &pasta[i]);
for(i=0; i<M; i++)
scanf("%d", &drink[i]);
for(i=0, min=4000; i<N; i++){
for(j=0; j<M; j++){
x = pasta[i] + drink[j] - 50;
if(min > x) min = x;
}
}
printf("%d\n", min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325635/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325635/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%pasta = alloca [3 x i32], align 4
%drink = alloca [2 x i32], align 4
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %pasta) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %drink) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %pasta)
%arrayidx.1 = getelementptr inbounds [3 x i32], ptr %pasta, i64 0, i64 1
%call.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.1)
%arrayidx.2 = getelementptr inbounds [3 x i32], ptr %pasta, i64 0, i64 2
%call.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx.2)
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %drink)
%arrayidx5.1 = getelementptr inbounds [2 x i32], ptr %drink, i64 0, i64 1
%call6.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1)
%0 = load i32, ptr %pasta, align 4, !tbaa !5
%add = add i32 %0, -50
%1 = load i32, ptr %drink, align 4, !tbaa !5
%sub = add i32 %add, %1
%2 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%sub.1 = add i32 %add, %2
%spec.select = call i32 @llvm.smin.i32(i32 %sub, i32 %sub.1)
%3 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%add.1 = add i32 %3, -50
%sub.150 = add i32 %add.1, %1
%spec.select.1 = call i32 @llvm.smin.i32(i32 %spec.select, i32 %sub.150)
%sub.1.1 = add i32 %add.1, %2
%spec.select.151 = call i32 @llvm.smin.i32(i32 %spec.select.1, i32 %sub.1.1)
%4 = load i32, ptr %arrayidx.2, align 4, !tbaa !5
%add.2 = add i32 %4, -50
%sub.2 = add i32 %add.2, %1
%spec.select.1.1 = call i32 @llvm.smin.i32(i32 %spec.select.151, i32 %sub.2)
%sub.1.2 = add i32 %add.2, %2
%spec.select.2 = call i32 @llvm.smin.i32(i32 %spec.select.1.1, i32 %sub.1.2)
%spec.select.1.2 = call i32 @llvm.smin.i32(i32 %spec.select.2, i32 4000)
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select.1.2)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %drink) #4
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %pasta) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
int main()
{ int t;
scanf("%d",&t);
while(t--)
{
long long int i,j,k,p,l1,r1,l2,r2;
scanf("%lld%lld%lld%lld",&l1,&r1,&l2,&r2);
printf("%lld ",l1);
if(l2!=l1)
printf("%lld\n",l2);
else
printf("%lld\n",l2+1);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_32570/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_32570/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [17 x i8] c"%lld%lld%lld%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld \00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%l1 = alloca i64, align 8
%r1 = alloca i64, align 8
%l2 = alloca i64, align 8
%r2 = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec5 = add nsw i32 %0, -1
store i32 %dec5, ptr %t, align 4, !tbaa !5
%tobool.not6 = icmp eq i32 %0, 0
br i1 %tobool.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %l1) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r1) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %l2) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r2) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %l1, ptr noundef nonnull %r1, ptr noundef nonnull %l2, ptr noundef nonnull %r2)
%1 = load i64, ptr %l1, align 8, !tbaa !9
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %1)
%2 = load i64, ptr %l2, align 8, !tbaa !9
%3 = load i64, ptr %l1, align 8, !tbaa !9
%cmp.not = icmp eq i64 %2, %3
%add = zext i1 %cmp.not to i64
%add.sink = add nsw i64 %2, %add
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %add.sink)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r2) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %l2) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r1) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %l1) #3
%4 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
int n;
int i,j;
int p[4001];
int ans;
for(i=0;i<=4000;i++) p[i]=0;
for(i=0;i<=1000;i++){
for(j=0;j<=1000;j++){
p[i+j]++;
}
}
while(scanf("%d",&n)!=EOF){
ans=0;
for(i=0;i<=n;i++){
ans+=(p[i]*p[n-i]);
}
printf("%d\n",ans);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325743/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325743/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%p = alloca [4001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 16004, ptr nonnull %p) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16004) %p, i8 0, i64 16004, i1 false), !tbaa !5
br label %vector.ph
vector.ph: ; preds = %for.body6, %entry
%indvars.iv52 = phi i64 [ 0, %entry ], [ %indvars.iv.next53, %for.body6 ]
br label %vector.body
vector.body: ; preds = %vector.body.1, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next.1, %vector.body.1 ]
%0 = add nuw nsw i64 %index, %indvars.iv52
%1 = getelementptr inbounds [4001 x i32], ptr %p, i64 0, i64 %0
%wide.load = load <4 x i32>, ptr %1, align 4, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
%wide.load61 = load <4 x i32>, ptr %2, align 4, !tbaa !5
%3 = add nsw <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%4 = add nsw <4 x i32> %wide.load61, <i32 1, i32 1, i32 1, i32 1>
store <4 x i32> %3, ptr %1, align 4, !tbaa !5
store <4 x i32> %4, ptr %2, align 4, !tbaa !5
%index.next = or i64 %index, 8
%5 = icmp eq i64 %index.next, 1000
br i1 %5, label %for.body6, label %vector.body.1, !llvm.loop !9
vector.body.1: ; preds = %vector.body
%6 = add nuw nsw i64 %index.next, %indvars.iv52
%7 = getelementptr inbounds [4001 x i32], ptr %p, i64 0, i64 %6
%wide.load.1 = load <4 x i32>, ptr %7, align 4, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
%wide.load61.1 = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = add nsw <4 x i32> %wide.load.1, <i32 1, i32 1, i32 1, i32 1>
%10 = add nsw <4 x i32> %wide.load61.1, <i32 1, i32 1, i32 1, i32 1>
store <4 x i32> %9, ptr %7, align 4, !tbaa !5
store <4 x i32> %10, ptr %8, align 4, !tbaa !5
%index.next.1 = add nuw nsw i64 %index, 16
br label %vector.body
while.cond.preheader: ; preds = %for.body6
%call47 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp16.not48 = icmp eq i32 %call47, -1
br i1 %cmp16.not48, label %while.end, label %for.cond17.preheader
for.body6: ; preds = %vector.body
%11 = add nuw nsw i64 %indvars.iv52, 1000
%arrayidx8 = getelementptr inbounds [4001 x i32], ptr %p, i64 0, i64 %11
%12 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%inc9 = add nsw i32 %12, 1
store i32 %inc9, ptr %arrayidx8, align 4, !tbaa !5
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%exitcond55.not = icmp eq i64 %indvars.iv.next53, 1001
br i1 %exitcond55.not, label %while.cond.preheader, label %vector.ph, !llvm.loop !13
for.cond17.preheader: ; preds = %while.cond.preheader, %for.end27
%13 = load i32, ptr %n, align 4, !tbaa !5
%cmp18.not44 = icmp slt i32 %13, 0
br i1 %cmp18.not44, label %for.end27, label %for.body19.preheader
for.body19.preheader: ; preds = %for.cond17.preheader
%14 = zext i32 %13 to i64
%15 = add nuw i32 %13, 1
%wide.trip.count = zext i32 %15 to i64
%min.iters.check = icmp ult i32 %13, 7
br i1 %min.iters.check, label %for.body19.preheader75, label %vector.ph64
vector.ph64: ; preds = %for.body19.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body66
vector.body66: ; preds = %vector.body66, %vector.ph64
%index67 = phi i64 [ 0, %vector.ph64 ], [ %index.next74, %vector.body66 ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph64 ], [ %24, %vector.body66 ]
%vec.phi68 = phi <4 x i32> [ zeroinitializer, %vector.ph64 ], [ %25, %vector.body66 ]
%16 = getelementptr inbounds [4001 x i32], ptr %p, i64 0, i64 %index67
%wide.load69 = load <4 x i32>, ptr %16, align 16, !tbaa !5
%17 = getelementptr inbounds i32, ptr %16, i64 4
%wide.load70 = load <4 x i32>, ptr %17, align 16, !tbaa !5
%18 = sub nsw i64 %14, %index67
%19 = getelementptr inbounds [4001 x i32], ptr %p, i64 0, i64 %18
%20 = getelementptr inbounds i32, ptr %19, i64 -3
%wide.load71 = load <4 x i32>, ptr %20, align 4, !tbaa !5
%reverse = shufflevector <4 x i32> %wide.load71, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%21 = getelementptr inbounds i32, ptr %19, i64 -7
%wide.load72 = load <4 x i32>, ptr %21, align 4, !tbaa !5
%reverse73 = shufflevector <4 x i32> %wide.load72, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%22 = mul nsw <4 x i32> %reverse, %wide.load69
%23 = mul nsw <4 x i32> %reverse73, %wide.load70
%24 = add <4 x i32> %22, %vec.phi
%25 = add <4 x i32> %23, %vec.phi68
%index.next74 = add nuw i64 %index67, 8
%26 = icmp eq i64 %index.next74, %n.vec
br i1 %26, label %middle.block62, label %vector.body66, !llvm.loop !14
middle.block62: ; preds = %vector.body66
%bin.rdx = add <4 x i32> %25, %24
%27 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end27, label %for.body19.preheader75
for.body19.preheader75: ; preds = %for.body19.preheader, %middle.block62
%indvars.iv56.ph = phi i64 [ 0, %for.body19.preheader ], [ %n.vec, %middle.block62 ]
%ans.046.ph = phi i32 [ 0, %for.body19.preheader ], [ %27, %middle.block62 ]
br label %for.body19
for.body19: ; preds = %for.body19.preheader75, %for.body19
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body19 ], [ %indvars.iv56.ph, %for.body19.preheader75 ]
%ans.046 = phi i32 [ %add24, %for.body19 ], [ %ans.046.ph, %for.body19.preheader75 ]
%arrayidx21 = getelementptr inbounds [4001 x i32], ptr %p, i64 0, i64 %indvars.iv56
%28 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%29 = sub nsw i64 %14, %indvars.iv56
%arrayidx23 = getelementptr inbounds [4001 x i32], ptr %p, i64 0, i64 %29
%30 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%mul = mul nsw i32 %30, %28
%add24 = add nsw i32 %mul, %ans.046
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%exitcond60.not = icmp eq i64 %indvars.iv.next57, %wide.trip.count
br i1 %exitcond60.not, label %for.end27, label %for.body19, !llvm.loop !15
for.end27: ; preds = %for.body19, %middle.block62, %for.cond17.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond17.preheader ], [ %27, %middle.block62 ], [ %add24, %for.body19 ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp16.not = icmp eq i32 %call, -1
br i1 %cmp16.not, label %while.end, label %for.cond17.preheader, !llvm.loop !16
while.end: ; preds = %for.end27, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 16004, ptr nonnull %p) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
#include <string.h>
int main() {
char s[100001];
int n, a, b, pass = 0, fpass = 0;
scanf("%d%d%d", &n, &a, &b);
scanf("%s", s);
for (int i = 0; i < strlen(s); i++) {
if (s[i] == 'a') {
if (pass < a + b) {
printf("Yes\n");
pass++;
} else {
printf("No\n");
}
} else if (s[i] == 'b') {
if (pass < a + b && fpass < b) {
printf("Yes\n");
fpass++;
pass++;
} else {
printf("No\n");
}
} else {
printf("No\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325794/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325794/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str.6 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.7 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100001 x i8], align 16
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 100001, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, 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)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%char0 = load i8, ptr %s, align 16
%cmp49.not = icmp eq i8 %char0, 0
br i1 %cmp49.not, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 100001, ptr nonnull %s) #5
ret i32 0
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%fpass.051 = phi i32 [ %fpass.1, %for.inc ], [ 0, %entry ]
%pass.050 = phi i32 [ %pass.1, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %0, label %if.else32 [
i8 97, label %if.then
i8 98, label %if.then19
]
if.then: ; preds = %for.body
%1 = load i32, ptr %a, align 4, !tbaa !8
%2 = load i32, ptr %b, align 4, !tbaa !8
%add = add nsw i32 %2, %1
%cmp8 = icmp slt i32 %pass.050, %add
br i1 %cmp8, label %if.then10, label %if.else
if.then10: ; preds = %if.then
%puts47 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%inc = add nsw i32 %pass.050, 1
br label %for.inc
if.else: ; preds = %if.then
%puts46 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %for.inc
if.then19: ; preds = %for.body
%3 = load i32, ptr %a, align 4, !tbaa !8
%4 = load i32, ptr %b, align 4, !tbaa !8
%add20 = add nsw i32 %4, %3
%cmp21 = icmp slt i32 %pass.050, %add20
%cmp23 = icmp slt i32 %fpass.051, %4
%or.cond = select i1 %cmp21, i1 %cmp23, i1 false
br i1 %or.cond, label %if.then25, label %if.else29
if.then25: ; preds = %if.then19
%puts45 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
%inc27 = add nsw i32 %fpass.051, 1
%inc28 = add nsw i32 %pass.050, 1
br label %for.inc
if.else29: ; preds = %if.then19
%puts44 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %for.inc
if.else32: ; preds = %for.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
br label %for.inc
for.inc: ; preds = %if.else, %if.then10, %if.then25, %if.else29, %if.else32
%pass.1 = phi i32 [ %inc, %if.then10 ], [ %pass.050, %if.else ], [ %inc28, %if.then25 ], [ %pass.050, %if.else29 ], [ %pass.050, %if.else32 ]
%fpass.1 = phi i32 [ %fpass.051, %if.then10 ], [ %fpass.051, %if.else ], [ %inc27, %if.then25 ], [ %fpass.051, %if.else29 ], [ %fpass.051, %if.else32 ]
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%cmp = icmp ugt i64 %call3, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !10
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int n,a,b;
char s[100000];
scanf("%d %d %d",&n,&a,&b);
scanf("%s",s);
int i,cnt=0,cntb=0;
for(i=0;i<n;i++){
if(s[i]=='c'){
printf("No\n");
continue;
}
else if(s[i]=='a'){
if(cnt<a+b){
printf("Yes\n");
cnt++;
continue;
}
else{
printf("No\n");
continue;
}
}
else{
if(cnt<a+b&&(cntb+1)<=b){
printf("Yes\n");
cnt++;
cntb++;
continue;
}
else{
printf("No\n");
continue;
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325837/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325837/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str.6 = 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:
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%s = alloca [100000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 100000, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%cntb.045 = phi i32 [ %cntb.1, %for.inc ], [ 0, %entry ]
%cnt.044 = phi i32 [ %cnt.1, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i8], ptr %s, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
switch i8 %1, label %if.else17 [
i8 99, label %if.then
i8 97, label %if.then10
]
if.then: ; preds = %for.body
%puts41 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
br label %for.inc
if.then10: ; preds = %for.body
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %3, %2
%cmp11 = icmp slt i32 %cnt.044, %add
br i1 %cmp11, label %if.then13, label %if.else15
if.then13: ; preds = %if.then10
%puts40 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%inc = add nsw i32 %cnt.044, 1
br label %for.inc
if.else15: ; preds = %if.then10
%puts39 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
br label %for.inc
if.else17: ; preds = %for.body
%4 = load i32, ptr %a, align 4, !tbaa !5
%5 = load i32, ptr %b, align 4, !tbaa !5
%add18 = add nsw i32 %5, %4
%cmp19 = icmp slt i32 %cnt.044, %add18
%cmp22.not.not = icmp slt i32 %cntb.045, %5
%or.cond = select i1 %cmp19, i1 %cmp22.not.not, i1 false
br i1 %or.cond, label %if.then24, label %if.else28
if.then24: ; preds = %if.else17
%add21 = add nsw i32 %cntb.045, 1
%puts38 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6)
%inc26 = add nsw i32 %cnt.044, 1
br label %for.inc
if.else28: ; preds = %if.else17
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.7)
br label %for.inc
for.inc: ; preds = %if.else28, %if.then24, %if.else15, %if.then13, %if.then
%cnt.1 = phi i32 [ %cnt.044, %if.then ], [ %inc, %if.then13 ], [ %cnt.044, %if.else15 ], [ %inc26, %if.then24 ], [ %cnt.044, %if.else28 ]
%cntb.1 = phi i32 [ %cntb.045, %if.then ], [ %cntb.045, %if.then13 ], [ %cntb.045, %if.else15 ], [ %add21, %if.then24 ], [ %cntb.045, %if.else28 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %for.inc, %entry
call void @llvm.lifetime.end.p0(i64 100000, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int n;
int S[100];
int q;
int T[100];
int i;
int j;
int count = 0;
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%d", &S[i]);
}
scanf("%d", &q);
for (i = 0; i < q; i++){
scanf("%d", &T[i]);
}
for (i = 0; i < q; i++){
for (j = 0; j < n; j++){
if (T[i] == S[j]){
count++;
break;
}
}
}
printf("%d\n", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325888/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325888/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%S = alloca [100 x i32], align 16
%q = alloca i32, align 4
%T = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %T) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, 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 [100 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp444 = icmp sgt i32 %3, 0
br i1 %cmp444, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1348 = icmp sgt i32 %10, 0
br i1 %cmp1348, label %for.cond15.preheader.lr.ph, label %for.end29
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1646 = icmp sgt i32 %4, 0
br i1 %cmp1646, label %for.cond15.preheader.us.preheader, label %for.end29
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%wide.trip.count65 = zext i32 %10 to i64
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count65, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us.preheader.new
for.cond15.preheader.us.preheader.new: ; preds = %for.cond15.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count65, 4294967294
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader.new
%indvars.iv62 = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%count.051.us = phi i32 [ 0, %for.cond15.preheader.us.preheader.new ], [ %count.1.us.1, %for.inc27.us.1 ]
%niter = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %niter.next.1, %for.inc27.us.1 ]
%arrayidx19.us = getelementptr inbounds [100 x i32], ptr %T, i64 0, i64 %indvars.iv62
%6 = load i32, ptr %arrayidx19.us, align 8, !tbaa !5
br label %for.body17.us
for.cond15.us: ; preds = %for.body17.us
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.inc27.us, label %for.body17.us, !llvm.loop !11
for.body17.us: ; preds = %for.cond15.preheader.us, %for.cond15.us
%indvars.iv59 = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next60, %for.cond15.us ]
%arrayidx21.us = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %indvars.iv59
%7 = load i32, ptr %arrayidx21.us, align 4, !tbaa !5
%cmp22.us = icmp eq i32 %6, %7
br i1 %cmp22.us, label %if.then.us, label %for.cond15.us
if.then.us: ; preds = %for.body17.us
%inc23.us = add nsw i32 %count.051.us, 1
br label %for.inc27.us
for.inc27.us: ; preds = %for.cond15.us, %if.then.us
%count.1.us = phi i32 [ %inc23.us, %if.then.us ], [ %count.051.us, %for.cond15.us ]
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx19.us.1 = getelementptr inbounds [100 x i32], ptr %T, i64 0, i64 %indvars.iv.next63
%8 = load i32, ptr %arrayidx19.us.1, align 4, !tbaa !5
br label %for.body17.us.1
for.body17.us.1: ; preds = %for.cond15.us.1, %for.inc27.us
%indvars.iv59.1 = phi i64 [ 0, %for.inc27.us ], [ %indvars.iv.next60.1, %for.cond15.us.1 ]
%arrayidx21.us.1 = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %indvars.iv59.1
%9 = load i32, ptr %arrayidx21.us.1, align 4, !tbaa !5
%cmp22.us.1 = icmp eq i32 %8, %9
br i1 %cmp22.us.1, label %if.then.us.1, label %for.cond15.us.1
for.cond15.us.1: ; preds = %for.body17.us.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next60.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc27.us.1, label %for.body17.us.1, !llvm.loop !11
if.then.us.1: ; preds = %for.body17.us.1
%inc23.us.1 = add nsw i32 %count.1.us, 1
br label %for.inc27.us.1
for.inc27.us.1: ; preds = %for.cond15.us.1, %if.then.us.1
%count.1.us.1 = phi i32 [ %inc23.us.1, %if.then.us.1 ], [ %count.1.us, %for.cond15.us.1 ]
%indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 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.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [100 x i32], ptr %T, i64 0, i64 %indvars.iv56
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%10 = load i32, ptr %q, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next57, %11
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end29.loopexit.unr-lcssa: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader
%count.1.us.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.preheader ], [ %count.1.us.1, %for.inc27.us.1 ]
%indvars.iv62.unr = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%count.051.us.unr = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %count.1.us.1, %for.inc27.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.cond15.preheader.us.epil
for.cond15.preheader.us.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx19.us.epil = getelementptr inbounds [100 x i32], ptr %T, i64 0, i64 %indvars.iv62.unr
%12 = load i32, ptr %arrayidx19.us.epil, align 4, !tbaa !5
br label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond15.us.epil, %for.cond15.preheader.us.epil
%indvars.iv59.epil = phi i64 [ 0, %for.cond15.preheader.us.epil ], [ %indvars.iv.next60.epil, %for.cond15.us.epil ]
%arrayidx21.us.epil = getelementptr inbounds [100 x i32], ptr %S, i64 0, i64 %indvars.iv59.epil
%13 = load i32, ptr %arrayidx21.us.epil, align 4, !tbaa !5
%cmp22.us.epil = icmp eq i32 %12, %13
br i1 %cmp22.us.epil, label %if.then.us.epil, label %for.cond15.us.epil
for.cond15.us.epil: ; preds = %for.body17.us.epil
%indvars.iv.next60.epil = add nuw nsw i64 %indvars.iv59.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next60.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end29, label %for.body17.us.epil, !llvm.loop !11
if.then.us.epil: ; preds = %for.body17.us.epil
%inc23.us.epil = add nsw i32 %count.051.us.unr, 1
br label %for.end29
for.end29: ; preds = %for.end29.loopexit.unr-lcssa, %for.cond15.us.epil, %if.then.us.epil, %for.end, %for.cond15.preheader.lr.ph, %for.cond12.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.cond15.preheader.lr.ph ], [ 0, %for.end ], [ %count.1.us.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %inc23.us.epil, %if.then.us.epil ], [ %count.051.us.unr, %for.cond15.us.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %S) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(void)
{
int n, s[100], q, t[100], c=0,i,j;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &s[i]);
scanf("%d", &q);
for (i = 0; i < q; i++)
scanf("%d", &t[i]);
for (i = 0; i < q; i++){
for (j = 0; j < n; j++){
if (t[i]==s[j]){
c++;
break;
}
}
}
printf("%d\n", c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325930/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325930/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = alloca [100 x i32], align 16
%q = alloca i32, align 4
%t = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, 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 [100 x i32], ptr %s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp444 = icmp sgt i32 %3, 0
br i1 %cmp444, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1348 = icmp sgt i32 %10, 0
br i1 %cmp1348, label %for.cond15.preheader.lr.ph, label %for.end29
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1646 = icmp sgt i32 %4, 0
br i1 %cmp1646, label %for.cond15.preheader.us.preheader, label %for.end29
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%wide.trip.count65 = zext i32 %10 to i64
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count65, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us.preheader.new
for.cond15.preheader.us.preheader.new: ; preds = %for.cond15.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count65, 4294967294
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader.new
%indvars.iv62 = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%c.049.us = phi i32 [ 0, %for.cond15.preheader.us.preheader.new ], [ %c.1.us.1, %for.inc27.us.1 ]
%niter = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %niter.next.1, %for.inc27.us.1 ]
%arrayidx19.us = getelementptr inbounds [100 x i32], ptr %t, i64 0, i64 %indvars.iv62
%6 = load i32, ptr %arrayidx19.us, align 8, !tbaa !5
br label %for.body17.us
for.cond15.us: ; preds = %for.body17.us
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.inc27.us, label %for.body17.us, !llvm.loop !11
for.body17.us: ; preds = %for.cond15.preheader.us, %for.cond15.us
%indvars.iv59 = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next60, %for.cond15.us ]
%arrayidx21.us = getelementptr inbounds [100 x i32], ptr %s, i64 0, i64 %indvars.iv59
%7 = load i32, ptr %arrayidx21.us, align 4, !tbaa !5
%cmp22.us = icmp eq i32 %6, %7
br i1 %cmp22.us, label %if.then.us, label %for.cond15.us
if.then.us: ; preds = %for.body17.us
%inc23.us = add nsw i32 %c.049.us, 1
br label %for.inc27.us
for.inc27.us: ; preds = %for.cond15.us, %if.then.us
%c.1.us = phi i32 [ %inc23.us, %if.then.us ], [ %c.049.us, %for.cond15.us ]
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx19.us.1 = getelementptr inbounds [100 x i32], ptr %t, i64 0, i64 %indvars.iv.next63
%8 = load i32, ptr %arrayidx19.us.1, align 4, !tbaa !5
br label %for.body17.us.1
for.body17.us.1: ; preds = %for.cond15.us.1, %for.inc27.us
%indvars.iv59.1 = phi i64 [ 0, %for.inc27.us ], [ %indvars.iv.next60.1, %for.cond15.us.1 ]
%arrayidx21.us.1 = getelementptr inbounds [100 x i32], ptr %s, i64 0, i64 %indvars.iv59.1
%9 = load i32, ptr %arrayidx21.us.1, align 4, !tbaa !5
%cmp22.us.1 = icmp eq i32 %8, %9
br i1 %cmp22.us.1, label %if.then.us.1, label %for.cond15.us.1
for.cond15.us.1: ; preds = %for.body17.us.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next60.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc27.us.1, label %for.body17.us.1, !llvm.loop !11
if.then.us.1: ; preds = %for.body17.us.1
%inc23.us.1 = add nsw i32 %c.1.us, 1
br label %for.inc27.us.1
for.inc27.us.1: ; preds = %for.cond15.us.1, %if.then.us.1
%c.1.us.1 = phi i32 [ %inc23.us.1, %if.then.us.1 ], [ %c.1.us, %for.cond15.us.1 ]
%indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 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.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [100 x i32], ptr %t, i64 0, i64 %indvars.iv56
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%10 = load i32, ptr %q, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next57, %11
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end29.loopexit.unr-lcssa: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader
%c.1.us.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.preheader ], [ %c.1.us.1, %for.inc27.us.1 ]
%indvars.iv62.unr = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%c.049.us.unr = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %c.1.us.1, %for.inc27.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.cond15.preheader.us.epil
for.cond15.preheader.us.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx19.us.epil = getelementptr inbounds [100 x i32], ptr %t, i64 0, i64 %indvars.iv62.unr
%12 = load i32, ptr %arrayidx19.us.epil, align 4, !tbaa !5
br label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond15.us.epil, %for.cond15.preheader.us.epil
%indvars.iv59.epil = phi i64 [ 0, %for.cond15.preheader.us.epil ], [ %indvars.iv.next60.epil, %for.cond15.us.epil ]
%arrayidx21.us.epil = getelementptr inbounds [100 x i32], ptr %s, i64 0, i64 %indvars.iv59.epil
%13 = load i32, ptr %arrayidx21.us.epil, align 4, !tbaa !5
%cmp22.us.epil = icmp eq i32 %12, %13
br i1 %cmp22.us.epil, label %if.then.us.epil, label %for.cond15.us.epil
for.cond15.us.epil: ; preds = %for.body17.us.epil
%indvars.iv.next60.epil = add nuw nsw i64 %indvars.iv59.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next60.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end29, label %for.body17.us.epil, !llvm.loop !11
if.then.us.epil: ; preds = %for.body17.us.epil
%inc23.us.epil = add nsw i32 %c.049.us.unr, 1
br label %for.end29
for.end29: ; preds = %for.end29.loopexit.unr-lcssa, %for.cond15.us.epil, %if.then.us.epil, %for.end, %for.cond15.preheader.lr.ph, %for.cond12.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.cond15.preheader.lr.ph ], [ 0, %for.end ], [ %c.1.us.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %inc23.us.epil, %if.then.us.epil ], [ %c.049.us.unr, %for.cond15.us.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
#include<math.h>
//#include<string.h>
//#include<time.h>
//#define pi acos(-1.0)
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
int main(){
int n, i,a[100],b[100],m,j,c;
fscanf(stdin, "%d", &n);
for (i = 0; i < n; i++) fscanf(stdin, "%d", &a[i]);
fscanf(stdin, "%d", &m);
for (i = 0; i < m; i++) fscanf(stdin, "%d", &b[i]);
for(i=c=0;i<m;i++)
for(j=0;j<n;j++)
if (a[j] == b[i]) { c++; break; }
P(d, c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_325974/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_325974/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [100 x i32], align 16
%b = alloca [100 x i32], align 16
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %0, ptr noundef nonnull @.str, ptr noundef nonnull %n) #4
%1 = load i32, ptr %n, align 4, !tbaa !9
%cmp42 = icmp sgt i32 %1, 0
br i1 %cmp42, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%2 = load ptr, ptr @stdin, align 8, !tbaa !5
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %2, ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) #4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !9
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%5 = load ptr, ptr @stdin, align 8, !tbaa !5
%call2 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %5, ptr noundef nonnull @.str, ptr noundef nonnull %m) #4
%6 = load i32, ptr %m, align 4, !tbaa !9
%cmp444 = icmp sgt i32 %6, 0
br i1 %cmp444, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1348 = icmp sgt i32 %14, 0
br i1 %cmp1348, label %for.cond15.preheader.lr.ph, label %for.end29
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%7 = load i32, ptr %n, align 4, !tbaa !9
%cmp1646 = icmp sgt i32 %7, 0
br i1 %cmp1646, label %for.cond15.preheader.us.preheader, label %for.end29
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%wide.trip.count65 = zext i32 %14 to i64
%wide.trip.count = zext i32 %7 to i64
%xtraiter = and i64 %wide.trip.count65, 1
%8 = icmp eq i32 %14, 1
br i1 %8, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us.preheader.new
for.cond15.preheader.us.preheader.new: ; preds = %for.cond15.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count65, 4294967294
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader.new
%indvars.iv62 = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%c.051.us = phi i32 [ 0, %for.cond15.preheader.us.preheader.new ], [ %c.1.us.1, %for.inc27.us.1 ]
%niter = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %niter.next.1, %for.inc27.us.1 ]
%arrayidx21.us = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv62
%9 = load i32, ptr %arrayidx21.us, align 8, !tbaa !9
br label %for.body17.us
for.cond15.us: ; preds = %for.body17.us
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.inc27.us, label %for.body17.us, !llvm.loop !13
for.body17.us: ; preds = %for.cond15.preheader.us, %for.cond15.us
%indvars.iv59 = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next60, %for.cond15.us ]
%arrayidx19.us = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv59
%10 = load i32, ptr %arrayidx19.us, align 4, !tbaa !9
%cmp22.us = icmp eq i32 %10, %9
br i1 %cmp22.us, label %if.then.us, label %for.cond15.us
if.then.us: ; preds = %for.body17.us
%inc23.us = add nsw i32 %c.051.us, 1
br label %for.inc27.us
for.inc27.us: ; preds = %for.cond15.us, %if.then.us
%c.1.us = phi i32 [ %inc23.us, %if.then.us ], [ %c.051.us, %for.cond15.us ]
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx21.us.1 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv.next63
%11 = load i32, ptr %arrayidx21.us.1, align 4, !tbaa !9
br label %for.body17.us.1
for.body17.us.1: ; preds = %for.cond15.us.1, %for.inc27.us
%indvars.iv59.1 = phi i64 [ 0, %for.inc27.us ], [ %indvars.iv.next60.1, %for.cond15.us.1 ]
%arrayidx19.us.1 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv59.1
%12 = load i32, ptr %arrayidx19.us.1, align 4, !tbaa !9
%cmp22.us.1 = icmp eq i32 %12, %11
br i1 %cmp22.us.1, label %if.then.us.1, label %for.cond15.us.1
for.cond15.us.1: ; preds = %for.body17.us.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next60.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc27.us.1, label %for.body17.us.1, !llvm.loop !13
if.then.us.1: ; preds = %for.body17.us.1
%inc23.us.1 = add nsw i32 %c.1.us, 1
br label %for.inc27.us.1
for.inc27.us.1: ; preds = %for.cond15.us.1, %if.then.us.1
%c.1.us.1 = phi i32 [ %inc23.us.1, %if.then.us.1 ], [ %c.1.us, %for.cond15.us.1 ]
%indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 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.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us, !llvm.loop !14
for.body5: ; preds = %for.end, %for.body5
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body5 ], [ 0, %for.end ]
%13 = load ptr, ptr @stdin, align 8, !tbaa !5
%arrayidx7 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv56
%call8 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %13, ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7) #4
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%14 = load i32, ptr %m, align 4, !tbaa !9
%15 = sext i32 %14 to i64
%cmp4 = icmp slt i64 %indvars.iv.next57, %15
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !15
for.end29.loopexit.unr-lcssa: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader
%c.1.us.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.preheader ], [ %c.1.us.1, %for.inc27.us.1 ]
%indvars.iv62.unr = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%c.051.us.unr = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %c.1.us.1, %for.inc27.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.cond15.preheader.us.epil
for.cond15.preheader.us.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx21.us.epil = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv62.unr
%16 = load i32, ptr %arrayidx21.us.epil, align 4, !tbaa !9
br label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond15.us.epil, %for.cond15.preheader.us.epil
%indvars.iv59.epil = phi i64 [ 0, %for.cond15.preheader.us.epil ], [ %indvars.iv.next60.epil, %for.cond15.us.epil ]
%arrayidx19.us.epil = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv59.epil
%17 = load i32, ptr %arrayidx19.us.epil, align 4, !tbaa !9
%cmp22.us.epil = icmp eq i32 %17, %16
br i1 %cmp22.us.epil, label %if.then.us.epil, label %for.cond15.us.epil
for.cond15.us.epil: ; preds = %for.body17.us.epil
%indvars.iv.next60.epil = add nuw nsw i64 %indvars.iv59.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next60.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end29, label %for.body17.us.epil, !llvm.loop !13
if.then.us.epil: ; preds = %for.body17.us.epil
%inc23.us.epil = add nsw i32 %c.051.us.unr, 1
br label %for.end29
for.end29: ; preds = %for.end29.loopexit.unr-lcssa, %for.cond15.us.epil, %if.then.us.epil, %for.end, %for.cond15.preheader.lr.ph, %for.cond12.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.cond15.preheader.lr.ph ], [ 0, %for.end ], [ %c.1.us.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %inc23.us.epil, %if.then.us.epil ], [ %c.051.us.unr, %for.cond15.us.epil ]
%18 = load ptr, ptr @stdout, align 8, !tbaa !5
%call30 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str.1, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, 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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
|
#include<stdio.h>
int main(){
int n[200000],q[100000],a,i,c=0,k;
scanf("%d",&a);
for(i=0;i<a;i++){
scanf("%d",&n[i]);
}
int p1=i;
scanf("%d",&a);
for(int i=0;i<a;i++){
scanf("%d",&q[i]);
}
int p2=i;
for(i=0;i<p1;i++){
for(k=0;k<p2;k++){
if(n[k]==q[i]){
c++;
break;
}
}
}
printf("%d\n",c);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326016/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326016/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca [200000 x i32], align 16
%q = alloca [100000 x i32], align 16
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp44 = icmp sgt i32 %0, 0
br i1 %cmp44, 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 [200000 x i32], ptr %n, 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 %a, 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 !9
for.end.loopexit: ; preds = %for.body
%3 = trunc i64 %indvars.iv.next to i32
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%i.0.lcssa = phi i32 [ 0, %entry ], [ %3, %for.end.loopexit ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%4 = load i32, ptr %a, align 4, !tbaa !5
%cmp546 = icmp sgt i32 %4, 0
br i1 %cmp546, label %for.body6, label %for.cond13.preheader
for.cond13.preheader: ; preds = %for.body6, %for.end
%cmp1449.not = icmp eq i32 %i.0.lcssa, 0
br i1 %cmp1449.not, label %for.end30, label %for.cond16.preheader.preheader
for.cond16.preheader.preheader: ; preds = %for.cond13.preheader
%wide.trip.count63 = zext i32 %i.0.lcssa to i64
%xtraiter = and i64 %wide.trip.count63, 1
%5 = icmp eq i32 %i.0.lcssa, 1
br i1 %5, label %for.end30.loopexit.unr-lcssa, label %for.cond16.preheader.preheader.new
for.cond16.preheader.preheader.new: ; preds = %for.cond16.preheader.preheader
%unroll_iter = and i64 %wide.trip.count63, 4294967294
br label %for.cond16.preheader
for.body6: ; preds = %for.end, %for.body6
%indvars.iv54 = phi i64 [ %indvars.iv.next55, %for.body6 ], [ 0, %for.end ]
%arrayidx8 = getelementptr inbounds [100000 x i32], ptr %q, i64 0, i64 %indvars.iv54
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8)
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%6 = load i32, ptr %a, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp5 = icmp slt i64 %indvars.iv.next55, %7
br i1 %cmp5, label %for.body6, label %for.cond13.preheader, !llvm.loop !11
for.cond16.preheader: ; preds = %for.inc28.1, %for.cond16.preheader.preheader.new
%indvars.iv60 = phi i64 [ 0, %for.cond16.preheader.preheader.new ], [ %indvars.iv.next61.1, %for.inc28.1 ]
%c.050 = phi i32 [ 0, %for.cond16.preheader.preheader.new ], [ %c.1.1, %for.inc28.1 ]
%niter = phi i64 [ 0, %for.cond16.preheader.preheader.new ], [ %niter.next.1, %for.inc28.1 ]
%arrayidx22 = getelementptr inbounds [100000 x i32], ptr %q, i64 0, i64 %indvars.iv60
%8 = load i32, ptr %arrayidx22, align 8, !tbaa !5
br label %for.body18
for.cond16: ; preds = %for.body18
%indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
%exitcond.not = icmp eq i64 %indvars.iv.next58, %wide.trip.count63
br i1 %exitcond.not, label %for.inc28, label %for.body18, !llvm.loop !12
for.body18: ; preds = %for.cond16.preheader, %for.cond16
%indvars.iv57 = phi i64 [ 0, %for.cond16.preheader ], [ %indvars.iv.next58, %for.cond16 ]
%arrayidx20 = getelementptr inbounds [200000 x i32], ptr %n, i64 0, i64 %indvars.iv57
%9 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp23 = icmp eq i32 %9, %8
br i1 %cmp23, label %if.then, label %for.cond16
if.then: ; preds = %for.body18
%inc24 = add nsw i32 %c.050, 1
br label %for.inc28
for.inc28: ; preds = %for.cond16, %if.then
%c.1 = phi i32 [ %inc24, %if.then ], [ %c.050, %for.cond16 ]
%indvars.iv.next61 = or i64 %indvars.iv60, 1
%arrayidx22.1 = getelementptr inbounds [100000 x i32], ptr %q, i64 0, i64 %indvars.iv.next61
%10 = load i32, ptr %arrayidx22.1, align 4, !tbaa !5
br label %for.body18.1
for.body18.1: ; preds = %for.cond16.1, %for.inc28
%indvars.iv57.1 = phi i64 [ 0, %for.inc28 ], [ %indvars.iv.next58.1, %for.cond16.1 ]
%arrayidx20.1 = getelementptr inbounds [200000 x i32], ptr %n, i64 0, i64 %indvars.iv57.1
%11 = load i32, ptr %arrayidx20.1, align 4, !tbaa !5
%cmp23.1 = icmp eq i32 %11, %10
br i1 %cmp23.1, label %if.then.1, label %for.cond16.1
for.cond16.1: ; preds = %for.body18.1
%indvars.iv.next58.1 = add nuw nsw i64 %indvars.iv57.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next58.1, %wide.trip.count63
br i1 %exitcond.not.1, label %for.inc28.1, label %for.body18.1, !llvm.loop !12
if.then.1: ; preds = %for.body18.1
%inc24.1 = add nsw i32 %c.1, 1
br label %for.inc28.1
for.inc28.1: ; preds = %for.cond16.1, %if.then.1
%c.1.1 = phi i32 [ %inc24.1, %if.then.1 ], [ %c.1, %for.cond16.1 ]
%indvars.iv.next61.1 = add nuw nsw i64 %indvars.iv60, 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.end30.loopexit.unr-lcssa, label %for.cond16.preheader, !llvm.loop !13
for.end30.loopexit.unr-lcssa: ; preds = %for.inc28.1, %for.cond16.preheader.preheader
%c.1.lcssa.ph = phi i32 [ undef, %for.cond16.preheader.preheader ], [ %c.1.1, %for.inc28.1 ]
%indvars.iv60.unr = phi i64 [ 0, %for.cond16.preheader.preheader ], [ %indvars.iv.next61.1, %for.inc28.1 ]
%c.050.unr = phi i32 [ 0, %for.cond16.preheader.preheader ], [ %c.1.1, %for.inc28.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end30, label %for.cond16.preheader.epil
for.cond16.preheader.epil: ; preds = %for.end30.loopexit.unr-lcssa
%arrayidx22.epil = getelementptr inbounds [100000 x i32], ptr %q, i64 0, i64 %indvars.iv60.unr
%12 = load i32, ptr %arrayidx22.epil, align 4, !tbaa !5
br label %for.body18.epil
for.body18.epil: ; preds = %for.cond16.epil, %for.cond16.preheader.epil
%indvars.iv57.epil = phi i64 [ 0, %for.cond16.preheader.epil ], [ %indvars.iv.next58.epil, %for.cond16.epil ]
%arrayidx20.epil = getelementptr inbounds [200000 x i32], ptr %n, i64 0, i64 %indvars.iv57.epil
%13 = load i32, ptr %arrayidx20.epil, align 4, !tbaa !5
%cmp23.epil = icmp eq i32 %13, %12
br i1 %cmp23.epil, label %if.then.epil, label %for.cond16.epil
for.cond16.epil: ; preds = %for.body18.epil
%indvars.iv.next58.epil = add nuw nsw i64 %indvars.iv57.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next58.epil, %wide.trip.count63
br i1 %exitcond.not.epil, label %for.end30, label %for.body18.epil, !llvm.loop !12
if.then.epil: ; preds = %for.body18.epil
%inc24.epil = add nsw i32 %c.050.unr, 1
br label %for.end30
for.end30: ; preds = %for.end30.loopexit.unr-lcssa, %for.cond16.epil, %if.then.epil, %for.cond13.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond13.preheader ], [ %c.1.lcssa.ph, %for.end30.loopexit.unr-lcssa ], [ %inc24.epil, %if.then.epil ], [ %c.050.unr, %for.cond16.epil ]
%call31 = 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 %a) #3
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include "stdio.h"
int main(void){
int i,j,n,q,count=0,S[200],T[200];
scanf(" %d",&n);
for(i=0;i<n;i++){
scanf(" %d",&S[i]);
}
scanf(" %d",&q);
for(i=0;i<q;i++){
scanf(" %d",&T[i]);
}
for(i=0;i<q;i++){
for(j=0;j<n;j++){
if(S[j]==T[i]){
count++;
break;
}
}
}
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326067/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326067/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%S = alloca [200 x i32], align 16
%T = alloca [200 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %T) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp42 = icmp sgt i32 %0, 0
br i1 %cmp42, 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 [200 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp444 = icmp sgt i32 %3, 0
br i1 %cmp444, label %for.body5, label %for.end29
for.cond12.preheader: ; preds = %for.body5
%cmp1348 = icmp sgt i32 %10, 0
br i1 %cmp1348, label %for.cond15.preheader.lr.ph, label %for.end29
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1646 = icmp sgt i32 %4, 0
br i1 %cmp1646, label %for.cond15.preheader.us.preheader, label %for.end29
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%wide.trip.count65 = zext i32 %10 to i64
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count65, 1
%5 = icmp eq i32 %10, 1
br i1 %5, label %for.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us.preheader.new
for.cond15.preheader.us.preheader.new: ; preds = %for.cond15.preheader.us.preheader
%unroll_iter = and i64 %wide.trip.count65, 4294967294
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader.new
%indvars.iv62 = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%count.051.us = phi i32 [ 0, %for.cond15.preheader.us.preheader.new ], [ %count.1.us.1, %for.inc27.us.1 ]
%niter = phi i64 [ 0, %for.cond15.preheader.us.preheader.new ], [ %niter.next.1, %for.inc27.us.1 ]
%arrayidx21.us = getelementptr inbounds [200 x i32], ptr %T, i64 0, i64 %indvars.iv62
%6 = load i32, ptr %arrayidx21.us, align 8, !tbaa !5
br label %for.body17.us
for.cond15.us: ; preds = %for.body17.us
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.inc27.us, label %for.body17.us, !llvm.loop !11
for.body17.us: ; preds = %for.cond15.preheader.us, %for.cond15.us
%indvars.iv59 = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next60, %for.cond15.us ]
%arrayidx19.us = getelementptr inbounds [200 x i32], ptr %S, i64 0, i64 %indvars.iv59
%7 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5
%cmp22.us = icmp eq i32 %7, %6
br i1 %cmp22.us, label %if.then.us, label %for.cond15.us
if.then.us: ; preds = %for.body17.us
%inc23.us = add nsw i32 %count.051.us, 1
br label %for.inc27.us
for.inc27.us: ; preds = %for.cond15.us, %if.then.us
%count.1.us = phi i32 [ %inc23.us, %if.then.us ], [ %count.051.us, %for.cond15.us ]
%indvars.iv.next63 = or i64 %indvars.iv62, 1
%arrayidx21.us.1 = getelementptr inbounds [200 x i32], ptr %T, i64 0, i64 %indvars.iv.next63
%8 = load i32, ptr %arrayidx21.us.1, align 4, !tbaa !5
br label %for.body17.us.1
for.body17.us.1: ; preds = %for.cond15.us.1, %for.inc27.us
%indvars.iv59.1 = phi i64 [ 0, %for.inc27.us ], [ %indvars.iv.next60.1, %for.cond15.us.1 ]
%arrayidx19.us.1 = getelementptr inbounds [200 x i32], ptr %S, i64 0, i64 %indvars.iv59.1
%9 = load i32, ptr %arrayidx19.us.1, align 4, !tbaa !5
%cmp22.us.1 = icmp eq i32 %9, %8
br i1 %cmp22.us.1, label %if.then.us.1, label %for.cond15.us.1
for.cond15.us.1: ; preds = %for.body17.us.1
%indvars.iv.next60.1 = add nuw nsw i64 %indvars.iv59.1, 1
%exitcond.not.1 = icmp eq i64 %indvars.iv.next60.1, %wide.trip.count
br i1 %exitcond.not.1, label %for.inc27.us.1, label %for.body17.us.1, !llvm.loop !11
if.then.us.1: ; preds = %for.body17.us.1
%inc23.us.1 = add nsw i32 %count.1.us, 1
br label %for.inc27.us.1
for.inc27.us.1: ; preds = %for.cond15.us.1, %if.then.us.1
%count.1.us.1 = phi i32 [ %inc23.us.1, %if.then.us.1 ], [ %count.1.us, %for.cond15.us.1 ]
%indvars.iv.next63.1 = add nuw nsw i64 %indvars.iv62, 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.end29.loopexit.unr-lcssa, label %for.cond15.preheader.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [200 x i32], ptr %T, i64 0, i64 %indvars.iv56
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%10 = load i32, ptr %q, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp4 = icmp slt i64 %indvars.iv.next57, %11
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end29.loopexit.unr-lcssa: ; preds = %for.inc27.us.1, %for.cond15.preheader.us.preheader
%count.1.us.lcssa.ph = phi i32 [ undef, %for.cond15.preheader.us.preheader ], [ %count.1.us.1, %for.inc27.us.1 ]
%indvars.iv62.unr = phi i64 [ 0, %for.cond15.preheader.us.preheader ], [ %indvars.iv.next63.1, %for.inc27.us.1 ]
%count.051.us.unr = phi i32 [ 0, %for.cond15.preheader.us.preheader ], [ %count.1.us.1, %for.inc27.us.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.cond15.preheader.us.epil
for.cond15.preheader.us.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx21.us.epil = getelementptr inbounds [200 x i32], ptr %T, i64 0, i64 %indvars.iv62.unr
%12 = load i32, ptr %arrayidx21.us.epil, align 4, !tbaa !5
br label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond15.us.epil, %for.cond15.preheader.us.epil
%indvars.iv59.epil = phi i64 [ 0, %for.cond15.preheader.us.epil ], [ %indvars.iv.next60.epil, %for.cond15.us.epil ]
%arrayidx19.us.epil = getelementptr inbounds [200 x i32], ptr %S, i64 0, i64 %indvars.iv59.epil
%13 = load i32, ptr %arrayidx19.us.epil, align 4, !tbaa !5
%cmp22.us.epil = icmp eq i32 %13, %12
br i1 %cmp22.us.epil, label %if.then.us.epil, label %for.cond15.us.epil
for.cond15.us.epil: ; preds = %for.body17.us.epil
%indvars.iv.next60.epil = add nuw nsw i64 %indvars.iv59.epil, 1
%exitcond.not.epil = icmp eq i64 %indvars.iv.next60.epil, %wide.trip.count
br i1 %exitcond.not.epil, label %for.end29, label %for.body17.us.epil, !llvm.loop !11
if.then.us.epil: ; preds = %for.body17.us.epil
%inc23.us.epil = add nsw i32 %count.051.us.unr, 1
br label %for.end29
for.end29: ; preds = %for.end29.loopexit.unr-lcssa, %for.cond15.us.epil, %if.then.us.epil, %for.end, %for.cond15.preheader.lr.ph, %for.cond12.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.cond15.preheader.lr.ph ], [ 0, %for.end ], [ %count.1.us.lcssa.ph, %for.end29.loopexit.unr-lcssa ], [ %inc23.us.epil, %if.then.us.epil ], [ %count.051.us.unr, %for.cond15.us.epil ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %S) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(void)
{
int n, q, c, tmp, s[501];
int i, j;
for (i = 0; i < 501; i++){
s[i] = 0;
}
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%d", &tmp);
s[tmp] = tmp;
}
scanf("%d", &q);
c = 0;
for (j = 0; j < q; j++){
scanf("%d", &tmp);
if (s[tmp] == tmp){
c++;
}
}
printf("%d\n", c);
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326117/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326117/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%tmp = alloca i32, align 4
%s = alloca [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 %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tmp) #4
call void @llvm.lifetime.start.p0(i64 2004, ptr nonnull %s) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2004) %s, i8 0, i64 2004, i1 false), !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
%cmp230 = icmp sgt i32 %0, 0
br i1 %cmp230, label %for.body3, label %for.end9
for.body3: ; preds = %entry, %for.body3
%i.131 = phi i32 [ %inc8, %for.body3 ], [ 0, %entry ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %tmp)
%1 = load i32, ptr %tmp, align 4, !tbaa !5
%idxprom5 = sext i32 %1 to i64
%arrayidx6 = getelementptr inbounds [501 x i32], ptr %s, i64 0, i64 %idxprom5
store i32 %1, ptr %arrayidx6, align 4, !tbaa !5
%inc8 = add nuw nsw i32 %i.131, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc8, %2
br i1 %cmp2, label %for.body3, label %for.end9, !llvm.loop !9
for.end9: ; preds = %for.body3, %entry
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp1232 = icmp sgt i32 %3, 0
br i1 %cmp1232, label %for.body13, label %for.end21
for.body13: ; preds = %for.end9, %for.body13
%j.034 = phi i32 [ %inc20, %for.body13 ], [ 0, %for.end9 ]
%c.033 = phi i32 [ %spec.select, %for.body13 ], [ 0, %for.end9 ]
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %tmp)
%4 = load i32, ptr %tmp, align 4, !tbaa !5
%idxprom15 = sext i32 %4 to i64
%arrayidx16 = getelementptr inbounds [501 x i32], ptr %s, i64 0, i64 %idxprom15
%5 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%cmp17 = icmp eq i32 %5, %4
%inc18 = zext i1 %cmp17 to i32
%spec.select = add nuw nsw i32 %c.033, %inc18
%inc20 = add nuw nsw i32 %j.034, 1
%6 = load i32, ptr %q, align 4, !tbaa !5
%cmp12 = icmp slt i32 %inc20, %6
br i1 %cmp12, label %for.body13, label %for.end21, !llvm.loop !11
for.end21: ; preds = %for.body13, %for.end9
%c.0.lcssa = phi i32 [ 0, %for.end9 ], [ %spec.select, %for.body13 ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 2004, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tmp) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void)
{
int n;
int s[500];
int i, buf, cnt;
for (i = 0; i < 500; i++) {
s[i] = 0;
}
cnt = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &buf);
s[buf] = 1;
}
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &buf);
if (s[buf]) {
cnt++;
}
}
printf("%d\n", cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326160/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326160/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = alloca [500 x i32], align 16
%buf = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %buf) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2000) %s, i8 0, i64 2000, i1 false), !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
%cmp230 = icmp sgt i32 %0, 0
br i1 %cmp230, label %for.body3, label %for.end9
for.body3: ; preds = %entry, %for.body3
%i.131 = phi i32 [ %inc8, %for.body3 ], [ 0, %entry ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %buf)
%1 = load i32, ptr %buf, align 4, !tbaa !5
%idxprom5 = sext i32 %1 to i64
%arrayidx6 = getelementptr inbounds [500 x i32], ptr %s, i64 0, i64 %idxprom5
store i32 1, ptr %arrayidx6, align 4, !tbaa !5
%inc8 = add nuw nsw i32 %i.131, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc8, %2
br i1 %cmp2, label %for.body3, label %for.end9, !llvm.loop !9
for.end9: ; preds = %for.body3, %entry
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp1232 = icmp sgt i32 %3, 0
br i1 %cmp1232, label %for.body13, label %for.end20
for.body13: ; preds = %for.end9, %for.body13
%cnt.034 = phi i32 [ %spec.select, %for.body13 ], [ 0, %for.end9 ]
%i.233 = phi i32 [ %inc19, %for.body13 ], [ 0, %for.end9 ]
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %buf)
%4 = load i32, ptr %buf, align 4, !tbaa !5
%idxprom15 = sext i32 %4 to i64
%arrayidx16 = getelementptr inbounds [500 x i32], ptr %s, i64 0, i64 %idxprom15
%5 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%tobool.not = icmp ne i32 %5, 0
%inc17 = zext i1 %tobool.not to i32
%spec.select = add nuw nsw i32 %cnt.034, %inc17
%inc19 = add nuw nsw i32 %i.233, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp12 = icmp slt i32 %inc19, %6
br i1 %cmp12, label %for.body13, label %for.end20, !llvm.loop !11
for.end20: ; preds = %for.body13, %for.end9
%cnt.0.lcssa = phi i32 [ 0, %for.end9 ], [ %spec.select, %for.body13 ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %buf) #4
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(){
int num;
double kg, m;
while(scanf("%d,%lf,%lf", &num, &kg, &m) != EOF){
if(kg / m / m >= 25.0) printf("%d\n", num);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326203/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326203/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [11 x i8] c"%d,%lf,%lf\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:
%num = alloca i32, align 4
%kg = alloca double, align 8
%m = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %kg) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #3
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num, ptr noundef nonnull %kg, ptr noundef nonnull %m)
%cmp.not5 = icmp eq i32 %call4, -1
br i1 %cmp.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%0 = load double, ptr %kg, align 8, !tbaa !5
%1 = load double, ptr %m, align 8, !tbaa !5
%div = fdiv double %0, %1
%div1 = fdiv double %div, %1
%cmp2 = fcmp ult double %div1, 2.500000e+01
br i1 %cmp2, label %if.end, label %if.then
if.then: ; preds = %while.body
%2 = load i32, ptr %num, align 4, !tbaa !9
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
br label %if.end
if.end: ; preds = %if.then, %while.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num, ptr noundef nonnull %kg, ptr noundef nonnull %m)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %kg) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<math.h>
int main(){
int num;
double kg,m;
while(scanf("%d,%lf,%lf",&num,&kg,&m)!=EOF){
if(25<=kg/(m*m))
printf("%d\n",num);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326276/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326276/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [11 x i8] c"%d,%lf,%lf\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:
%num = alloca i32, align 4
%kg = alloca double, align 8
%m = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %kg) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #3
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num, ptr noundef nonnull %kg, ptr noundef nonnull %m)
%cmp.not4 = icmp eq i32 %call3, -1
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%0 = load double, ptr %kg, align 8, !tbaa !5
%1 = load double, ptr %m, align 8, !tbaa !5
%mul = fmul double %1, %1
%div = fdiv double %0, %mul
%cmp1 = fcmp ult double %div, 2.500000e+01
br i1 %cmp1, label %if.end, label %if.then
if.then: ; preds = %while.body
%2 = load i32, ptr %num, align 4, !tbaa !9
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
br label %if.end
if.end: ; preds = %if.then, %while.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num, ptr noundef nonnull %kg, ptr noundef nonnull %m)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %kg) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
double get_bmi(double h, double w){
return (w / (h * h));
}
int is_dangerous(double h, double w){
return (get_bmi(h, w) >= 25.0);
}
int main(void)
{
int sid;
double weight, height;
while (~scanf("%d,%lf,%lf", &sid, &weight, &height)){
if (is_dangerous(height, weight)) printf("%d\n", sid);
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326319/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326319/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [11 x i8] c"%d,%lf,%lf\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @get_bmi(double noundef %h, double noundef %w) local_unnamed_addr #0 {
entry:
%mul = fmul double %h, %h
%div = fdiv double %w, %mul
ret double %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @is_dangerous(double noundef %h, double noundef %w) local_unnamed_addr #0 {
entry:
%mul.i = fmul double %h, %h
%div.i = fdiv double %w, %mul.i
%cmp = fcmp oge double %div.i, 2.500000e+01
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%sid = alloca i32, align 4
%weight = alloca double, align 8
%height = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %sid) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %weight) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %height) #4
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sid, ptr noundef nonnull %weight, ptr noundef nonnull %height)
%tobool.not5 = icmp eq i32 %call4, -1
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%0 = load double, ptr %height, align 8, !tbaa !5
%1 = load double, ptr %weight, align 8, !tbaa !5
%mul.i.i = fmul double %0, %0
%div.i.i = fdiv double %1, %mul.i.i
%cmp.i = fcmp ult double %div.i.i, 2.500000e+01
br i1 %cmp.i, label %if.end, label %if.then
if.then: ; preds = %while.body
%2 = load i32, ptr %sid, align 4, !tbaa !9
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
br label %if.end
if.end: ; preds = %if.then, %while.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %sid, ptr noundef nonnull %weight, ptr noundef nonnull %height)
%tobool.not = icmp eq i32 %call, -1
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %height) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %weight) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sid) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { 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, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
double w, h, r;
int num;
while (scanf("%d,%lf,%lf", &num,&w, &h)!=EOF)
{
r = w / (h*h);
if (r >= 25.0)
{
printf("%d\n", num);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326362/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326362/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [11 x i8] c"%d,%lf,%lf\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:
%w = alloca double, align 8
%h = alloca double, align 8
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %w) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #3
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num, ptr noundef nonnull %w, ptr noundef nonnull %h)
%cmp.not4 = icmp eq i32 %call3, -1
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%0 = load double, ptr %w, align 8, !tbaa !5
%1 = load double, ptr %h, align 8, !tbaa !5
%mul = fmul double %1, %1
%div = fdiv double %0, %mul
%cmp1 = fcmp ult double %div, 2.500000e+01
br i1 %cmp1, label %if.end, label %if.then
if.then: ; preds = %while.body
%2 = load i32, ptr %num, align 4, !tbaa !9
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
br label %if.end
if.end: ; preds = %if.then, %while.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num, ptr noundef nonnull %w, ptr noundef nonnull %h)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %h) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %w) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main () {
int x, t;
scanf("%d %d", &x, &t);
if (x-t >= 0) {
printf("%d", x-t);
}
else {
printf("0");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326405/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326405/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
%t = 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 %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %t)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %t, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%cmp = icmp sgt i32 %sub, -1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
br label %if.end
if.else: ; preds = %entry
%putchar = call i32 @putchar(i32 48)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int max(int a, int b) {
if (a > b) return a;
else return b;
}
int main() {
int X, t;
scanf("%d%d", &X, &t);
printf("%d\n", max(0, X - t));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326449/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326449/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%X = alloca i32, align 4
%t = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X, ptr noundef nonnull %t)
%0 = load i32, ptr %X, align 4, !tbaa !5
%1 = load i32, ptr %t, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%a.b.i = call i32 @llvm.smax.i32(i32 %sub, i32 0)
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.b.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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.smax.i32(i32, i32) #4
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int a,b;
scanf("%d%d",&a,&b);
if(a>b)
printf("%d\n",a-b);
else
printf("0\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326492/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326492/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\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
%cmp = icmp sgt i32 %0, %1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%sub = sub nsw i32 %0, %1
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
br label %if.end
if.else: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
int main()
{
int o,a,b;
scanf("%d%d",&a,&b);
o = a - b;
if( o<0)o=0;
printf("%d",o);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326535/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326535/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%spec.store.select = call i32 @llvm.smax.i32(i32 %sub, i32 0)
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.store.select)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
unsigned int X;
unsigned int t;
int i;
if(scanf("%u %u", &X, &t)<0)
return -1;
if (X > 0 && t > 0){
i = X - t;
if (i < 0)
i = 0;
printf("%u\n", i);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326579/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326579/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%u %u\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%u\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%X = alloca i32, align 4
%t = 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 %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X, ptr noundef nonnull %t)
%cmp = icmp slt i32 %call, 0
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%0 = load i32, ptr %X, align 4, !tbaa !5
%cmp1 = icmp ne i32 %0, 0
%1 = load i32, ptr %t, align 4
%cmp2 = icmp ne i32 %1, 0
%or.cond = select i1 %cmp1, i1 %cmp2, i1 false
br i1 %or.cond, label %if.then3, label %cleanup
if.then3: ; preds = %if.end
%sub = sub i32 %0, %1
%spec.store.select = call i32 @llvm.smax.i32(i32 %sub, i32 0)
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.store.select)
br label %cleanup
cleanup: ; preds = %if.end, %if.then3, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 0, %if.then3 ], [ 0, %if.end ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #4
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int step(int number){
int answer = 1;
for (int i = 1; i <= number; i++) {
answer *= i;
}
return answer;
}
int main(void){
int n;
scanf("%d", &n);
int p[n];
int q[n];
for (int i = 0; i < n; i++) {
scanf("%d", &p[i]);
}
for (int i = 0; i < n; i++) {
scanf("%d", &q[i]);
}
int p_order = 1;
int less;
for (int i = 0; i < n; i++) {
less = 0;
for (int j = i+1; j < n; j++) {
if (p[i] > p[j]) {
less++;
}
}
p_order += less*step(n-1-i);
}
int q_order = 1;
for (int i = 0; i < n; i++) {
less = 0;
for (int j = i+1; j < n; j++) {
if (q[i] > q[j]) {
less++;
}
}
q_order += less*step(n-1-i);
}
printf("%d\n", abs(q_order-p_order));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326672/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326672/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @step(i32 noundef %number) local_unnamed_addr #0 {
entry:
%cmp.not4 = icmp slt i32 %number, 1
br i1 %cmp.not4, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %number, 8
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %number, -8
%ind.end = or i32 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi8 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = mul <4 x i32> %vec.ind, %vec.phi
%1 = mul <4 x i32> %step.add, %vec.phi8
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !5
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %number
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%i.06.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
%answer.05.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%answer.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %answer.0.lcssa
for.body: ; preds = %for.body.preheader9, %for.body
%i.06 = phi i32 [ %inc, %for.body ], [ %i.06.ph, %for.body.preheader9 ]
%answer.05 = phi i32 [ %mul, %for.body ], [ %answer.05.ph, %for.body.preheader9 ]
%mul = mul nsw i32 %i.06, %answer.05
%inc = add nuw i32 %i.06, 1
%exitcond.not = icmp eq i32 %i.06, %number
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !10
%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 !10
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%cmp102 = icmp sgt i32 %3, 0
br i1 %cmp102, label %for.body, label %for.cond.cleanup41
for.cond4.preheader: ; preds = %for.body
%cmp5104 = icmp sgt i32 %5, 0
br i1 %cmp5104, label %for.body7, label %for.cond.cleanup41
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !10
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !14
for.cond15.preheader: ; preds = %for.body7
%cmp16110 = icmp sgt i32 %8, 0
br i1 %cmp16110, label %for.body18.preheader, label %for.cond.cleanup41
for.body18.preheader: ; preds = %for.cond15.preheader
%7 = zext i32 %8 to i64
%wide.trip.count135 = zext i32 %8 to i64
br label %for.body18
for.body7: ; preds = %for.cond4.preheader, %for.body7
%indvars.iv124 = phi i64 [ %indvars.iv.next125, %for.body7 ], [ 0, %for.cond4.preheader ]
%arrayidx9 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv124
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx9)
%indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
%8 = load i32, ptr %n, align 4, !tbaa !10
%9 = sext i32 %8 to i64
%cmp5 = icmp slt i64 %indvars.iv.next125, %9
br i1 %cmp5, label %for.body7, label %for.cond15.preheader, !llvm.loop !15
for.cond39.preheader: ; preds = %step.exit
br i1 %cmp16110, label %for.body42.preheader, label %for.cond.cleanup41
for.body42.preheader: ; preds = %for.cond39.preheader
%10 = zext i32 %8 to i64
%wide.trip.count147 = zext i32 %8 to i64
br label %for.body42
for.body18: ; preds = %for.body18.preheader, %step.exit
%indvars.iv132 = phi i64 [ 0, %for.body18.preheader ], [ %indvars.iv.next133, %step.exit ]
%indvars.iv127 = phi i64 [ 1, %for.body18.preheader ], [ %indvars.iv.next128, %step.exit ]
%p_order.0111 = phi i32 [ 1, %for.body18.preheader ], [ %add34, %step.exit ]
%11 = xor i64 %indvars.iv132, -1
%12 = add nsw i64 %11, %wide.trip.count135
%13 = trunc i64 %indvars.iv132 to i32
%14 = xor i32 %13, -1
%15 = add i32 %8, %14
%indvars134 = trunc i64 %indvars.iv132 to i32
%indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
%cmp20106 = icmp ult i64 %indvars.iv.next133, %7
br i1 %cmp20106, label %for.body22.lr.ph, label %for.cond.cleanup21
for.body22.lr.ph: ; preds = %for.body18
%arrayidx24 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv132
%16 = load i32, ptr %arrayidx24, align 4, !tbaa !10
%min.iters.check166 = icmp ult i64 %12, 8
br i1 %min.iters.check166, label %for.body22.preheader, label %vector.ph167
vector.ph167: ; preds = %for.body22.lr.ph
%n.vec169 = and i64 %12, -8
%ind.end170 = add i64 %indvars.iv127, %n.vec169
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %16, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%17 = getelementptr i32, ptr %vla, i64 %indvars.iv127
br label %vector.body173
vector.body173: ; preds = %vector.body173, %vector.ph167
%index174 = phi i64 [ 0, %vector.ph167 ], [ %index.next178, %vector.body173 ]
%vec.phi175 = phi <4 x i32> [ zeroinitializer, %vector.ph167 ], [ %24, %vector.body173 ]
%vec.phi176 = phi <4 x i32> [ zeroinitializer, %vector.ph167 ], [ %25, %vector.body173 ]
%18 = getelementptr i32, ptr %17, i64 %index174
%wide.load = load <4 x i32>, ptr %18, align 4, !tbaa !10
%19 = getelementptr inbounds i32, ptr %18, i64 4
%wide.load177 = load <4 x i32>, ptr %19, align 4, !tbaa !10
%20 = icmp sgt <4 x i32> %broadcast.splat, %wide.load
%21 = icmp sgt <4 x i32> %broadcast.splat, %wide.load177
%22 = zext <4 x i1> %20 to <4 x i32>
%23 = zext <4 x i1> %21 to <4 x i32>
%24 = add <4 x i32> %vec.phi175, %22
%25 = add <4 x i32> %vec.phi176, %23
%index.next178 = add nuw i64 %index174, 8
%26 = icmp eq i64 %index.next178, %n.vec169
br i1 %26, label %middle.block164, label %vector.body173, !llvm.loop !16
middle.block164: ; preds = %vector.body173
%bin.rdx179 = add <4 x i32> %25, %24
%27 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx179)
%cmp.n172 = icmp eq i64 %12, %n.vec169
br i1 %cmp.n172, label %for.cond.cleanup21, label %for.body22.preheader
for.body22.preheader: ; preds = %for.body22.lr.ph, %middle.block164
%indvars.iv129.ph = phi i64 [ %indvars.iv127, %for.body22.lr.ph ], [ %ind.end170, %middle.block164 ]
%less.0107.ph = phi i32 [ 0, %for.body22.lr.ph ], [ %27, %middle.block164 ]
br label %for.body22
for.cond.cleanup21: ; preds = %for.body22, %middle.block164, %for.body18
%less.0.lcssa = phi i32 [ 0, %for.body18 ], [ %27, %middle.block164 ], [ %spec.select, %for.body22 ]
%28 = xor i32 %indvars134, -1
%sub32 = add i32 %8, %28
%cmp.not4.i = icmp slt i32 %sub32, 1
br i1 %cmp.not4.i, label %step.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.cond.cleanup21
%min.iters.check = icmp ult i32 %15, 8
br i1 %min.iters.check, label %for.body.i.preheader226, label %vector.ph
vector.ph: ; preds = %for.body.i.preheader
%n.vec = and i32 %15, -8
%ind.end = or i32 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %29, %vector.body ]
%vec.phi163 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %30, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%29 = mul <4 x i32> %vec.phi, %vec.ind
%30 = mul <4 x i32> %vec.phi163, %step.add
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%31 = icmp eq i32 %index.next, %n.vec
br i1 %31, label %middle.block, label %vector.body, !llvm.loop !17
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %30, %29
%32 = call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %15, %n.vec
br i1 %cmp.n, label %step.exit, label %for.body.i.preheader226
for.body.i.preheader226: ; preds = %for.body.i.preheader, %middle.block
%i.06.i.ph = phi i32 [ 1, %for.body.i.preheader ], [ %ind.end, %middle.block ]
%answer.05.i.ph = phi i32 [ 1, %for.body.i.preheader ], [ %32, %middle.block ]
br label %for.body.i
for.body.i: ; preds = %for.body.i.preheader226, %for.body.i
%i.06.i = phi i32 [ %inc.i, %for.body.i ], [ %i.06.i.ph, %for.body.i.preheader226 ]
%answer.05.i = phi i32 [ %mul.i, %for.body.i ], [ %answer.05.i.ph, %for.body.i.preheader226 ]
%mul.i = mul nsw i32 %answer.05.i, %i.06.i
%inc.i = add nuw i32 %i.06.i, 1
%exitcond.not.i = icmp eq i32 %i.06.i, %sub32
br i1 %exitcond.not.i, label %step.exit, label %for.body.i, !llvm.loop !18
step.exit: ; preds = %for.body.i, %middle.block, %for.cond.cleanup21
%answer.0.lcssa.i = phi i32 [ 1, %for.cond.cleanup21 ], [ %32, %middle.block ], [ %mul.i, %for.body.i ]
%mul = mul nsw i32 %answer.0.lcssa.i, %less.0.lcssa
%add34 = add nsw i32 %mul, %p_order.0111
%indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1
%exitcond136.not = icmp eq i64 %indvars.iv.next133, %wide.trip.count135
br i1 %exitcond136.not, label %for.cond39.preheader, label %for.body18, !llvm.loop !19
for.body22: ; preds = %for.body22.preheader, %for.body22
%indvars.iv129 = phi i64 [ %indvars.iv.next130, %for.body22 ], [ %indvars.iv129.ph, %for.body22.preheader ]
%less.0107 = phi i32 [ %spec.select, %for.body22 ], [ %less.0107.ph, %for.body22.preheader ]
%arrayidx26 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv129
%33 = load i32, ptr %arrayidx26, align 4, !tbaa !10
%cmp27 = icmp sgt i32 %16, %33
%inc28 = zext i1 %cmp27 to i32
%spec.select = add nuw nsw i32 %less.0107, %inc28
%indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
%exitcond.not = icmp eq i64 %indvars.iv.next130, %wide.trip.count135
br i1 %exitcond.not, label %for.cond.cleanup21, label %for.body22, !llvm.loop !20
for.cond.cleanup41: ; preds = %step.exit101, %for.cond15.preheader, %entry, %for.cond4.preheader, %for.cond39.preheader
%p_order.0.lcssa157 = phi i32 [ %add34, %for.cond39.preheader ], [ 1, %for.cond4.preheader ], [ 1, %entry ], [ 1, %for.cond15.preheader ], [ %add34, %step.exit101 ]
%q_order.0.lcssa = phi i32 [ 1, %for.cond39.preheader ], [ 1, %for.cond4.preheader ], [ 1, %entry ], [ 1, %for.cond15.preheader ], [ %add64, %step.exit101 ]
%sub68 = sub nsw i32 %q_order.0.lcssa, %p_order.0.lcssa157
%34 = call i32 @llvm.abs.i32(i32 %sub68, i1 true)
%call69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %34)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
for.body42: ; preds = %for.body42.preheader, %step.exit101
%indvars.iv144 = phi i64 [ 0, %for.body42.preheader ], [ %indvars.iv.next145, %step.exit101 ]
%indvars.iv137 = phi i64 [ 1, %for.body42.preheader ], [ %indvars.iv.next138, %step.exit101 ]
%q_order.0119 = phi i32 [ 1, %for.body42.preheader ], [ %add64, %step.exit101 ]
%35 = xor i64 %indvars.iv144, -1
%36 = add nsw i64 %35, %wide.trip.count135
%37 = trunc i64 %indvars.iv144 to i32
%38 = xor i32 %37, -1
%39 = add i32 %8, %38
%indvars146 = trunc i64 %indvars.iv144 to i32
%indvars.iv.next145 = add nuw nsw i64 %indvars.iv144, 1
%cmp46114 = icmp ult i64 %indvars.iv.next145, %10
br i1 %cmp46114, label %for.body48.lr.ph, label %for.cond.cleanup47
for.body48.lr.ph: ; preds = %for.body42
%arrayidx50 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv144
%40 = load i32, ptr %arrayidx50, align 4, !tbaa !10
%min.iters.check203 = icmp ult i64 %36, 8
br i1 %min.iters.check203, label %for.body48.preheader, label %vector.ph204
vector.ph204: ; preds = %for.body48.lr.ph
%n.vec206 = and i64 %36, -8
%ind.end207 = add i64 %indvars.iv137, %n.vec206
%broadcast.splatinsert217 = insertelement <4 x i32> poison, i32 %40, i64 0
%broadcast.splat218 = shufflevector <4 x i32> %broadcast.splatinsert217, <4 x i32> poison, <4 x i32> zeroinitializer
%41 = getelementptr i32, ptr %vla1, i64 %indvars.iv137
br label %vector.body210
vector.body210: ; preds = %vector.body210, %vector.ph204
%index211 = phi i64 [ 0, %vector.ph204 ], [ %index.next219, %vector.body210 ]
%vec.phi212 = phi <4 x i32> [ zeroinitializer, %vector.ph204 ], [ %48, %vector.body210 ]
%vec.phi213 = phi <4 x i32> [ zeroinitializer, %vector.ph204 ], [ %49, %vector.body210 ]
%42 = getelementptr i32, ptr %41, i64 %index211
%wide.load215 = load <4 x i32>, ptr %42, align 4, !tbaa !10
%43 = getelementptr inbounds i32, ptr %42, i64 4
%wide.load216 = load <4 x i32>, ptr %43, align 4, !tbaa !10
%44 = icmp sgt <4 x i32> %broadcast.splat218, %wide.load215
%45 = icmp sgt <4 x i32> %broadcast.splat218, %wide.load216
%46 = zext <4 x i1> %44 to <4 x i32>
%47 = zext <4 x i1> %45 to <4 x i32>
%48 = add <4 x i32> %vec.phi212, %46
%49 = add <4 x i32> %vec.phi213, %47
%index.next219 = add nuw i64 %index211, 8
%50 = icmp eq i64 %index.next219, %n.vec206
br i1 %50, label %middle.block201, label %vector.body210, !llvm.loop !21
middle.block201: ; preds = %vector.body210
%bin.rdx220 = add <4 x i32> %49, %48
%51 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx220)
%cmp.n209 = icmp eq i64 %36, %n.vec206
br i1 %cmp.n209, label %for.cond.cleanup47, label %for.body48.preheader
for.body48.preheader: ; preds = %for.body48.lr.ph, %middle.block201
%indvars.iv139.ph = phi i64 [ %indvars.iv137, %for.body48.lr.ph ], [ %ind.end207, %middle.block201 ]
%less.2115.ph = phi i32 [ 0, %for.body48.lr.ph ], [ %51, %middle.block201 ]
br label %for.body48
for.cond.cleanup47: ; preds = %for.body48, %middle.block201, %for.body42
%less.2.lcssa = phi i32 [ 0, %for.body42 ], [ %51, %middle.block201 ], [ %spec.select92, %for.body48 ]
%52 = xor i32 %indvars146, -1
%sub61 = add i32 %8, %52
%cmp.not4.i93 = icmp slt i32 %sub61, 1
br i1 %cmp.not4.i93, label %step.exit101, label %for.body.i94.preheader
for.body.i94.preheader: ; preds = %for.cond.cleanup47
%min.iters.check183 = icmp ult i32 %39, 8
br i1 %min.iters.check183, label %for.body.i94.preheader222, label %vector.ph184
vector.ph184: ; preds = %for.body.i94.preheader
%n.vec186 = and i32 %39, -8
%ind.end187 = or i32 %n.vec186, 1
br label %vector.body190
vector.body190: ; preds = %vector.body190, %vector.ph184
%index191 = phi i32 [ 0, %vector.ph184 ], [ %index.next198, %vector.body190 ]
%vec.ind192 = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph184 ], [ %vec.ind.next195, %vector.body190 ]
%vec.phi196 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph184 ], [ %53, %vector.body190 ]
%vec.phi197 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph184 ], [ %54, %vector.body190 ]
%step.add193 = add <4 x i32> %vec.ind192, <i32 4, i32 4, i32 4, i32 4>
%53 = mul <4 x i32> %vec.phi196, %vec.ind192
%54 = mul <4 x i32> %vec.phi197, %step.add193
%index.next198 = add nuw i32 %index191, 8
%vec.ind.next195 = add <4 x i32> %vec.ind192, <i32 8, i32 8, i32 8, i32 8>
%55 = icmp eq i32 %index.next198, %n.vec186
br i1 %55, label %middle.block181, label %vector.body190, !llvm.loop !22
middle.block181: ; preds = %vector.body190
%bin.rdx199 = mul <4 x i32> %54, %53
%56 = call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx199)
%cmp.n189 = icmp eq i32 %39, %n.vec186
br i1 %cmp.n189, label %step.exit101, label %for.body.i94.preheader222
for.body.i94.preheader222: ; preds = %for.body.i94.preheader, %middle.block181
%i.06.i95.ph = phi i32 [ 1, %for.body.i94.preheader ], [ %ind.end187, %middle.block181 ]
%answer.05.i96.ph = phi i32 [ 1, %for.body.i94.preheader ], [ %56, %middle.block181 ]
br label %for.body.i94
for.body.i94: ; preds = %for.body.i94.preheader222, %for.body.i94
%i.06.i95 = phi i32 [ %inc.i98, %for.body.i94 ], [ %i.06.i95.ph, %for.body.i94.preheader222 ]
%answer.05.i96 = phi i32 [ %mul.i97, %for.body.i94 ], [ %answer.05.i96.ph, %for.body.i94.preheader222 ]
%mul.i97 = mul nsw i32 %answer.05.i96, %i.06.i95
%inc.i98 = add nuw i32 %i.06.i95, 1
%exitcond.not.i99 = icmp eq i32 %i.06.i95, %sub61
br i1 %exitcond.not.i99, label %step.exit101, label %for.body.i94, !llvm.loop !23
step.exit101: ; preds = %for.body.i94, %middle.block181, %for.cond.cleanup47
%answer.0.lcssa.i100 = phi i32 [ 1, %for.cond.cleanup47 ], [ %56, %middle.block181 ], [ %mul.i97, %for.body.i94 ]
%mul63 = mul nsw i32 %answer.0.lcssa.i100, %less.2.lcssa
%add64 = add nsw i32 %mul63, %q_order.0119
%indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
%exitcond148.not = icmp eq i64 %indvars.iv.next145, %wide.trip.count147
br i1 %exitcond148.not, label %for.cond.cleanup41, label %for.body42, !llvm.loop !24
for.body48: ; preds = %for.body48.preheader, %for.body48
%indvars.iv139 = phi i64 [ %indvars.iv.next140, %for.body48 ], [ %indvars.iv139.ph, %for.body48.preheader ]
%less.2115 = phi i32 [ %spec.select92, %for.body48 ], [ %less.2115.ph, %for.body48.preheader ]
%arrayidx52 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv139
%57 = load i32, ptr %arrayidx52, align 4, !tbaa !10
%cmp53 = icmp sgt i32 %40, %57
%inc55 = zext i1 %cmp53 to i32
%spec.select92 = add nuw nsw i32 %less.2115, %inc55
%indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1
%exitcond143.not = icmp eq i64 %indvars.iv.next140, %wide.trip.count147
br i1 %exitcond143.not, label %for.cond.cleanup47, label %for.body48, !llvm.loop !25
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6
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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6, !7, !8}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!"llvm.loop.isvectorized", i32 1}
!8 = !{!"llvm.loop.unroll.runtime.disable"}
!9 = distinct !{!9, !6, !8, !7}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C/C++ TBAA"}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6, !7, !8}
!17 = distinct !{!17, !6, !7, !8}
!18 = distinct !{!18, !6, !8, !7}
!19 = distinct !{!19, !6}
!20 = distinct !{!20, !6, !8, !7}
!21 = distinct !{!21, !6, !7, !8}
!22 = distinct !{!22, !6, !7, !8}
!23 = distinct !{!23, !6, !8, !7}
!24 = distinct !{!24, !6}
!25 = distinct !{!25, !6, !8, !7}
|
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
void swap(int *x,int *y){int tmp=*x;*x=*y;*y=tmp;}
int asc_cmp(const void* X,const void* Y){int x=*(int*)X,y=*(int*)Y;if(x<y)return -1;else if(x==y)return 0;else return 1;}
//next_permutation
//from https://qiita.com/Nikkely/items/0ddca51b3c0e60afbaab
int next_permutation(int *a,int n){
int x=-1,y=-1;
for(int i=n-2;i>=0;i--)if(a[i]<a[i+1]){x=i;break;}
for(int i=n-1;x!=-1&&i>=0;i--)if(a[x]<a[i]){y=i;break;}
if(x==-1||y==-1)return 1;
swap(&a[x],&a[y]);
qsort(&a[x+1],n-(x+1),sizeof(int),asc_cmp);
return 0;
}
int main(){
int n;scanf("%d",&n);
int p[20];for(int i=0;i<n;i++)scanf("%d",&p[i]);
int q[20];for(int i=0;i<n;i++)scanf("%d",&q[i]);
char p_str[20],q_str[20];
for(int i=0;i<n;i++)p_str[i]=p[i]+'0';
for(int i=0;i<n;i++)q_str[i]=q[i]+'0';
p_str[n]=q_str[n]='\0';
int a[n];for(int i=1;i<=n;i++)a[i-1]=i;
int list_n;
static char list[100000][20];
for(int i=0;1;i++){
for(int j=0;j<n;j++)list[i][j]='0'+a[j];
list[i][n]='\0';
//printf(">%s\n",list[i]);
list_n=i+1;
if(next_permutation(a,n))break;
}
int index[2];
for(int i=0;i<list_n;i++){
if(!strcmp(list[i],p_str))index[0]=i;
if(!strcmp(list[i],q_str))index[1]=i;
}
printf("%d\n",abs(index[0]-index[1]));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_326715/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_326715/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@main.list = internal global [100000 x [20 x i8]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %x, ptr nocapture noundef %y) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
store i32 %1, ptr %x, align 4, !tbaa !5
store i32 %0, ptr %y, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @asc_cmp(ptr nocapture noundef readonly %X, ptr nocapture noundef readonly %Y) #2 {
entry:
%0 = load i32, ptr %X, align 4, !tbaa !5
%1 = load i32, ptr %Y, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @next_permutation(ptr noundef %a, i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp63 = icmp sgt i32 %n, 1
br i1 %cmp63, label %for.body.preheader, label %cleanup35
for.body.preheader: ; preds = %entry
%sub = add i32 %n, -2
br label %for.body
for.body: ; preds = %for.body.preheader, %for.inc
%i.064 = phi i32 [ %dec, %for.inc ], [ %sub, %for.body.preheader ]
%idxprom = zext i32 %i.064 to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nuw nsw i32 %i.064, 1
%idxprom1 = zext i32 %add to i64
%arrayidx2 = getelementptr inbounds i32, ptr %a, i64 %idxprom1
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp3 = icmp slt i32 %0, %1
br i1 %cmp3, label %cleanup, label %for.inc
for.inc: ; preds = %for.body
%dec = add i32 %i.064, -1
%cmp = icmp sgt i32 %i.064, 0
br i1 %cmp, label %for.body, label %cleanup35, !llvm.loop !9
cleanup: ; preds = %for.body
%cmp7.not = icmp eq i32 %i.064, -1
%idxprom11 = zext i32 %i.064 to i64
%arrayidx12 = getelementptr inbounds i32, ptr %a, i64 %idxprom11
br i1 %cmp7.not, label %cleanup35, label %for.cond6.preheader
for.cond6.preheader: ; preds = %cleanup
%2 = zext i32 %n to i64
br label %for.cond6
for.cond6: ; preds = %for.cond6.preheader, %for.body10
%indvars.iv = phi i64 [ %2, %for.cond6.preheader ], [ %4, %for.body10 ]
%3 = trunc i64 %indvars.iv to i32
%cmp8 = icmp sgt i32 %3, 0
br i1 %cmp8, label %for.body10, label %cleanup35
for.body10: ; preds = %for.cond6
%4 = add nsw i64 %indvars.iv, -1
%5 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%arrayidx14 = getelementptr inbounds i32, ptr %a, i64 %4
%6 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp15 = icmp slt i32 %5, %6
br i1 %cmp15, label %if.end25, label %for.cond6, !llvm.loop !11
if.end25: ; preds = %for.body10
%idxprom28 = and i64 %4, 4294967295
%arrayidx29 = getelementptr inbounds i32, ptr %a, i64 %idxprom28
%7 = load i32, ptr %arrayidx29, align 4, !tbaa !5
store i32 %7, ptr %arrayidx12, align 4, !tbaa !5
store i32 %5, ptr %arrayidx29, align 4, !tbaa !5
%add30 = add nuw nsw i32 %i.064, 1
%idxprom31 = sext i32 %add30 to i64
%arrayidx32 = getelementptr inbounds i32, ptr %a, i64 %idxprom31
%sub34 = sub nsw i32 %n, %add30
%conv = sext i32 %sub34 to i64
tail call void @qsort(ptr noundef nonnull %arrayidx32, i64 noundef %conv, i64 noundef 4, ptr noundef nonnull @asc_cmp) #9
br label %cleanup35
cleanup35: ; preds = %for.inc, %for.cond6, %entry, %cleanup, %if.end25
%retval.0 = phi i32 [ 0, %if.end25 ], [ 1, %cleanup ], [ 1, %entry ], [ 1, %for.cond6 ], [ 1, %for.inc ]
ret i32 %retval.0
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%p = alloca [20 x i32], align 16
%q = alloca [20 x i32], align 16
%p_str = alloca [20 x i8], align 16
%q_str = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %p) #9
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp161 = icmp sgt i32 %0, 0
br i1 %cmp161, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %q) #9
br label %for.cond.cleanup5.thread
for.cond.cleanup: ; preds = %for.body
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %q) #9
%cmp4163 = icmp sgt i32 %1, 0
br i1 %cmp4163, label %for.body6, label %for.cond.cleanup5.thread
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 x i32], ptr %p, 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.cond.cleanup, !llvm.loop !12
for.cond.cleanup5.thread: ; preds = %for.cond.cleanup, %for.cond.cleanup.thread
%.lcssa160.ph = phi i32 [ %0, %for.cond.cleanup.thread ], [ %1, %for.cond.cleanup ]
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %p_str) #9
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %q_str) #9
br label %for.cond26.preheader.for.cond.cleanup29_crit_edge
for.cond.cleanup5: ; preds = %for.body6
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %p_str) #9
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %q_str) #9
%cmp15165 = icmp sgt i32 %12, 0
br i1 %cmp15165, label %for.body17.preheader, label %for.cond26.preheader.for.cond.cleanup29_crit_edge
for.body17.preheader: ; preds = %for.cond.cleanup5
%wide.trip.count = zext i32 %12 to i64
%min.iters.check = icmp ult i32 %12, 8
br i1 %min.iters.check, label %for.body17.preheader317, label %vector.ph
vector.ph: ; preds = %for.body17.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 ]
%3 = getelementptr inbounds [20 x i32], ptr %p, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
%wide.load267 = load <4 x i32>, ptr %4, align 16, !tbaa !5
%5 = trunc <4 x i32> %wide.load to <4 x i8>
%6 = trunc <4 x i32> %wide.load267 to <4 x i8>
%7 = add <4 x i8> %5, <i8 48, i8 48, i8 48, i8 48>
%8 = add <4 x i8> %6, <i8 48, i8 48, i8 48, i8 48>
%9 = getelementptr inbounds [20 x i8], ptr %p_str, i64 0, i64 %index
store <4 x i8> %7, ptr %9, align 8, !tbaa !13
%10 = getelementptr inbounds i8, ptr %9, i64 4
store <4 x i8> %8, ptr %10, align 4, !tbaa !13
%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 !14
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond26.preheader, label %for.body17.preheader317
for.body17.preheader317: ; preds = %for.body17.preheader, %middle.block
%indvars.iv191.ph = phi i64 [ 0, %for.body17.preheader ], [ %n.vec, %middle.block ]
br label %for.body17
for.body6: ; preds = %for.cond.cleanup, %for.body6
%indvars.iv188 = phi i64 [ %indvars.iv.next189, %for.body6 ], [ 0, %for.cond.cleanup ]
%arrayidx8 = getelementptr inbounds [20 x i32], ptr %q, i64 0, i64 %indvars.iv188
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8)
%indvars.iv.next189 = add nuw nsw i64 %indvars.iv188, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp4 = icmp slt i64 %indvars.iv.next189, %13
br i1 %cmp4, label %for.body6, label %for.cond.cleanup5, !llvm.loop !17
for.cond26.preheader: ; preds = %for.body17, %middle.block
br i1 %cmp15165, label %for.body30.preheader, label %for.cond26.preheader.for.cond.cleanup29_crit_edge
for.cond26.preheader.for.cond.cleanup29_crit_edge: ; preds = %for.cond.cleanup5, %for.cond.cleanup5.thread, %for.cond26.preheader
%.lcssa160222227 = phi i32 [ %12, %for.cond26.preheader ], [ %.lcssa160.ph, %for.cond.cleanup5.thread ], [ %12, %for.cond.cleanup5 ]
%.pre218 = zext i32 %.lcssa160222227 to i64
br label %for.cond.cleanup29
for.body30.preheader: ; preds = %for.cond26.preheader
%wide.trip.count197 = zext i32 %12 to i64
%min.iters.check270 = icmp ult i32 %12, 8
br i1 %min.iters.check270, label %for.body30.preheader316, label %vector.ph271
vector.ph271: ; preds = %for.body30.preheader
%n.vec273 = and i64 %wide.trip.count, 4294967288
br label %vector.body276
vector.body276: ; preds = %vector.body276, %vector.ph271
%index277 = phi i64 [ 0, %vector.ph271 ], [ %index.next280, %vector.body276 ]
%14 = getelementptr inbounds [20 x i32], ptr %q, i64 0, i64 %index277
%wide.load278 = load <4 x i32>, ptr %14, align 16, !tbaa !5
%15 = getelementptr inbounds i32, ptr %14, i64 4
%wide.load279 = load <4 x i32>, ptr %15, align 16, !tbaa !5
%16 = trunc <4 x i32> %wide.load278 to <4 x i8>
%17 = trunc <4 x i32> %wide.load279 to <4 x i8>
%18 = add <4 x i8> %16, <i8 48, i8 48, i8 48, i8 48>
%19 = add <4 x i8> %17, <i8 48, i8 48, i8 48, i8 48>
%20 = getelementptr inbounds [20 x i8], ptr %q_str, i64 0, i64 %index277
store <4 x i8> %18, ptr %20, align 8, !tbaa !13
%21 = getelementptr inbounds i8, ptr %20, i64 4
store <4 x i8> %19, ptr %21, align 4, !tbaa !13
%index.next280 = add nuw i64 %index277, 8
%22 = icmp eq i64 %index.next280, %n.vec273
br i1 %22, label %middle.block268, label %vector.body276, !llvm.loop !18
middle.block268: ; preds = %vector.body276
%cmp.n275 = icmp eq i64 %n.vec273, %wide.trip.count
br i1 %cmp.n275, label %for.cond.cleanup29, label %for.body30.preheader316
for.body30.preheader316: ; preds = %for.body30.preheader, %middle.block268
%indvars.iv194.ph = phi i64 [ 0, %for.body30.preheader ], [ %n.vec273, %middle.block268 ]
br label %for.body30
for.body17: ; preds = %for.body17.preheader317, %for.body17
%indvars.iv191 = phi i64 [ %indvars.iv.next192, %for.body17 ], [ %indvars.iv191.ph, %for.body17.preheader317 ]
%arrayidx19 = getelementptr inbounds [20 x i32], ptr %p, i64 0, i64 %indvars.iv191
%23 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%24 = trunc i32 %23 to i8
%conv = add i8 %24, 48
%arrayidx21 = getelementptr inbounds [20 x i8], ptr %p_str, i64 0, i64 %indvars.iv191
store i8 %conv, ptr %arrayidx21, align 1, !tbaa !13
%indvars.iv.next192 = add nuw nsw i64 %indvars.iv191, 1
%exitcond.not = icmp eq i64 %indvars.iv.next192, %wide.trip.count
br i1 %exitcond.not, label %for.cond26.preheader, label %for.body17, !llvm.loop !19
for.cond.cleanup29: ; preds = %for.body30, %middle.block268, %for.cond26.preheader.for.cond.cleanup29_crit_edge
%.lcssa160222226 = phi i32 [ %.lcssa160222227, %for.cond26.preheader.for.cond.cleanup29_crit_edge ], [ %12, %middle.block268 ], [ %12, %for.body30 ]
%.pre-phi = phi i64 [ %.pre218, %for.cond26.preheader.for.cond.cleanup29_crit_edge ], [ %wide.trip.count197, %middle.block268 ], [ %wide.trip.count197, %for.body30 ]
%idxprom40 = sext i32 %.lcssa160222226 to i64
%arrayidx41 = getelementptr inbounds [20 x i8], ptr %q_str, i64 0, i64 %idxprom40
store i8 0, ptr %arrayidx41, align 1, !tbaa !13
%arrayidx43 = getelementptr inbounds [20 x i8], ptr %p_str, i64 0, i64 %idxprom40
store i8 0, ptr %arrayidx43, align 1, !tbaa !13
%25 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %.pre-phi, align 16
%26 = load i32, ptr %n, align 4, !tbaa !5
%cmp46.not169 = icmp slt i32 %26, 1
br i1 %cmp46.not169, label %for.cond56.preheader, label %for.body49.preheader
for.body49.preheader: ; preds = %for.cond.cleanup29
%27 = add nuw i32 %26, 1
%wide.trip.count203 = zext i32 %27 to i64
%invariant.gep = getelementptr i32, ptr %vla, i64 -1
%28 = add nsw i64 %wide.trip.count203, -1
%min.iters.check283 = icmp ult i32 %26, 8
br i1 %min.iters.check283, label %for.body49.preheader315, label %vector.ph284
vector.ph284: ; preds = %for.body49.preheader
%n.vec286 = and i64 %28, -8
%ind.end = or i64 %n.vec286, 1
br label %vector.body289
vector.body289: ; preds = %vector.body289, %vector.ph284
%index290 = phi i64 [ 0, %vector.ph284 ], [ %index.next292, %vector.body289 ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph284 ], [ %vec.ind.next, %vector.body289 ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%offset.idx = or i64 %index290, 1
%29 = getelementptr i32, ptr %invariant.gep, i64 %offset.idx
store <4 x i32> %vec.ind, ptr %29, align 16, !tbaa !5
%30 = getelementptr i32, ptr %29, i64 4
store <4 x i32> %step.add, ptr %30, align 16, !tbaa !5
%index.next292 = add nuw i64 %index290, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%31 = icmp eq i64 %index.next292, %n.vec286
br i1 %31, label %middle.block281, label %vector.body289, !llvm.loop !20
middle.block281: ; preds = %vector.body289
%cmp.n288 = icmp eq i64 %28, %n.vec286
br i1 %cmp.n288, label %for.cond56.preheader, label %for.body49.preheader315
for.body49.preheader315: ; preds = %for.body49.preheader, %middle.block281
%indvars.iv199.ph = phi i64 [ 1, %for.body49.preheader ], [ %ind.end, %middle.block281 ]
br label %for.body49
for.body30: ; preds = %for.body30.preheader316, %for.body30
%indvars.iv194 = phi i64 [ %indvars.iv.next195, %for.body30 ], [ %indvars.iv194.ph, %for.body30.preheader316 ]
%arrayidx32 = getelementptr inbounds [20 x i32], ptr %q, i64 0, i64 %indvars.iv194
%32 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%33 = trunc i32 %32 to i8
%conv34 = add i8 %33, 48
%arrayidx36 = getelementptr inbounds [20 x i8], ptr %q_str, i64 0, i64 %indvars.iv194
store i8 %conv34, ptr %arrayidx36, align 1, !tbaa !13
%indvars.iv.next195 = add nuw nsw i64 %indvars.iv194, 1
%exitcond198.not = icmp eq i64 %indvars.iv.next195, %wide.trip.count197
br i1 %exitcond198.not, label %for.cond.cleanup29, label %for.body30, !llvm.loop !21
for.cond56.preheader: ; preds = %for.body49, %middle.block281, %for.cond.cleanup29
%cmp60171264 = icmp sgt i32 %26, 0
br i1 %cmp60171264, label %for.body63.lr.ph, label %for.cond.cleanup62.thread
for.body49: ; preds = %for.body49.preheader315, %for.body49
%indvars.iv199 = phi i64 [ %indvars.iv.next200, %for.body49 ], [ %indvars.iv199.ph, %for.body49.preheader315 ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv199
%34 = trunc i64 %indvars.iv199 to i32
store i32 %34, ptr %gep, align 4, !tbaa !5
%indvars.iv.next200 = add nuw nsw i64 %indvars.iv199, 1
%exitcond204.not = icmp eq i64 %indvars.iv.next200, %wide.trip.count203
br i1 %exitcond204.not, label %for.cond56.preheader, label %for.body49, !llvm.loop !22
for.cond.cleanup62.thread: ; preds = %for.inc81, %for.cond56.preheader
%.lcssa258 = phi i32 [ %26, %for.cond56.preheader ], [ %.pre, %for.inc81 ]
%indvars.iv210.lcssa = phi i64 [ 0, %for.cond56.preheader ], [ %indvars.iv.next211, %for.inc81 ]
%idxprom77229 = sext i32 %.lcssa258 to i64
%arrayidx78230 = getelementptr inbounds [100000 x [20 x i8]], ptr @main.list, i64 0, i64 %indvars.iv210.lcssa, i64 %idxprom77229
store i8 0, ptr %arrayidx78230, align 1, !tbaa !13
br label %next_permutation.exit
for.body63.lr.ph: ; preds = %for.cond56.preheader, %for.inc81
%indvars.iv210265 = phi i64 [ %indvars.iv.next211, %for.inc81 ], [ 0, %for.cond56.preheader ]
%35 = phi i32 [ %.pre, %for.inc81 ], [ %26, %for.cond56.preheader ]
%wide.trip.count208 = zext i32 %35 to i64
%min.iters.check295 = icmp ult i32 %35, 8
br i1 %min.iters.check295, label %for.body63.preheader, label %vector.ph296
vector.ph296: ; preds = %for.body63.lr.ph
%n.vec298 = and i64 %wide.trip.count208, 2147483640
br label %vector.body301
vector.body301: ; preds = %vector.body301, %vector.ph296
%index302 = phi i64 [ 0, %vector.ph296 ], [ %index.next305, %vector.body301 ]
%36 = getelementptr inbounds i32, ptr %vla, i64 %index302
%wide.load303 = load <4 x i32>, ptr %36, align 16, !tbaa !5
%37 = getelementptr inbounds i32, ptr %36, i64 4
%wide.load304 = load <4 x i32>, ptr %37, align 16, !tbaa !5
%38 = trunc <4 x i32> %wide.load303 to <4 x i8>
%39 = trunc <4 x i32> %wide.load304 to <4 x i8>
%40 = add <4 x i8> %38, <i8 48, i8 48, i8 48, i8 48>
%41 = add <4 x i8> %39, <i8 48, i8 48, i8 48, i8 48>
%42 = getelementptr inbounds [100000 x [20 x i8]], ptr @main.list, i64 0, i64 %indvars.iv210265, i64 %index302
store <4 x i8> %40, ptr %42, align 4, !tbaa !13
%43 = getelementptr inbounds i8, ptr %42, i64 4
store <4 x i8> %41, ptr %43, align 4, !tbaa !13
%index.next305 = add nuw i64 %index302, 8
%44 = icmp eq i64 %index.next305, %n.vec298
br i1 %44, label %middle.block293, label %vector.body301, !llvm.loop !23
middle.block293: ; preds = %vector.body301
%cmp.n300 = icmp eq i64 %n.vec298, %wide.trip.count208
br i1 %cmp.n300, label %for.cond.cleanup62, label %for.body63.preheader
for.body63.preheader: ; preds = %for.body63.lr.ph, %middle.block293
%indvars.iv205.ph = phi i64 [ 0, %for.body63.lr.ph ], [ %n.vec298, %middle.block293 ]
br label %for.body63
for.cond.cleanup62: ; preds = %for.body63, %middle.block293
%idxprom77 = zext i32 %35 to i64
%arrayidx78 = getelementptr inbounds [100000 x [20 x i8]], ptr @main.list, i64 0, i64 %indvars.iv210265, i64 %idxprom77
store i8 0, ptr %arrayidx78, align 1, !tbaa !13
%cmp63.i = icmp ugt i32 %35, 1
br i1 %cmp63.i, label %for.body.preheader.i, label %next_permutation.exit
for.body.preheader.i: ; preds = %for.cond.cleanup62
%sub.i = add nsw i32 %35, -2
br label %for.body.i
for.body.i: ; preds = %for.inc.i, %for.body.preheader.i
%i.064.i = phi i32 [ %dec.i, %for.inc.i ], [ %sub.i, %for.body.preheader.i ]
%idxprom.i = zext i32 %i.064.i to i64
%arrayidx.i = getelementptr inbounds i32, ptr %vla, i64 %idxprom.i
%45 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%add.i = add nuw nsw i32 %i.064.i, 1
%idxprom1.i = zext i32 %add.i to i64
%arrayidx2.i = getelementptr inbounds i32, ptr %vla, i64 %idxprom1.i
%46 = load i32, ptr %arrayidx2.i, align 4, !tbaa !5
%cmp3.i = icmp slt i32 %45, %46
br i1 %cmp3.i, label %for.cond6.preheader.i, label %for.inc.i
for.inc.i: ; preds = %for.body.i
%dec.i = add nsw i32 %i.064.i, -1
%cmp.i = icmp sgt i32 %i.064.i, 0
br i1 %cmp.i, label %for.body.i, label %next_permutation.exit, !llvm.loop !9
for.cond6.preheader.i: ; preds = %for.body.i
%arrayidx.i.le = getelementptr inbounds i32, ptr %vla, i64 %idxprom.i
%47 = zext i32 %35 to i64
br label %for.cond6.i
for.cond6.i: ; preds = %for.body10.i, %for.cond6.preheader.i
%indvars.iv.i = phi i64 [ %47, %for.cond6.preheader.i ], [ %49, %for.body10.i ]
%48 = trunc i64 %indvars.iv.i to i32
%cmp8.i = icmp sgt i32 %48, 0
br i1 %cmp8.i, label %for.body10.i, label %next_permutation.exit
for.body10.i: ; preds = %for.cond6.i
%49 = add nsw i64 %indvars.iv.i, -1
%arrayidx14.i = getelementptr inbounds i32, ptr %vla, i64 %49
%50 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5
%cmp15.i = icmp slt i32 %45, %50
br i1 %cmp15.i, label %for.inc81, label %for.cond6.i, !llvm.loop !11
next_permutation.exit: ; preds = %for.cond.cleanup62, %for.inc.i, %for.cond6.i, %for.cond.cleanup62.thread
%indvars.iv210257 = phi i64 [ %indvars.iv210.lcssa, %for.cond.cleanup62.thread ], [ %indvars.iv210265, %for.cond6.i ], [ %indvars.iv210265, %for.inc.i ], [ %indvars.iv210265, %for.cond.cleanup62 ]
%51 = add i64 %indvars.iv210257, 1
%wide.trip.count216 = and i64 %51, 4294967295
br label %for.body89
for.body63: ; preds = %for.body63.preheader, %for.body63
%indvars.iv205 = phi i64 [ %indvars.iv.next206, %for.body63 ], [ %indvars.iv205.ph, %for.body63.preheader ]
%arrayidx65 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv205
%52 = load i32, ptr %arrayidx65, align 4, !tbaa !5
%53 = trunc i32 %52 to i8
%conv67 = add i8 %53, 48
%arrayidx71 = getelementptr inbounds [100000 x [20 x i8]], ptr @main.list, i64 0, i64 %indvars.iv210265, i64 %indvars.iv205
store i8 %conv67, ptr %arrayidx71, align 1, !tbaa !13
%indvars.iv.next206 = add nuw nsw i64 %indvars.iv205, 1
%exitcond209.not = icmp eq i64 %indvars.iv.next206, %wide.trip.count208
br i1 %exitcond209.not, label %for.cond.cleanup62, label %for.body63, !llvm.loop !24
for.inc81: ; preds = %for.body10.i
%idxprom28.i = and i64 %49, 4294967295
%arrayidx29.i = getelementptr inbounds i32, ptr %vla, i64 %idxprom28.i
%54 = load i32, ptr %arrayidx29.i, align 4, !tbaa !5
store i32 %54, ptr %arrayidx.i.le, align 4, !tbaa !5
store i32 %45, ptr %arrayidx29.i, align 4, !tbaa !5
%idxprom31.i = sext i32 %add.i to i64
%arrayidx32.i = getelementptr inbounds i32, ptr %vla, i64 %idxprom31.i
%sub34.i = sub nsw i32 %35, %add.i
%conv.i = sext i32 %sub34.i to i64
call void @qsort(ptr noundef nonnull %arrayidx32.i, i64 noundef %conv.i, i64 noundef 4, ptr noundef nonnull @asc_cmp) #9
%indvars.iv.next211 = add nuw i64 %indvars.iv210265, 1
%.pre = load i32, ptr %n, align 4, !tbaa !5
%cmp60171 = icmp sgt i32 %.pre, 0
br i1 %cmp60171, label %for.body63.lr.ph, label %for.cond.cleanup62.thread
for.cond.cleanup88: ; preds = %for.body89
%sub113 = sub nsw i32 %spec.select, %index.sroa.4.1
%55 = call i32 @llvm.abs.i32(i32 %sub113, i1 true)
%call114 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %55)
call void @llvm.stackrestore.p0(ptr %25)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %q_str) #9
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %p_str) #9
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %q) #9
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %p) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret i32 0
for.body89: ; preds = %next_permutation.exit, %for.body89
%indvars.iv213 = phi i64 [ 0, %next_permutation.exit ], [ %indvars.iv.next214, %for.body89 ]
%index.sroa.0.0175 = phi i32 [ undef, %next_permutation.exit ], [ %spec.select, %for.body89 ]
%index.sroa.4.0174 = phi i32 [ undef, %next_permutation.exit ], [ %index.sroa.4.1, %for.body89 ]
%arrayidx91 = getelementptr inbounds [100000 x [20 x i8]], ptr @main.list, i64 0, i64 %indvars.iv213
%call93 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx91, ptr noundef nonnull dereferenceable(1) %p_str) #10
%tobool94.not = icmp eq i32 %call93, 0
%56 = trunc i64 %indvars.iv213 to i32
%spec.select = select i1 %tobool94.not, i32 %56, i32 %index.sroa.0.0175
%call102 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %arrayidx91, ptr noundef nonnull dereferenceable(1) %q_str) #10
%tobool103.not = icmp eq i32 %call102, 0
%index.sroa.4.1 = select i1 %tobool103.not, i32 %56, i32 %index.sroa.4.0174
%indvars.iv.next214 = add nuw nsw i64 %indvars.iv213, 1
%exitcond217.not = icmp eq i64 %indvars.iv.next214, %wide.trip.count216
br i1 %exitcond217.not, label %for.cond.cleanup88, label %for.body89, !llvm.loop !25
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #6
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #8
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !15, !16}
!19 = distinct !{!19, !10, !16, !15}
!20 = distinct !{!20, !10, !15, !16}
!21 = distinct !{!21, !10, !16, !15}
!22 = distinct !{!22, !10, !16, !15}
!23 = distinct !{!23, !10, !15, !16}
!24 = distinct !{!24, !10, !16, !15}
!25 = distinct !{!25, !10}
|