Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include<stdio.h>
int cont=0;
int check(long long int num)
{
int i,j,index=0;
for(j=2;j*j<=num;j++)
{
if(num%j == 0)
index = 1;
}
if(index == 0)
cont = cont+1;
return 0;
}
int main()
{
int size,i;
scanf("%d",&size);
long long int arr[size];
for(i=0;i<size;i++)
{
scanf("%lld",&arr[i]);
check(arr[i]);
}
printf("%d\n",cont);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248454/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248454/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@cont = 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 [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @check(i64 noundef %num) local_unnamed_addr #0 {
entry:
%cmp.not13 = icmp slt i64 %num, 4
br i1 %cmp.not13, label %if.then7, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 2, %entry ]
%index.015 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%rem = srem i64 %num, %indvars.iv
%cmp3 = icmp eq i64 %rem, 0
%spec.select = select i1 %cmp3, i32 1, i32 %index.015
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%mul = mul i64 %indvars.iv.next, %indvars.iv.next
%conv = and i64 %mul, 4294967295
%cmp.not = icmp sgt i64 %conv, %num
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !5
for.end: ; preds = %for.body
%0 = icmp eq i32 %spec.select, 0
br i1 %0, label %if.then7, label %if.end8
if.then7: ; preds = %entry, %for.end
%1 = load i32, ptr @cont, align 4, !tbaa !7
%add = add nsw i32 %1, 1
store i32 %add, ptr @cont, align 4, !tbaa !7
br label %if.end8
if.end8: ; preds = %if.then7, %for.end
ret i32 0
}
; 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:
%size = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %size) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %size)
%0 = load i32, ptr %size, align 4, !tbaa !7
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %1, align 16
%3 = load i32, ptr %size, align 4, !tbaa !7
%cmp9 = icmp sgt i32 %3, 0
br i1 %cmp9, label %for.body, label %for.end
for.body: ; preds = %entry, %check.exit
%indvars.iv = phi i64 [ %indvars.iv.next, %check.exit ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%4 = load i64, ptr %arrayidx, align 8, !tbaa !11
%cmp.not13.i = icmp slt i64 %4, 4
br i1 %cmp.not13.i, label %if.then7.i, label %for.body.i
for.body.i: ; preds = %for.body, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ 2, %for.body ]
%index.015.i = phi i32 [ %spec.select.i, %for.body.i ], [ 0, %for.body ]
%rem.i = srem i64 %4, %indvars.iv.i
%cmp3.i = icmp eq i64 %rem.i, 0
%spec.select.i = select i1 %cmp3.i, i32 1, i32 %index.015.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%mul.i = mul i64 %indvars.iv.next.i, %indvars.iv.next.i
%conv.i = and i64 %mul.i, 4294967295
%cmp.not.i = icmp sgt i64 %conv.i, %4
br i1 %cmp.not.i, label %for.end.i, label %for.body.i, !llvm.loop !5
for.end.i: ; preds = %for.body.i
%5 = icmp eq i32 %spec.select.i, 0
br i1 %5, label %if.then7.i, label %check.exit
if.then7.i: ; preds = %for.end.i, %for.body
%6 = load i32, ptr @cont, align 4, !tbaa !7
%add.i = add nsw i32 %6, 1
store i32 %add.i, ptr @cont, align 4, !tbaa !7
br label %check.exit
check.exit: ; preds = %for.end.i, %if.then7.i
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %size, align 4, !tbaa !7
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %check.exit, %entry
%9 = load i32, ptr @cont, align 4, !tbaa !7
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %9)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %size) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree 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
attributes #0 = { nofree norecurse 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 = { 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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !9, i64 0}
!13 = distinct !{!13, !6}
|
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
bool IsPrime (int n)
{
if (n <= 3) {
return true;
}
int sqn = sqrt(n);
for (int i = 2; i <= sqn; ++i) {
if(n % i == 0) {
return false;
}
}
return true;
}
int main() {
#ifdef TEST
freopen("input", "r", stdin);
#endif
int num;
scanf("%d", &num);
int tmp;
int cnt = 0;
for (int i = 0; i < num; ++i) {
scanf("%d", &tmp);
if(IsPrime(tmp)) {
cnt++;
}
}
printf("%d\n", cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248511/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248511/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 memory(write) uwtable
define dso_local zeroext i1 @IsPrime(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %n, 4
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%conv = sitofp i32 %n to double
%call = tail call double @sqrt(double noundef %conv) #5
%conv1 = fptosi double %call to i32
%cmp2.not13 = icmp slt i32 %conv1, 2
br i1 %cmp2.not13, label %return, label %for.body
for.body: ; preds = %if.end, %for.body
%i.014 = phi i32 [ %inc, %for.body ], [ 2, %if.end ]
%rem = srem i32 %n, %i.014
%cmp4.not = icmp ne i32 %rem, 0
%inc = add nuw i32 %i.014, 1
%exitcond.not = icmp ne i32 %i.014, %conv1
%or.cond.not = and i1 %exitcond.not, %cmp4.not
br i1 %or.cond.not, label %for.body, label %return, !llvm.loop !5
return: ; preds = %for.body, %if.end, %entry
%retval.2 = phi i1 [ true, %entry ], [ true, %if.end ], [ %cmp4.not, %for.body ]
ret i1 %retval.2
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%num = alloca i32, align 4
%tmp = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tmp) #5
%0 = load i32, ptr %num, align 4, !tbaa !7
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %IsPrime.exit, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %2, %IsPrime.exit ]
%call4 = 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 %tmp) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #5
ret i32 0
for.body: ; preds = %entry, %IsPrime.exit
%i.012 = phi i32 [ %inc3, %IsPrime.exit ], [ 0, %entry ]
%cnt.011 = phi i32 [ %2, %IsPrime.exit ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %tmp)
%1 = load i32, ptr %tmp, align 4, !tbaa !7
%cmp.i = icmp slt i32 %1, 4
br i1 %cmp.i, label %.loopexit, label %if.end.i
if.end.i: ; preds = %for.body
%conv.i = sitofp i32 %1 to double
%call.i = call double @sqrt(double noundef %conv.i) #5
%conv1.i = fptosi double %call.i to i32
%cmp2.not13.i = icmp slt i32 %conv1.i, 2
br i1 %cmp2.not13.i, label %.loopexit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%inc.i = add nuw i32 %i.014.i, 1
%exitcond.not.i = icmp eq i32 %i.014.i, %conv1.i
br i1 %exitcond.not.i, label %.loopexit, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %if.end.i, %for.cond.i
%i.014.i = phi i32 [ %inc.i, %for.cond.i ], [ 2, %if.end.i ]
%rem.i = srem i32 %1, %i.014.i
%cmp4.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp4.not.i, label %IsPrime.exit, label %for.cond.i
.loopexit: ; preds = %for.cond.i, %for.body, %if.end.i
%inc8 = add nsw i32 %cnt.011, 1
br label %IsPrime.exit
IsPrime.exit: ; preds = %for.body.i, %.loopexit
%2 = phi i32 [ %inc8, %.loopexit ], [ %cnt.011, %for.body.i ]
%inc3 = add nuw nsw i32 %i.012, 1
%3 = load i32, ptr %num, align 4, !tbaa !7
%cmp = icmp slt i32 %inc3, %3
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include<stdio.h>
int A[10000];
int main()
{
int n,i,j,flag,count=0;
scanf("%d",&n);
for(i=0; i<n; i++)
{
scanf("%d",&A[i]);
}
for(i=0; i<n; i++)
{
flag=0;
if(A[i]%2==0 && A[i]!=2) continue;
for(j=3; j*j<=A[i]; j+=2)
{
if(j==A[i]) break;
if(A[i]%j==0) flag=1;
}
if(flag==0) count++;
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248562/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248562/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp53 = icmp sgt i32 %0, 0
br i1 %cmp53, label %for.body, label %for.end35
for.cond2.preheader: ; preds = %for.body
%cmp361 = icmp sgt i32 %1, 0
br i1 %cmp361, label %for.body4.preheader, label %for.end35
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %1 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr @A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4.preheader, %for.inc33
%indvars.iv67 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next68, %for.inc33 ]
%count.063 = phi i32 [ 0, %for.body4.preheader ], [ %count.1, %for.inc33 ]
%arrayidx6 = getelementptr inbounds [10000 x i32], ptr @A, i64 0, i64 %indvars.iv67
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%4 = and i32 %3, 1
%cmp7 = icmp ne i32 %4, 0
%cmp10.not = icmp eq i32 %3, 2
%or.cond = or i1 %cmp10.not, %cmp7
br i1 %or.cond, label %for.cond11.preheader, label %for.inc33
for.cond11.preheader: ; preds = %for.body4
%cmp14.not55 = icmp slt i32 %3, 9
br i1 %cmp14.not55, label %for.end28, label %if.end20
if.end20: ; preds = %for.cond11.preheader, %if.end20
%flag.059 = phi i32 [ %spec.select, %if.end20 ], [ 0, %for.cond11.preheader ]
%j.058 = phi i32 [ %add, %if.end20 ], [ 3, %for.cond11.preheader ]
%rem23 = srem i32 %3, %j.058
%cmp24 = icmp eq i32 %rem23, 0
%spec.select = select i1 %cmp24, i32 1, i32 %flag.059
%add = add nuw nsw i32 %j.058, 2
%mul = mul nsw i32 %add, %add
%cmp14.not = icmp sgt i32 %mul, %3
%cmp18 = icmp eq i32 %add, %3
%or.cond51 = or i1 %cmp18, %cmp14.not
br i1 %or.cond51, label %for.end28, label %if.end20, !llvm.loop !11
for.end28: ; preds = %if.end20, %for.cond11.preheader
%flag.0.lcssa = phi i32 [ 0, %for.cond11.preheader ], [ %spec.select, %if.end20 ]
%cmp29 = icmp eq i32 %flag.0.lcssa, 0
%inc31 = zext i1 %cmp29 to i32
%spec.select52 = add nsw i32 %count.063, %inc31
br label %for.inc33
for.inc33: ; preds = %for.end28, %for.body4
%count.1 = phi i32 [ %count.063, %for.body4 ], [ %spec.select52, %for.end28 ]
%indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
%exitcond.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count
br i1 %exitcond.not, label %for.end35, label %for.body4, !llvm.loop !12
for.end35: ; preds = %for.inc33, %entry, %for.cond2.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %count.1, %for.inc33 ]
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int Prime(int x){
int h;
if ( x < 2 ) return 0;
else if ( x == 2 ) return 1;
if ( x % 2 == 0 ) return 0;
for ( h = 3; h*h <= x; h+=2 ){
if ( x % h == 0 ) return 0;
}
return 1;
}
int main(){
int n, x, f;
int count = 0;
scanf("%d", &n);
for ( f = 0; f < n; f++ ){
scanf("%d", &x);
if ( Prime(x) ) count++;
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248605/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248605/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @Prime(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %x, 2
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %entry
%cmp1 = icmp eq i32 %x, 2
br i1 %cmp1, label %cleanup, label %if.end3
if.end3: ; preds = %if.else
%rem = and i32 %x, 1
%cmp4 = icmp eq i32 %rem, 0
br i1 %cmp4, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end3
%cmp7.not19 = icmp ult i32 %x, 9
br i1 %cmp7.not19, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %h.020, 2
%mul = mul nsw i32 %add, %add
%cmp7.not = icmp sgt i32 %mul, %x
br i1 %cmp7.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.cond.preheader, %for.cond
%h.020 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ]
%rem8 = srem i32 %x, %h.020
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.end3, %if.else, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %if.else ], [ 0, %if.end3 ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
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
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%count.012 = phi i32 [ %2, %for.cond ], [ 0, %entry ]
%f.011 = phi i32 [ %inc3, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%1 = load i32, ptr %x, align 4, !tbaa !7
%cmp.i = icmp slt i32 %1, 2
br i1 %cmp.i, label %for.cond, label %if.else.i
if.else.i: ; preds = %for.body
%cmp1.i = icmp eq i32 %1, 2
br i1 %cmp1.i, label %Prime.exit, label %if.end3.i
if.end3.i: ; preds = %if.else.i
%rem.i = and i32 %1, 1
%cmp4.i = icmp eq i32 %rem.i, 0
br i1 %cmp4.i, label %for.cond, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.end3.i
%cmp7.not19.i = icmp ult i32 %1, 9
br i1 %cmp7.not19.i, label %Prime.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %h.020.i, 2
%mul.i = mul nsw i32 %add.i, %add.i
%cmp7.not.i = icmp sgt i32 %mul.i, %1
br i1 %cmp7.not.i, label %Prime.exit, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%h.020.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem8.i = srem i32 %1, %h.020.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond, label %for.cond.i
Prime.exit: ; preds = %for.cond.i, %if.else.i, %for.cond.preheader.i
%inc = add nsw i32 %count.012, 1
br label %for.cond
for.cond: ; preds = %for.body.i, %if.end3.i, %for.body, %Prime.exit
%2 = phi i32 [ %inc, %Prime.exit ], [ %count.012, %for.body ], [ %count.012, %if.end3.i ], [ %count.012, %for.body.i ]
%inc3 = add nuw nsw i32 %f.011, 1
%3 = load i32, ptr %n, align 4, !tbaa !7
%cmp = icmp slt i32 %inc3, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %2, %for.cond ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include <stdio.h>
#include <math.h>
int isprime(int);
int main()
{
int i, end, numdata, data, primecount = 0;
scanf("%d",&numdata);
for(i = 0; i < numdata; i++) {
scanf("%d",&data);
primecount += isprime(data);
// printf("%d ",primecount);
}
printf("%d\n",primecount);
return 0;
}
int isprime(int data)
{
int i;
if(data == 2) return 1;
if(data < 2 || data % 2 == 0) return 0;
for(i = 3; i <= sqrt(data); i = i+2) {
if(data % i == 0) return 0;
}
return 1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248649/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248649/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%numdata = alloca i32, align 4
%data = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %numdata) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %data) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %numdata)
%0 = load i32, ptr %numdata, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %0, 0
br i1 %cmp6, label %for.body, label %for.end
for.body: ; preds = %entry, %isprime.exit
%primecount.08 = phi i32 [ %add, %isprime.exit ], [ 0, %entry ]
%i.07 = phi i32 [ %inc, %isprime.exit ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data)
%1 = load i32, ptr %data, align 4, !tbaa !5
%cmp.i = icmp eq i32 %1, 2
br i1 %cmp.i, label %isprime.exit, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp slt i32 %1, 2
%rem.i = and i32 %1, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %isprime.exit, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i32 %1 to double
%call19.i = call double @sqrt(double noundef %conv5.i) #5
%cmp620.i = fcmp ult double %call19.i, 3.000000e+00
br i1 %cmp620.i, label %isprime.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #5
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %isprime.exit, label %for.body.i, !llvm.loop !9
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.021.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %isprime.exit, label %for.cond.i
isprime.exit: ; preds = %for.cond.i, %for.body.i, %for.body, %if.end.i, %for.cond.preheader.i
%retval.0.i = phi i32 [ 1, %for.body ], [ 0, %if.end.i ], [ 1, %for.cond.preheader.i ], [ 1, %for.cond.i ], [ 0, %for.body.i ]
%add = add nuw nsw i32 %retval.0.i, %primecount.08
%inc = add nuw nsw i32 %i.07, 1
%2 = load i32, ptr %numdata, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %isprime.exit, %entry
%primecount.0.lcssa = phi i32 [ 0, %entry ], [ %add, %isprime.exit ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %primecount.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %data) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %numdata) #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 memory(write) uwtable
define dso_local i32 @isprime(i32 noundef %data) local_unnamed_addr #3 {
entry:
%cmp = icmp eq i32 %data, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %data, 2
%rem = and i32 %data, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end
%conv5 = sitofp i32 %data to double
%call19 = tail call double @sqrt(double noundef %conv5) #5
%cmp620 = fcmp ult double %call19, 3.000000e+00
br i1 %cmp620, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.021, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #5
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %cleanup, label %for.body, !llvm.loop !9
for.body: ; preds = %for.cond.preheader, %for.cond
%i.021 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ]
%rem8 = srem i32 %data, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.end ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main()
{
int i, j, n, A[10000], count = 0;
scanf("%d",&n);
for (i = 0; i < n; i++){
scanf("%d",&A[i]);
}
for (i = 0; i < n; i++){
if (A[i] > 1){
for (j = 2; j*j <= A[i]; j++)
if (A[i] % j == 0){
count++;
break;
}
}
else
count++;
}
printf("%d\n",n-count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248692/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248692/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.body, label %for.end25
for.cond2.preheader: ; preds = %for.body
%cmp344 = icmp sgt i32 %1, 0
br i1 %cmp344, label %for.body4.preheader, label %for.end25
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %1 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4.preheader, %for.inc23
%indvars.iv50 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next51, %for.inc23 ]
%count.046 = phi i32 [ 0, %for.body4.preheader ], [ %count.1, %for.inc23 ]
%arrayidx6 = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv50
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %3, 1
br i1 %cmp7, label %for.cond8.preheader, label %if.else
for.cond8.preheader: ; preds = %for.body4
%cmp11.not42 = icmp ult i32 %3, 4
br i1 %cmp11.not42, label %for.inc23, label %for.body12
for.cond8: ; preds = %for.body12
%inc19 = add nuw nsw i32 %j.043, 1
%mul = mul nsw i32 %inc19, %inc19
%cmp11.not = icmp sgt i32 %mul, %3
br i1 %cmp11.not, label %for.inc23, label %for.body12, !llvm.loop !11
for.body12: ; preds = %for.cond8.preheader, %for.cond8
%j.043 = phi i32 [ %inc19, %for.cond8 ], [ 2, %for.cond8.preheader ]
%rem = srem i32 %3, %j.043
%cmp15 = icmp eq i32 %rem, 0
br i1 %cmp15, label %if.then16, label %for.cond8
if.then16: ; preds = %for.body12
%inc17 = add nsw i32 %count.046, 1
br label %for.inc23
if.else: ; preds = %for.body4
%inc21 = add nsw i32 %count.046, 1
br label %for.inc23
for.inc23: ; preds = %for.cond8, %for.cond8.preheader, %if.else, %if.then16
%count.1 = phi i32 [ %inc17, %if.then16 ], [ %inc21, %if.else ], [ %count.046, %for.cond8.preheader ], [ %count.046, %for.cond8 ]
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%exitcond.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count
br i1 %exitcond.not, label %for.end25, label %for.body4, !llvm.loop !12
for.end25: ; preds = %for.inc23, %entry, %for.cond2.preheader
%.lcssa55 = phi i32 [ %1, %for.cond2.preheader ], [ %0, %entry ], [ %1, %for.inc23 ]
%count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %count.1, %for.inc23 ]
%sub = sub nsw i32 %.lcssa55, %count.0.lcssa
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
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}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<math.h>
int prime(int);
int main(){
int i,j,n,s,a=0,c=0;
scanf("%d",&s);
for(i=0;i<s;i++){
scanf("%d",&n);
a= prime(n);
if(a==1) c++;
}
printf("%d\n",c);
return 0;
}
int prime(int x){
int i;
if(x<=1)return 0;
for(i=2;i<=sqrt(x);i++){
if(x%i==0){
return 0;
}
}
return 1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248735/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248735/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 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 %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i32, ptr %s, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.cond
%c.013 = phi i32 [ %2, %for.cond ], [ 0, %entry ]
%i.012 = phi i32 [ %inc4, %for.cond ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.i = icmp slt i32 %1, 2
br i1 %cmp.i, label %for.cond, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %for.body
%conv1.i = sitofp i32 %1 to double
%call12.i = call double @sqrt(double noundef %conv1.i) #5
%cmp213.i = fcmp ult double %call12.i, 2.000000e+00
br i1 %cmp213.i, label %prime.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%inc.i = add nuw nsw i32 %i.014.i, 1
%conv.i = sitofp i32 %inc.i to double
%call.i = call double @sqrt(double noundef %conv1.i) #5
%cmp2.i = fcmp ult double %call.i, %conv.i
br i1 %cmp2.i, label %prime.exit, label %for.body.i, !llvm.loop !9
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.014.i = phi i32 [ %inc.i, %for.cond.i ], [ 2, %for.cond.preheader.i ]
%rem.i = srem i32 %1, %i.014.i
%cmp4.i = icmp eq i32 %rem.i, 0
br i1 %cmp4.i, label %for.cond, label %for.cond.i
prime.exit: ; preds = %for.cond.i, %for.cond.preheader.i
%inc = add nsw i32 %c.013, 1
br label %for.cond
for.cond: ; preds = %for.body.i, %for.body, %prime.exit
%2 = phi i32 [ %inc, %prime.exit ], [ %c.013, %for.body ], [ %c.013, %for.body.i ]
%inc4 = add nuw nsw i32 %i.012, 1
%3 = load i32, ptr %s, align 4, !tbaa !5
%cmp = icmp slt i32 %inc4, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond, %entry
%c.0.lcssa = phi i32 [ 0, %entry ], [ %2, %for.cond ]
%call5 = 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 %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind memory(write) uwtable
define dso_local i32 @prime(i32 noundef %x) local_unnamed_addr #3 {
entry:
%cmp = icmp slt i32 %x, 2
br i1 %cmp, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%conv1 = sitofp i32 %x to double
%call12 = tail call double @sqrt(double noundef %conv1) #5
%cmp213 = fcmp ult double %call12, 2.000000e+00
br i1 %cmp213, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%inc = add nuw nsw i32 %i.014, 1
%conv = sitofp i32 %inc to double
%call = tail call double @sqrt(double noundef %conv1) #5
%cmp2 = fcmp ult double %call, %conv
br i1 %cmp2, label %cleanup, label %for.body, !llvm.loop !9
for.body: ; preds = %for.cond.preheader, %for.cond
%i.014 = phi i32 [ %inc, %for.cond ], [ 2, %for.cond.preheader ]
%rem = srem i32 %x, %i.014
%cmp4 = icmp eq i32 %rem, 0
br i1 %cmp4, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <math.h>
int main(void)
{
int a[10000],c=0,d=0,k=3,n,i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
//printf("%d\n",a[i]);
}
for(i=0;i<n;i++){
if(a[i]==2){
c++;
}
else if(a[i]==1){
}
else if(a[i]%2!=0){
while(k<=sqrt(a[i])){
if(a[i]%k==0){
k=3;
d=1;
break;
}
k=k+2;
}
if(d==0){
c++;
}
d=0;
k=3;
}
}
printf("%d\n",c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248779/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248779/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp55 = icmp sgt i32 %0, 0
br i1 %cmp55, label %for.body, label %for.end40
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.body4, label %for.end40
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
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.inc38
%indvars.iv65 = phi i64 [ %indvars.iv.next66, %for.inc38 ], [ 0, %for.cond2.preheader ]
%c.062 = phi i32 [ %c.2, %for.inc38 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [10000 x i32], ptr %a, i64 0, i64 %indvars.iv65
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
switch i32 %4, label %if.else13 [
i32 2, label %if.then
i32 1, label %for.inc38
]
if.then: ; preds = %for.body4
%inc8 = add nsw i32 %c.062, 1
br label %for.inc38
if.else13: ; preds = %for.body4
%5 = and i32 %4, 1
%cmp16.not = icmp eq i32 %5, 0
br i1 %cmp16.not, label %for.inc38, label %while.cond.preheader
while.cond.preheader: ; preds = %if.else13
%conv2057 = sitofp i32 %4 to double
%call2158 = call double @sqrt(double noundef %conv2057) #4
%cmp2259 = fcmp ult double %call2158, 3.000000e+00
br i1 %cmp2259, label %if.then32, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %k.160, 2
%conv = sitofp i32 %add to double
%conv20 = sitofp i32 %6 to double
%call21 = call double @sqrt(double noundef %conv20) #4
%cmp22 = fcmp ult double %call21, %conv
br i1 %cmp22, label %if.then32, label %while.body, !llvm.loop !11
while.body: ; preds = %while.cond.preheader, %while.cond
%k.160 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%6 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%rem26 = srem i32 %6, %k.160
%cmp27 = icmp eq i32 %rem26, 0
br i1 %cmp27, label %for.inc38, label %while.cond
if.then32: ; preds = %while.cond, %while.cond.preheader
%inc33 = add nsw i32 %c.062, 1
br label %for.inc38
for.inc38: ; preds = %while.body, %if.then32, %for.body4, %if.then, %if.else13
%c.2 = phi i32 [ %inc8, %if.then ], [ %c.062, %if.else13 ], [ %c.062, %for.body4 ], [ %inc33, %if.then32 ], [ %c.062, %while.body ]
%indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp3 = icmp slt i64 %indvars.iv.next66, %8
br i1 %cmp3, label %for.body4, label %for.end40, !llvm.loop !12
for.end40: ; preds = %for.inc38, %entry, %for.cond2.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %c.2, %for.inc38 ]
%call41 = 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 %n) #4
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<math.h>
void sosuu(int a[], int n);
int main(void){
int n, i;
scanf("%d", &n);
int a[n];
for(i=0; i<n; i++){
scanf("%d", &a[i]);
}
sosuu(a, n);
return 0;
}
void sosuu(int a[], int n){
int i, ii;
int count=n;
for(i=0; i<n; i++){
ii=2;
while(ii<=sqrt(a[i])){
if(a[i]%ii!=0){
ii++;
}
else if(a[i]!=ii){
count--;
ii=a[i]+1;
}
}
}
printf("%d\n", count);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248821/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248821/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%cmp4 = icmp sgt i32 %3, 0
br i1 %cmp4, label %for.body, label %sosuu.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp36.i = icmp sgt i32 %4, 0
br i1 %cmp36.i, label %while.cond.preheader.preheader.i, label %sosuu.exit
while.cond.preheader.preheader.i: ; preds = %for.end
%wide.trip.count.i = zext i32 %4 to i64
br label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %for.inc.i, %while.cond.preheader.preheader.i
%indvars.iv.i = phi i64 [ 0, %while.cond.preheader.preheader.i ], [ %indvars.iv.next.i, %for.inc.i ]
%count.038.i = phi i32 [ %4, %while.cond.preheader.preheader.i ], [ %count.1.lcssa.i, %for.inc.i ]
%arrayidx.i = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%conv131.i = sitofp i32 %6 to double
%call32.i = call double @sqrt(double noundef %conv131.i) #5
%cmp233.i = fcmp ult double %call32.i, 2.000000e+00
br i1 %cmp233.i, label %for.inc.i, label %while.body.i
while.body.i: ; preds = %while.cond.preheader.i, %if.end15.i
%count.135.i = phi i32 [ %count.2.i, %if.end15.i ], [ %count.038.i, %while.cond.preheader.i ]
%ii.034.i = phi i32 [ %ii.1.i, %if.end15.i ], [ 2, %while.cond.preheader.i ]
%7 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%rem.i = srem i32 %7, %ii.034.i
%cmp6.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp6.not.i, label %if.else.i, label %if.then.i
if.then.i: ; preds = %while.body.i
%inc.i = add nsw i32 %ii.034.i, 1
br label %if.end15.i
if.else.i: ; preds = %while.body.i
%cmp10.not.i = icmp eq i32 %7, %ii.034.i
br i1 %cmp10.not.i, label %if.end15.i, label %if.then12.i
if.then12.i: ; preds = %if.else.i
%dec.i = add nsw i32 %count.135.i, -1
%add.i = add nsw i32 %7, 1
br label %if.end15.i
if.end15.i: ; preds = %if.then12.i, %if.else.i, %if.then.i
%ii.1.i = phi i32 [ %inc.i, %if.then.i ], [ %add.i, %if.then12.i ], [ %ii.034.i, %if.else.i ]
%count.2.i = phi i32 [ %count.135.i, %if.then.i ], [ %dec.i, %if.then12.i ], [ %count.135.i, %if.else.i ]
%conv.i = sitofp i32 %ii.1.i to double
%conv1.i = sitofp i32 %7 to double
%call.i = call double @sqrt(double noundef %conv1.i) #5
%cmp2.i = fcmp ult double %call.i, %conv.i
br i1 %cmp2.i, label %for.inc.i, label %while.body.i, !llvm.loop !11
for.inc.i: ; preds = %if.end15.i, %while.cond.preheader.i
%count.1.lcssa.i = phi i32 [ %count.038.i, %while.cond.preheader.i ], [ %count.2.i, %if.end15.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 %sosuu.exit, label %while.cond.preheader.i, !llvm.loop !12
sosuu.exit: ; preds = %for.inc.i, %entry, %for.end
%count.0.lcssa.i = phi i32 [ %4, %for.end ], [ %3, %entry ], [ %count.1.lcssa.i, %for.inc.i ]
%call17.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa.i)
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 uwtable
define dso_local void @sosuu(ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp36 = icmp sgt i32 %n, 0
br i1 %cmp36, label %while.cond.preheader.preheader, label %for.end
while.cond.preheader.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %while.cond.preheader
while.cond.preheader: ; preds = %while.cond.preheader.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %while.cond.preheader.preheader ], [ %indvars.iv.next, %for.inc ]
%count.038 = phi i32 [ %n, %while.cond.preheader.preheader ], [ %count.1.lcssa, %for.inc ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%conv131 = sitofp i32 %0 to double
%call32 = tail call double @sqrt(double noundef %conv131) #5
%cmp233 = fcmp ult double %call32, 2.000000e+00
br i1 %cmp233, label %for.inc, label %while.body
while.body: ; preds = %while.cond.preheader, %if.end15
%count.135 = phi i32 [ %count.2, %if.end15 ], [ %count.038, %while.cond.preheader ]
%ii.034 = phi i32 [ %ii.1, %if.end15 ], [ 2, %while.cond.preheader ]
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%rem = srem i32 %1, %ii.034
%cmp6.not = icmp eq i32 %rem, 0
br i1 %cmp6.not, label %if.else, label %if.then
if.then: ; preds = %while.body
%inc = add nsw i32 %ii.034, 1
br label %if.end15
if.else: ; preds = %while.body
%cmp10.not = icmp eq i32 %1, %ii.034
br i1 %cmp10.not, label %if.end15, label %if.then12
if.then12: ; preds = %if.else
%dec = add nsw i32 %count.135, -1
%add = add nsw i32 %1, 1
br label %if.end15
if.end15: ; preds = %if.else, %if.then12, %if.then
%ii.1 = phi i32 [ %inc, %if.then ], [ %add, %if.then12 ], [ %ii.034, %if.else ]
%count.2 = phi i32 [ %count.135, %if.then ], [ %dec, %if.then12 ], [ %count.135, %if.else ]
%conv = sitofp i32 %ii.1 to double
%conv1 = sitofp i32 %1 to double
%call = tail call double @sqrt(double noundef %conv1) #5
%cmp2 = fcmp ult double %call, %conv
br i1 %cmp2, label %for.inc, label %while.body, !llvm.loop !11
for.inc: ; preds = %if.end15, %while.cond.preheader
%count.1.lcssa = phi i32 [ %count.038, %while.cond.preheader ], [ %count.2, %if.end15 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %while.cond.preheader, !llvm.loop !12
for.end: ; preds = %for.inc, %entry
%count.0.lcssa = phi i32 [ %n, %entry ], [ %count.1.lcssa, %for.inc ]
%call17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<math.h>
int main()
{
int a,b,i,n,x,y,vel;
double dis,temp=1001000;
scanf("%d %d",&a,&b);
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %d %d",&x,&y,&vel);
dis=sqrt((x-a)*(x-a)+(y-b)*(y-b));
if(temp>dis/vel)
{
temp=dis/vel;
}
}
printf("%.14lf\n",temp);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24888/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24888/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [9 x i8] c"%d %d %d\00", align 1
@.str.3 = private unnamed_addr constant [8 x i8] c"%.14lf\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
%n = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%vel = 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 %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %vel) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%temp.019 = phi double [ %temp.1, %for.body ], [ 1.001000e+06, %entry ]
%i.018 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %vel)
%1 = load i32, ptr %x, align 4, !tbaa !5
%2 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %1, %2
%mul = mul nsw i32 %sub, %sub
%3 = load i32, ptr %y, align 4, !tbaa !5
%4 = load i32, ptr %b, align 4, !tbaa !5
%sub4 = sub nsw i32 %3, %4
%mul6 = mul nsw i32 %sub4, %sub4
%add = add nuw nsw i32 %mul6, %mul
%conv = sitofp i32 %add to double
%call7 = call double @sqrt(double noundef %conv) #4
%5 = load i32, ptr %vel, align 4, !tbaa !5
%conv8 = sitofp i32 %5 to double
%div = fdiv double %call7, %conv8
%cmp9 = fcmp ogt double %temp.019, %div
%temp.1 = select i1 %cmp9, double %div, double %temp.019
%inc = add nuw nsw i32 %i.018, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%temp.0.lcssa = phi double [ 1.001000e+06, %entry ], [ %temp.1, %for.body ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %temp.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %vel) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
int isprime(int);
int main(){
int n,N[10000],count=0,i;
int jud;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&N[i]);
}
for(i=0;i<n;i++){
jud = isprime(N[i]);
if(jud == 1){count++;}
}
printf("%d\n",count);
return 0;
}
int isprime(int x){
int i;
if(x == 2)return 1;
if(x < 2 || x%2 == 0)return 0;
i = 3;
while(i <= sqrt(x)){
if(x%i == 0){return 0;}
i = i + 2;
}
return 1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248937/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248937/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%N = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %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
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %for.body, label %for.end12
for.cond2.preheader: ; preds = %for.body
%1 = icmp sgt i32 %2, 0
br i1 %1, label %for.body4, label %for.end12
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 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
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.cond2.preheader, %for.cond2
%indvars.iv29 = phi i64 [ %indvars.iv.next30, %for.cond2 ], [ 0, %for.cond2.preheader ]
%count.027 = phi i32 [ %5, %for.cond2 ], [ 0, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [10000 x i32], ptr %N, i64 0, i64 %indvars.iv29
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp.i = icmp eq i32 %4, 2
br i1 %cmp.i, label %isprime.exit.thread, label %if.end.i
if.end.i: ; preds = %for.body4
%cmp1.i = icmp slt i32 %4, 2
%rem.i = and i32 %4, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %for.cond2, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i32 %4 to double
%call19.i = call double @sqrt(double noundef %conv5.i) #5
%cmp620.i = fcmp ult double %call19.i, 3.000000e+00
br i1 %cmp620.i, label %isprime.exit.thread, label %while.body.i
while.cond.i: ; preds = %while.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #5
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %isprime.exit.thread, label %while.body.i, !llvm.loop !11
while.body.i: ; preds = %while.cond.preheader.i, %while.cond.i
%i.021.i = phi i32 [ %add.i, %while.cond.i ], [ 3, %while.cond.preheader.i ]
%rem8.i = srem i32 %4, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond2, label %while.cond.i
isprime.exit.thread: ; preds = %while.cond.i, %for.body4, %while.cond.preheader.i
%inc922 = add nsw i32 %count.027, 1
br label %for.cond2
for.cond2: ; preds = %while.body.i, %if.end.i, %isprime.exit.thread
%5 = phi i32 [ %inc922, %isprime.exit.thread ], [ %count.027, %if.end.i ], [ %count.027, %while.body.i ]
%indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp3 = icmp slt i64 %indvars.iv.next30, %7
br i1 %cmp3, label %for.body4, label %for.end12, !llvm.loop !12
for.end12: ; preds = %for.cond2, %entry, %for.cond2.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %5, %for.cond2 ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %N) #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 memory(write) uwtable
define dso_local i32 @isprime(i32 noundef %x) local_unnamed_addr #3 {
entry:
%cmp = icmp eq i32 %x, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %x, 2
%rem = and i32 %x, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end
%conv5 = sitofp i32 %x to double
%call19 = tail call double @sqrt(double noundef %conv5) #5
%cmp620 = fcmp ult double %call19, 3.000000e+00
br i1 %cmp620, label %cleanup, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %i.021, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #5
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %cleanup, label %while.body, !llvm.loop !11
while.body: ; preds = %while.cond.preheader, %while.cond
%i.021 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%rem8 = srem i32 %x, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %while.cond
cleanup: ; preds = %while.body, %while.cond, %while.cond.preheader, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.end ], [ 1, %while.cond.preheader ], [ 0, %while.body ], [ 1, %while.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <math.h>
#define N 10000
int isprime(int);
int main(){
int A[N],n;
int i;
int count=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
if(isprime(A[i])==1)count++;
}
printf("%d\n",count);
return 0;
}
int isprime(int x){
int i=3;
if(x==2)return 1;
if(x<2 || x%2==0)return 3;
while(i<=sqrt(x)){
if(x%i==0)return 3;
i=i+2;
}
return 1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_248980/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_248980/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp16 = icmp sgt i32 %0, 0
br i1 %cmp16, label %for.body, label %for.end
for.body: ; preds = %entry, %isprime.exit
%indvars.iv = phi i64 [ %indvars.iv.next, %isprime.exit ], [ 0, %entry ]
%count.018 = phi i32 [ %2, %isprime.exit ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp.i = icmp eq i32 %1, 2
br i1 %cmp.i, label %.loopexit, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp slt i32 %1, 2
%rem.i = and i32 %1, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %isprime.exit, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.end.i
%conv5.i = sitofp i32 %1 to double
%call19.i = call double @sqrt(double noundef %conv5.i) #5
%cmp620.i = fcmp ult double %call19.i, 3.000000e+00
br i1 %cmp620.i, label %.loopexit, label %while.body.i
while.cond.i: ; preds = %while.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #5
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %.loopexit, label %while.body.i, !llvm.loop !9
while.body.i: ; preds = %while.cond.preheader.i, %while.cond.i
%i.021.i = phi i32 [ %add.i, %while.cond.i ], [ 3, %while.cond.preheader.i ]
%rem8.i = srem i32 %1, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %isprime.exit, label %while.cond.i
.loopexit: ; preds = %while.cond.i, %for.body, %while.cond.preheader.i
%inc14 = add nsw i32 %count.018, 1
br label %isprime.exit
isprime.exit: ; preds = %while.body.i, %if.end.i, %.loopexit
%2 = phi i32 [ %inc14, %.loopexit ], [ %count.018, %if.end.i ], [ %count.018, %while.body.i ]
%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 = %isprime.exit, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %2, %isprime.exit ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %A) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind memory(write) uwtable
define dso_local i32 @isprime(i32 noundef %x) local_unnamed_addr #3 {
entry:
%cmp = icmp eq i32 %x, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %x, 2
%rem = and i32 %x, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end
%conv5 = sitofp i32 %x to double
%call19 = tail call double @sqrt(double noundef %conv5) #5
%cmp620 = fcmp ult double %call19, 3.000000e+00
br i1 %cmp620, label %cleanup, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %i.021, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #5
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %cleanup, label %while.body, !llvm.loop !9
while.body: ; preds = %while.cond.preheader, %while.cond
%i.021 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%rem8 = srem i32 %x, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %while.cond
cleanup: ; preds = %while.body, %while.cond, %while.cond.preheader, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 3, %if.end ], [ 1, %while.cond.preheader ], [ 3, %while.body ], [ 1, %while.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define M 10000
#define MAX 10*10*10*10*10*10*10*10
int isprime(int x);
int main(){
int i,n;
int A[M];
int P=0;
scanf("%d",&n);
if(n < 1 || n > M) exit(1);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
if(A[i] < 2 || A[i] > MAX) exit(2);
if(1 == isprime(A[i])) P++;
}
printf("%d\n",P);
return 0;
}
int isprime(int x){
int i;
if(x == 2) return 1;
else if(x < 2 || x%2==0) return 0;
i = 3;
while(i<=sqrt(x)){
if(x%i == 0) return 0;
i = i + 2;
}
return 1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249022/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249022/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: 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) #6
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %A) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4
%1 = add i32 %0, -10001
%or.cond = icmp ult i32 %1, -10000
br i1 %or.cond, label %if.then, label %for.body
if.then: ; preds = %entry
call void @exit(i32 noundef 1) #7
unreachable
for.body: ; preds = %entry, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%P.034 = phi i32 [ %4, %for.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%3 = add i32 %2, -100000001
%or.cond27 = icmp ult i32 %3, -99999999
br i1 %or.cond27, label %if.then11, label %if.end12
if.then11: ; preds = %for.body
call void @exit(i32 noundef 2) #7
unreachable
if.end12: ; preds = %for.body
%cmp.i = icmp eq i32 %2, 2
br i1 %cmp.i, label %isprime.exit.thread, label %if.else.i
if.else.i: ; preds = %if.end12
%rem.i = and i32 %2, 1
%cmp2.i = icmp eq i32 %rem.i, 0
br i1 %cmp2.i, label %for.cond, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.else.i
%conv5.i = sitofp i32 %2 to double
%call19.i = call double @sqrt(double noundef %conv5.i) #6
%cmp620.i = fcmp ult double %call19.i, 3.000000e+00
br i1 %cmp620.i, label %isprime.exit.thread, label %while.body.i
while.cond.i: ; preds = %while.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = call double @sqrt(double noundef %conv5.i) #6
%cmp6.i = fcmp ult double %call.i, %conv.i
br i1 %cmp6.i, label %isprime.exit.thread, label %while.body.i, !llvm.loop !9
while.body.i: ; preds = %while.cond.preheader.i, %while.cond.i
%i.021.i = phi i32 [ %add.i, %while.cond.i ], [ 3, %while.cond.preheader.i ]
%rem8.i = srem i32 %2, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %for.cond, label %while.cond.i
isprime.exit.thread: ; preds = %while.cond.i, %if.end12, %while.cond.preheader.i
%inc30 = add nsw i32 %P.034, 1
br label %for.cond
for.cond: ; preds = %while.body.i, %if.else.i, %isprime.exit.thread
%4 = phi i32 [ %inc30, %isprime.exit.thread ], [ %P.034, %if.else.i ], [ %P.034, %while.body.i ]
%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
%cmp2 = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.cond
%call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %A) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(write) uwtable
define dso_local i32 @isprime(i32 noundef %x) local_unnamed_addr #4 {
entry:
%cmp = icmp eq i32 %x, 2
br i1 %cmp, label %cleanup, label %if.else
if.else: ; preds = %entry
%cmp1 = icmp slt i32 %x, 2
%rem = and i32 %x, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %if.else
%conv5 = sitofp i32 %x to double
%call19 = tail call double @sqrt(double noundef %conv5) #6
%cmp620 = fcmp ult double %call19, 3.000000e+00
br i1 %cmp620, label %cleanup, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %i.021, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv5) #6
%cmp6 = fcmp ult double %call, %conv
br i1 %cmp6, label %cleanup, label %while.body, !llvm.loop !9
while.body: ; preds = %while.cond.preheader, %while.cond
%i.021 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%rem8 = srem i32 %x, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %while.cond
cleanup: ; preds = %while.body, %while.cond, %while.cond.preheader, %if.else, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %if.else ], [ 1, %while.cond.preheader ], [ 0, %while.body ], [ 1, %while.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #5
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { 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 prime(int x) {
int i;
if( x == 2)
return 1;
if(x < 2 || x % 2 == 0)
return -1;
i = 3;
while(i * i <= x) {
if(x % i == 0)
return -1;
i = i + 2;
}
return 1;
}
int main(void)
{
int n , m , i;
int Num[10005];
int count = 0;
scanf("%d" , &n);
for (i = 0 ; i < n ; i++){
scanf("%d¥n" , &Num[i]);
}
for (m = 0 ; m < n ; m++){
if(prime(Num[m]) == 1)
count++;
}
printf("%d\n" , count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249066/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249066/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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\C2\A5n\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @prime(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp eq i32 %x, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp slt i32 %x, 2
%rem = and i32 %x, 1
%cmp2 = icmp eq i32 %rem, 0
%or.cond = or i1 %cmp1, %cmp2
br i1 %or.cond, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end
%cmp5.not17 = icmp ult i32 %x, 9
br i1 %cmp5.not17, label %cleanup, label %while.body
while.cond: ; preds = %while.body
%add = add nuw nsw i32 %i.018, 2
%mul = mul nsw i32 %add, %add
%cmp5.not = icmp sgt i32 %mul, %x
br i1 %cmp5.not, label %cleanup, label %while.body, !llvm.loop !5
while.body: ; preds = %while.cond.preheader, %while.cond
%i.018 = phi i32 [ %add, %while.cond ], [ 3, %while.cond.preheader ]
%rem6 = srem i32 %x, %i.018
%cmp7 = icmp eq i32 %rem6, 0
br i1 %cmp7, label %cleanup, label %while.cond
cleanup: ; preds = %while.body, %while.cond, %while.cond.preheader, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ -1, %if.end ], [ 1, %while.cond.preheader ], [ -1, %while.body ], [ 1, %while.cond ]
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
%Num = alloca [10005 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 40020, ptr nonnull %Num) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %for.body, label %for.end12
for.cond2.preheader: ; preds = %for.body
%cmp325 = icmp sgt i32 %1, 0
br i1 %cmp325, label %for.body4.preheader, label %for.end12
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %1 to i64
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10005 x i32], ptr %Num, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !7
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !11
for.body4: ; preds = %for.body4.preheader, %prime.exit
%indvars.iv32 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next33, %prime.exit ]
%count.027 = phi i32 [ 0, %for.body4.preheader ], [ %4, %prime.exit ]
%arrayidx6 = getelementptr inbounds [10005 x i32], ptr %Num, i64 0, i64 %indvars.iv32
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !7
%cmp.i = icmp eq i32 %3, 2
br i1 %cmp.i, label %.loopexit, label %if.end.i
if.end.i: ; preds = %for.body4
%cmp1.i = icmp slt i32 %3, 2
%rem.i = and i32 %3, 1
%cmp2.i = icmp eq i32 %rem.i, 0
%or.cond.i = or i1 %cmp1.i, %cmp2.i
br i1 %or.cond.i, label %prime.exit, label %while.cond.preheader.i
while.cond.preheader.i: ; preds = %if.end.i
%cmp5.not17.i = icmp ult i32 %3, 9
br i1 %cmp5.not17.i, label %.loopexit, label %while.body.i
while.cond.i: ; preds = %while.body.i
%add.i = add nuw nsw i32 %i.018.i, 2
%mul.i = mul nsw i32 %add.i, %add.i
%cmp5.not.i = icmp sgt i32 %mul.i, %3
br i1 %cmp5.not.i, label %.loopexit, label %while.body.i, !llvm.loop !5
while.body.i: ; preds = %while.cond.preheader.i, %while.cond.i
%i.018.i = phi i32 [ %add.i, %while.cond.i ], [ 3, %while.cond.preheader.i ]
%rem6.i = srem i32 %3, %i.018.i
%cmp7.i = icmp eq i32 %rem6.i, 0
br i1 %cmp7.i, label %prime.exit, label %while.cond.i
.loopexit: ; preds = %while.cond.i, %for.body4, %while.cond.preheader.i
%inc921 = add nsw i32 %count.027, 1
br label %prime.exit
prime.exit: ; preds = %while.body.i, %if.end.i, %.loopexit
%4 = phi i32 [ %inc921, %.loopexit ], [ %count.027, %if.end.i ], [ %count.027, %while.body.i ]
%indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1
%exitcond.not = icmp eq i64 %indvars.iv.next33, %wide.trip.count
br i1 %exitcond.not, label %for.end12, label %for.body4, !llvm.loop !12
for.end12: ; preds = %prime.exit, %entry, %for.cond2.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %4, %prime.exit ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 40020, ptr nonnull %Num) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
|
#include <stdio.h>
#define MAX 10000
#define T 1
#define F 0
int i;
int isPrime(int x){
// printf("%d",x);
if(x<=1){
return F;
}
if(x==2) return T;
if(x%2==0) return F;
for(i=3;i*i<=x;i+=2){
if(x%i==0 && x!=i){
return F;
}
}
return T;
}
int main(){
int i,j=0,x[MAX],n,c;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&x[i]);
c=isPrime(x[i]);
if(c==1)j++;
}
printf("%d\n",j);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249109/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249109/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@i = 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: nofree norecurse nosync nounwind memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @isPrime(i32 noundef %x) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %x, 2
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp eq i32 %x, 2
br i1 %cmp1, label %return, label %if.end3
if.end3: ; preds = %if.end
%rem = and i32 %x, 1
%cmp4 = icmp eq i32 %rem, 0
br i1 %cmp4, label %return, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end3
%cmp7.not18 = icmp ult i32 %x, 9
br i1 %cmp7.not18, label %return.loopexit, label %for.body
for.body: ; preds = %for.cond.preheader, %for.inc
%storemerge19 = phi i32 [ %add, %for.inc ], [ 3, %for.cond.preheader ]
%rem8 = srem i32 %x, %storemerge19
%cmp9 = icmp ne i32 %rem8, 0
%cmp10.not = icmp eq i32 %storemerge19, %x
%or.cond = or i1 %cmp10.not, %cmp9
br i1 %or.cond, label %for.inc, label %return.loopexit
for.inc: ; preds = %for.body
%add = add nuw nsw i32 %storemerge19, 2
%mul = mul nsw i32 %add, %add
%cmp7.not = icmp sgt i32 %mul, %x
br i1 %cmp7.not, label %return.loopexit, label %for.body, !llvm.loop !5
return.loopexit: ; preds = %for.inc, %for.body, %for.cond.preheader
%storemerge.lcssa = phi i32 [ 3, %for.cond.preheader ], [ %storemerge19, %for.body ], [ %add, %for.inc ]
%retval.0.ph = phi i32 [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.inc ]
store i32 %storemerge.lcssa, ptr @i, align 4, !tbaa !7
br label %return
return: ; preds = %return.loopexit, %if.end3, %if.end, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %if.end ], [ 0, %if.end3 ], [ %retval.0.ph, %return.loopexit ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%x = alloca [10000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !7
%cmp26 = icmp sgt i32 %0, 0
br i1 %cmp26, label %for.body, label %for.end
for.body: ; preds = %entry, %isPrime.exit.thread
%indvars.iv = phi i64 [ %indvars.iv.next, %isPrime.exit.thread ], [ 0, %entry ]
%j.027 = phi i32 [ %2, %isPrime.exit.thread ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10000 x i32], ptr %x, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !7
%cmp.i = icmp slt i32 %1, 2
br i1 %cmp.i, label %isPrime.exit.thread, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp eq i32 %1, 2
br i1 %cmp1.i, label %isPrime.exit.thread15, label %if.end3.i
isPrime.exit.thread15: ; preds = %if.end.i
%inc18 = add nsw i32 %j.027, 1
br label %isPrime.exit.thread
if.end3.i: ; preds = %if.end.i
%rem.i = and i32 %1, 1
%cmp4.i = icmp eq i32 %rem.i, 0
br i1 %cmp4.i, label %isPrime.exit.thread, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.end3.i
%cmp7.not18.i = icmp ult i32 %1, 9
br i1 %cmp7.not18.i, label %isPrime.exit.thread20, label %for.body.i
for.body.i: ; preds = %for.cond.preheader.i, %for.inc.i
%storemerge19.i = phi i32 [ %add.i, %for.inc.i ], [ 3, %for.cond.preheader.i ]
%rem8.i = srem i32 %1, %storemerge19.i
%cmp9.i = icmp ne i32 %rem8.i, 0
%cmp10.not.i = icmp eq i32 %storemerge19.i, %1
%or.cond.i = or i1 %cmp10.not.i, %cmp9.i
br i1 %or.cond.i, label %for.inc.i, label %isPrime.exit
for.inc.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %storemerge19.i, 2
%mul.i = mul nsw i32 %add.i, %add.i
%cmp7.not.i = icmp sgt i32 %mul.i, %1
br i1 %cmp7.not.i, label %isPrime.exit.thread20, label %for.body.i, !llvm.loop !5
isPrime.exit.thread20: ; preds = %for.inc.i, %for.cond.preheader.i
%storemerge.lcssa.i.ph = phi i32 [ 3, %for.cond.preheader.i ], [ %add.i, %for.inc.i ]
store i32 %storemerge.lcssa.i.ph, ptr @i, align 4, !tbaa !7
%inc24 = add nsw i32 %j.027, 1
br label %isPrime.exit.thread
isPrime.exit: ; preds = %for.body.i
store i32 %storemerge19.i, ptr @i, align 4, !tbaa !7
br label %isPrime.exit.thread
isPrime.exit.thread: ; preds = %if.end3.i, %for.body, %isPrime.exit, %isPrime.exit.thread20, %isPrime.exit.thread15
%2 = phi i32 [ %inc18, %isPrime.exit.thread15 ], [ %inc24, %isPrime.exit.thread20 ], [ %j.027, %isPrime.exit ], [ %j.027, %for.body ], [ %j.027, %if.end3.i ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !7
%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 = %isPrime.exit.thread, %entry
%j.0.lcssa = phi i32 [ 0, %entry ], [ %2, %isPrime.exit.thread ]
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %j.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 40000, 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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { nofree norecurse nosync nounwind memory(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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
|
#include<stdio.h>
#include<math.h>
int main ()
{
int a,b,n,x,y,z,i,Yes_this_is_the_begining=1;
double m,o,p,q;
scanf("%d %d",&a,&b);
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %d %d",&x,&y,&z);
m=(a-x)*(a-x)+(b-y)*(b-y);
o=sqrt(m);
p=o/z;
if(Yes_this_is_the_begining==1)q=p,Yes_this_is_the_begining=0;
else
{
if(p<q)q=p;
}
}
printf("%.20llf",q);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24916/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24916/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [9 x i8] c"%d %d %d\00", align 1
@.str.3 = private unnamed_addr constant [8 x i8] c"%.20llf\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
for.inc.peel:
%a = alloca i32, align 4
%b = alloca i32, align 4
%n = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %z) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp20)
%call2.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %x, align 4, !tbaa !5
%sub.peel = sub nsw i32 %1, %2
%mul.peel = mul nsw i32 %sub.peel, %sub.peel
%3 = load i32, ptr %b, align 4, !tbaa !5
%4 = load i32, ptr %y, align 4, !tbaa !5
%sub4.peel = sub nsw i32 %3, %4
%mul6.peel = mul nsw i32 %sub4.peel, %sub4.peel
%add.peel = add nuw nsw i32 %mul6.peel, %mul.peel
%conv.peel = sitofp i32 %add.peel to double
%call7.peel = call double @sqrt(double noundef %conv.peel) #5
%5 = load i32, ptr %z, align 4, !tbaa !5
%conv8.peel = sitofp i32 %5 to double
%div.peel = fdiv double %call7.peel, %conv8.peel
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp.peel = icmp sgt i32 %6, 1
br i1 %cmp.peel, label %if.else, label %for.end
if.else: ; preds = %for.inc.peel, %if.else
%q.023 = phi double [ %q.1, %if.else ], [ %div.peel, %for.inc.peel ]
%i.022 = phi i32 [ %inc, %if.else ], [ 1, %for.inc.peel ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z)
%7 = load i32, ptr %a, align 4, !tbaa !5
%8 = load i32, ptr %x, align 4, !tbaa !5
%sub = sub nsw i32 %7, %8
%mul = mul nsw i32 %sub, %sub
%9 = load i32, ptr %b, align 4, !tbaa !5
%10 = load i32, ptr %y, align 4, !tbaa !5
%sub4 = sub nsw i32 %9, %10
%mul6 = mul nsw i32 %sub4, %sub4
%add = add nuw nsw i32 %mul6, %mul
%conv = sitofp i32 %add to double
%call7 = call double @sqrt(double noundef %conv) #5
%11 = load i32, ptr %z, align 4, !tbaa !5
%conv8 = sitofp i32 %11 to double
%div = fdiv double %call7, %conv8
%cmp11 = fcmp olt double %div, %q.023
%q.1 = select i1 %cmp11, double %div, double %q.023
%inc = add nuw nsw i32 %i.022, 1
%12 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %12
br i1 %cmp, label %if.else, label %for.end, !llvm.loop !9
for.end: ; preds = %if.else, %for.inc.peel
%q.1.lcssa = phi double [ %div.peel, %for.inc.peel ], [ %q.1, %if.else ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %q.1.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
#include <string.h>
int main(void){
char s[100000+5];
scanf("%s", s);
int n=strlen(s);
int ans[100000]={0};
int i=0;
while(i<n){
int r=0, l=0;
while(s[i]=='R')i++, r++;
int p=i;
while(s[i]=='L')i++, l++;
ans[p-1]=(r+1)/2+l/2;
ans[p]=r/2+(l+1)/2;
}
for(int i=0; i<n; i++)printf("%d ", ans[i]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249202/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249202/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100005 x i8], align 16
%ans = alloca [100000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 100005, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%conv = trunc i64 %call2 to i32
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %ans) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400000) %ans, i8 0, i64 400000, i1 false)
%cmp69 = icmp sgt i32 %conv, 0
br i1 %cmp69, label %while.cond4.preheader, label %for.cond.cleanup
while.cond4.preheader: ; preds = %entry, %while.end19
%i.070 = phi i32 [ %i.2.lcssa, %while.end19 ], [ 0, %entry ]
%idxprom55 = sext i32 %i.070 to i64
%arrayidx56 = getelementptr inbounds [100005 x i8], ptr %s, i64 0, i64 %idxprom55
%0 = load i8, ptr %arrayidx56, align 1, !tbaa !5
%cmp657 = icmp eq i8 %0, 82
br i1 %cmp657, label %while.body8, label %while.cond10.preheader
for.cond.preheader: ; preds = %while.end19
br i1 %cmp69, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = and i64 %call2, 4294967295
br label %for.body
while.cond10.preheader.loopexit: ; preds = %while.body8
%1 = trunc i64 %indvars.iv.next to i32
%sext = shl i64 %indvars.iv.next, 32
%.pre = ashr exact i64 %sext, 32
%arrayidx1263.phi.trans.insert = getelementptr inbounds [100005 x i8], ptr %s, i64 0, i64 %.pre
%.pre81 = load i8, ptr %arrayidx1263.phi.trans.insert, align 1, !tbaa !5
br label %while.cond10.preheader
while.cond10.preheader: ; preds = %while.cond10.preheader.loopexit, %while.cond4.preheader
%2 = phi i8 [ %.pre81, %while.cond10.preheader.loopexit ], [ %0, %while.cond4.preheader ]
%idxprom1162.pre-phi = phi i64 [ %.pre, %while.cond10.preheader.loopexit ], [ %idxprom55, %while.cond4.preheader ]
%r.0.lcssa = phi i32 [ %inc9, %while.cond10.preheader.loopexit ], [ 0, %while.cond4.preheader ]
%i.1.lcssa = phi i32 [ %1, %while.cond10.preheader.loopexit ], [ %i.070, %while.cond4.preheader ]
%idxprom.lcssa = phi i64 [ %indvars.iv.next, %while.cond10.preheader.loopexit ], [ %idxprom55, %while.cond4.preheader ]
%cmp1464 = icmp eq i8 %2, 76
br i1 %cmp1464, label %while.body16, label %while.end19
while.body8: ; preds = %while.cond4.preheader, %while.body8
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body8 ], [ %idxprom55, %while.cond4.preheader ]
%r.058 = phi i32 [ %inc9, %while.body8 ], [ 0, %while.cond4.preheader ]
%indvars.iv.next = add i64 %indvars.iv, 1
%inc9 = add nuw nsw i32 %r.058, 1
%arrayidx = getelementptr inbounds [100005 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp6 = icmp eq i8 %3, 82
br i1 %cmp6, label %while.body8, label %while.cond10.preheader.loopexit, !llvm.loop !8
while.body16: ; preds = %while.cond10.preheader, %while.body16
%indvars.iv75 = phi i64 [ %indvars.iv.next76, %while.body16 ], [ %idxprom1162.pre-phi, %while.cond10.preheader ]
%l.065 = phi i32 [ %inc18, %while.body16 ], [ 0, %while.cond10.preheader ]
%indvars.iv.next76 = add i64 %indvars.iv75, 1
%inc18 = add nuw nsw i32 %l.065, 1
%arrayidx12 = getelementptr inbounds [100005 x i8], ptr %s, i64 0, i64 %indvars.iv.next76
%4 = load i8, ptr %arrayidx12, align 1, !tbaa !5
%cmp14 = icmp eq i8 %4, 76
br i1 %cmp14, label %while.body16, label %while.end19.loopexit, !llvm.loop !10
while.end19.loopexit: ; preds = %while.body16
%5 = trunc i64 %indvars.iv.next76 to i32
br label %while.end19
while.end19: ; preds = %while.end19.loopexit, %while.cond10.preheader
%l.0.lcssa = phi i32 [ 0, %while.cond10.preheader ], [ %inc18, %while.end19.loopexit ]
%i.2.lcssa = phi i32 [ %i.1.lcssa, %while.cond10.preheader ], [ %5, %while.end19.loopexit ]
%add = add nuw nsw i32 %r.0.lcssa, 1
%div51 = lshr i32 %add, 1
%div2052 = lshr i32 %l.0.lcssa, 1
%add21 = add nuw nsw i32 %div2052, %div51
%sub = add nsw i32 %i.1.lcssa, -1
%idxprom22 = sext i32 %sub to i64
%arrayidx23 = getelementptr inbounds [100000 x i32], ptr %ans, i64 0, i64 %idxprom22
store i32 %add21, ptr %arrayidx23, align 4, !tbaa !11
%div2453 = lshr i32 %r.0.lcssa, 1
%add25 = add nuw nsw i32 %l.0.lcssa, 1
%div2654 = lshr i32 %add25, 1
%add27 = add nuw nsw i32 %div2654, %div2453
%arrayidx29 = getelementptr inbounds [100000 x i32], ptr %ans, i64 0, i64 %idxprom.lcssa
store i32 %add27, ptr %arrayidx29, align 4, !tbaa !11
%cmp = icmp slt i32 %i.2.lcssa, %conv
br i1 %cmp, label %while.cond4.preheader, label %for.cond.preheader, !llvm.loop !13
for.cond.cleanup: ; preds = %for.body, %entry, %for.cond.preheader
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %ans) #5
call void @llvm.lifetime.end.p0(i64 100005, ptr nonnull %s) #5
ret i32 0
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv78 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next79, %for.body ]
%arrayidx35 = getelementptr inbounds [100000 x i32], ptr %ans, i64 0, i64 %indvars.iv78
%6 = load i32, ptr %arrayidx35, align 4, !tbaa !11
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6)
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%exitcond.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = distinct !{!13, !9}
!14 = distinct !{!14, !9}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define reverse_array(type, arr, n) \
do { \
for (int i = 0; i < n / 2; i++) { \
type __t = arr[i]; \
arr[i] = arr[n - i - 1]; \
arr[n - i - 1] = __t; \
} \
} while (0)
int main(void)
{
char s[100001];
scanf("%s", s);
int s_len = strlen(s);
int* child_num = calloc(s_len, sizeof(int));
for (int direction = 0; direction < 2; direction++) {
int count = 0;
for (int i = 0; i < s_len; i++) {
if (s[i] == 'R') {
count++;
} else {
child_num[i - 1] += (count + 1) / 2;
child_num[i] += count / 2;
count = 0;
}
}
reverse_array(char, s, s_len);
reverse_array(int, child_num, s_len);
for (int i = 0; i < s_len; i++) {
s[i] = (s[i] == 'R' ? 'L' : 'R');
}
}
for (int i = 0; i < s_len; i++) {
printf("%d ", child_num[i]);
}
putchar('\n');
free(child_num);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249246/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249246/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100001, ptr nonnull %s) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #7
%conv = trunc i64 %call2 to i32
%sext = shl i64 %call2, 32
%conv3 = ashr exact i64 %sext, 32
%call4 = call noalias ptr @calloc(i64 noundef %conv3, i64 noundef 4) #8
%cmp7141 = icmp sgt i32 %conv, 0
%div24 = sdiv i32 %conv, 2
%cmp25144 = icmp sgt i32 %conv, 1
br i1 %cmp7141, label %for.cond6.preheader.us.preheader, label %for.cond.cleanup94
for.cond6.preheader.us.preheader: ; preds = %entry
%wide.trip.count257 = and i64 %call2, 4294967295
%invariant.gep = getelementptr i32, ptr %call4, i64 -1
br label %for.body10.us
for.cond.cleanup74.us: ; preds = %for.body75.us, %vec.epilog.middle.block, %middle.block
%invariant.gep287 = getelementptr i32, ptr %call4, i64 -1
br label %for.body10.us.1
for.body10.us.1: ; preds = %for.inc.us.1, %for.cond.cleanup74.us
%indvars.iv253.1 = phi i64 [ 0, %for.cond.cleanup74.us ], [ %indvars.iv.next254.1, %for.inc.us.1 ]
%count.0142.us.1 = phi i32 [ 0, %for.cond.cleanup74.us ], [ %count.1.us.1, %for.inc.us.1 ]
%arrayidx.us.1 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv253.1
%0 = load i8, ptr %arrayidx.us.1, align 1, !tbaa !5
%cmp12.us.1 = icmp eq i8 %0, 82
%inc.us.1 = add nsw i32 %count.0142.us.1, 1
br i1 %cmp12.us.1, label %for.inc.us.1, label %if.else.us.1
if.else.us.1: ; preds = %for.body10.us.1
%1 = insertelement <2 x i32> poison, i32 %inc.us.1, i64 0
%2 = insertelement <2 x i32> %1, i32 %count.0142.us.1, i64 1
%3 = sdiv <2 x i32> %2, <i32 2, i32 2>
%gep288 = getelementptr i32, ptr %invariant.gep287, i64 %indvars.iv253.1
%4 = load <2 x i32>, ptr %gep288, align 4, !tbaa !8
%5 = add nsw <2 x i32> %4, %3
store <2 x i32> %5, ptr %gep288, align 4, !tbaa !8
br label %for.inc.us.1
for.inc.us.1: ; preds = %for.body10.us.1, %if.else.us.1
%count.1.us.1 = phi i32 [ 0, %if.else.us.1 ], [ %inc.us.1, %for.body10.us.1 ]
%indvars.iv.next254.1 = add nuw nsw i64 %indvars.iv253.1, 1
%exitcond258.1.not = icmp eq i64 %indvars.iv.next254.1, %wide.trip.count257
br i1 %exitcond258.1.not, label %for.cond6.for.cond23.preheader_crit_edge.us.1, label %for.body10.us.1, !llvm.loop !10
for.cond6.for.cond23.preheader_crit_edge.us.1: ; preds = %for.inc.us.1
br i1 %cmp25144, label %for.body28.us.preheader.1, label %iter.check300
for.body28.us.preheader.1: ; preds = %for.cond6.for.cond23.preheader_crit_edge.us.1
%wide.trip.count262.1 = zext i32 %div24 to i64
%6 = add nsw i64 %wide.trip.count262.1, -1
%xtraiter345 = and i64 %wide.trip.count262.1, 1
%7 = icmp eq i64 %6, 0
br i1 %7, label %for.cond46.preheader.us.1.unr-lcssa, label %for.body28.us.preheader.1.new
for.body28.us.preheader.1.new: ; preds = %for.body28.us.preheader.1
%unroll_iter347 = and i64 %wide.trip.count262.1, 4294967294
br label %for.body28.us.1
for.body28.us.1: ; preds = %for.body28.us.1, %for.body28.us.preheader.1.new
%indvars.iv259.1 = phi i64 [ 0, %for.body28.us.preheader.1.new ], [ %indvars.iv.next260.1.1, %for.body28.us.1 ]
%niter348 = phi i64 [ 0, %for.body28.us.preheader.1.new ], [ %niter348.next.1, %for.body28.us.1 ]
%arrayidx30.us.1 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv259.1
%8 = load i8, ptr %arrayidx30.us.1, align 2, !tbaa !5
%9 = xor i64 %indvars.iv259.1, -1
%sub32.us.1 = add i64 %call2, %9
%sext285 = shl i64 %sub32.us.1, 32
%idxprom33.us.1 = ashr exact i64 %sext285, 32
%arrayidx34.us.1 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %idxprom33.us.1
%10 = load i8, ptr %arrayidx34.us.1, align 1, !tbaa !5
store i8 %10, ptr %arrayidx30.us.1, align 2, !tbaa !5
store i8 %8, ptr %arrayidx34.us.1, align 1, !tbaa !5
%indvars.iv.next260.1 = or i64 %indvars.iv259.1, 1
%arrayidx30.us.1.1 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv.next260.1
%11 = load i8, ptr %arrayidx30.us.1.1, align 1, !tbaa !5
%12 = xor i64 %indvars.iv259.1, 4294967294
%sub32.us.1.1 = add i64 %call2, %12
%sext285.1 = shl i64 %sub32.us.1.1, 32
%idxprom33.us.1.1 = ashr exact i64 %sext285.1, 32
%arrayidx34.us.1.1 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %idxprom33.us.1.1
%13 = load i8, ptr %arrayidx34.us.1.1, align 1, !tbaa !5
store i8 %13, ptr %arrayidx30.us.1.1, align 1, !tbaa !5
store i8 %11, ptr %arrayidx34.us.1.1, align 1, !tbaa !5
%indvars.iv.next260.1.1 = add nuw nsw i64 %indvars.iv259.1, 2
%niter348.next.1 = add i64 %niter348, 2
%niter348.ncmp.1 = icmp eq i64 %niter348.next.1, %unroll_iter347
br i1 %niter348.ncmp.1, label %for.cond46.preheader.us.1.unr-lcssa, label %for.body28.us.1, !llvm.loop !12
for.cond46.preheader.us.1.unr-lcssa: ; preds = %for.body28.us.1, %for.body28.us.preheader.1
%indvars.iv259.1.unr = phi i64 [ 0, %for.body28.us.preheader.1 ], [ %indvars.iv.next260.1.1, %for.body28.us.1 ]
%lcmp.mod346.not = icmp eq i64 %xtraiter345, 0
br i1 %lcmp.mod346.not, label %for.cond46.preheader.us.1, label %for.body28.us.1.epil
for.body28.us.1.epil: ; preds = %for.cond46.preheader.us.1.unr-lcssa
%arrayidx30.us.1.epil = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv259.1.unr
%14 = load i8, ptr %arrayidx30.us.1.epil, align 1, !tbaa !5
%15 = xor i64 %indvars.iv259.1.unr, -1
%sub32.us.1.epil = add i64 %call2, %15
%sext285.epil = shl i64 %sub32.us.1.epil, 32
%idxprom33.us.1.epil = ashr exact i64 %sext285.epil, 32
%arrayidx34.us.1.epil = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %idxprom33.us.1.epil
%16 = load i8, ptr %arrayidx34.us.1.epil, align 1, !tbaa !5
store i8 %16, ptr %arrayidx30.us.1.epil, align 1, !tbaa !5
store i8 %14, ptr %arrayidx34.us.1.epil, align 1, !tbaa !5
br label %for.cond46.preheader.us.1
for.cond46.preheader.us.1: ; preds = %for.cond46.preheader.us.1.unr-lcssa, %for.body28.us.1.epil
br i1 %cmp25144, label %for.body51.us.preheader.1, label %iter.check300
for.body51.us.preheader.1: ; preds = %for.cond46.preheader.us.1
%xtraiter349 = and i64 %wide.trip.count262.1, 1
%17 = icmp eq i64 %6, 0
br i1 %17, label %iter.check300.loopexit.unr-lcssa, label %for.body51.us.preheader.1.new
for.body51.us.preheader.1.new: ; preds = %for.body51.us.preheader.1
%unroll_iter351 = and i64 %wide.trip.count262.1, 4294967294
br label %for.body51.us.1
for.body51.us.1: ; preds = %for.body51.us.1, %for.body51.us.preheader.1.new
%indvars.iv264.1 = phi i64 [ 0, %for.body51.us.preheader.1.new ], [ %indvars.iv.next265.1.1, %for.body51.us.1 ]
%niter352 = phi i64 [ 0, %for.body51.us.preheader.1.new ], [ %niter352.next.1, %for.body51.us.1 ]
%arrayidx54.us.1 = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv264.1
%18 = load i32, ptr %arrayidx54.us.1, align 4, !tbaa !8
%19 = xor i64 %indvars.iv264.1, -1
%sub56.us.1 = add i64 %call2, %19
%sext286 = shl i64 %sub56.us.1, 32
%idxprom57.us.1 = ashr exact i64 %sext286, 32
%arrayidx58.us.1 = getelementptr inbounds i32, ptr %call4, i64 %idxprom57.us.1
%20 = load i32, ptr %arrayidx58.us.1, align 4, !tbaa !8
store i32 %20, ptr %arrayidx54.us.1, align 4, !tbaa !8
store i32 %18, ptr %arrayidx58.us.1, align 4, !tbaa !8
%indvars.iv.next265.1 = or i64 %indvars.iv264.1, 1
%arrayidx54.us.1.1 = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv.next265.1
%21 = load i32, ptr %arrayidx54.us.1.1, align 4, !tbaa !8
%22 = xor i64 %indvars.iv264.1, 4294967294
%sub56.us.1.1 = add i64 %call2, %22
%sext286.1 = shl i64 %sub56.us.1.1, 32
%idxprom57.us.1.1 = ashr exact i64 %sext286.1, 32
%arrayidx58.us.1.1 = getelementptr inbounds i32, ptr %call4, i64 %idxprom57.us.1.1
%23 = load i32, ptr %arrayidx58.us.1.1, align 4, !tbaa !8
store i32 %23, ptr %arrayidx54.us.1.1, align 4, !tbaa !8
store i32 %21, ptr %arrayidx58.us.1.1, align 4, !tbaa !8
%indvars.iv.next265.1.1 = add nuw nsw i64 %indvars.iv264.1, 2
%niter352.next.1 = add i64 %niter352, 2
%niter352.ncmp.1 = icmp eq i64 %niter352.next.1, %unroll_iter351
br i1 %niter352.ncmp.1, label %iter.check300.loopexit.unr-lcssa, label %for.body51.us.1, !llvm.loop !13
iter.check300.loopexit.unr-lcssa: ; preds = %for.body51.us.1, %for.body51.us.preheader.1
%indvars.iv264.1.unr = phi i64 [ 0, %for.body51.us.preheader.1 ], [ %indvars.iv.next265.1.1, %for.body51.us.1 ]
%lcmp.mod350.not = icmp eq i64 %xtraiter349, 0
br i1 %lcmp.mod350.not, label %iter.check300, label %for.body51.us.1.epil
for.body51.us.1.epil: ; preds = %iter.check300.loopexit.unr-lcssa
%arrayidx54.us.1.epil = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv264.1.unr
%24 = load i32, ptr %arrayidx54.us.1.epil, align 4, !tbaa !8
%25 = xor i64 %indvars.iv264.1.unr, -1
%sub56.us.1.epil = add i64 %call2, %25
%sext286.epil = shl i64 %sub56.us.1.epil, 32
%idxprom57.us.1.epil = ashr exact i64 %sext286.epil, 32
%arrayidx58.us.1.epil = getelementptr inbounds i32, ptr %call4, i64 %idxprom57.us.1.epil
%26 = load i32, ptr %arrayidx58.us.1.epil, align 4, !tbaa !8
store i32 %26, ptr %arrayidx54.us.1.epil, align 4, !tbaa !8
store i32 %24, ptr %arrayidx58.us.1.epil, align 4, !tbaa !8
br label %iter.check300
iter.check300: ; preds = %for.body51.us.1.epil, %iter.check300.loopexit.unr-lcssa, %for.cond6.for.cond23.preheader_crit_edge.us.1, %for.cond46.preheader.us.1
%min.iters.check298 = icmp ult i64 %wide.trip.count257, 8
br i1 %min.iters.check298, label %for.body75.us.1.preheader, label %vector.main.loop.iter.check302
vector.main.loop.iter.check302: ; preds = %iter.check300
%min.iters.check301 = icmp ult i64 %wide.trip.count257, 32
br i1 %min.iters.check301, label %vec.epilog.ph315, label %vector.ph303
vector.ph303: ; preds = %vector.main.loop.iter.check302
%n.mod.vf304 = and i64 %call2, 31
%n.vec305 = sub nsw i64 %wide.trip.count257, %n.mod.vf304
br label %vector.body307
vector.body307: ; preds = %vector.body307, %vector.ph303
%index308 = phi i64 [ 0, %vector.ph303 ], [ %index.next311, %vector.body307 ]
%27 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %index308
%wide.load309 = load <16 x i8>, ptr %27, align 16, !tbaa !5
%28 = getelementptr inbounds i8, ptr %27, i64 16
%wide.load310 = load <16 x i8>, ptr %28, align 16, !tbaa !5
%29 = icmp eq <16 x i8> %wide.load309, <i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82>
%30 = icmp eq <16 x i8> %wide.load310, <i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82>
%31 = select <16 x i1> %29, <16 x i8> <i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76>, <16 x i8> <i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82>
%32 = select <16 x i1> %30, <16 x i8> <i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76>, <16 x i8> <i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82>
store <16 x i8> %31, ptr %27, align 16, !tbaa !5
store <16 x i8> %32, ptr %28, align 16, !tbaa !5
%index.next311 = add nuw i64 %index308, 32
%33 = icmp eq i64 %index.next311, %n.vec305
br i1 %33, label %middle.block297, label %vector.body307, !llvm.loop !14
middle.block297: ; preds = %vector.body307
%cmp.n306 = icmp eq i64 %n.mod.vf304, 0
br i1 %cmp.n306, label %for.cond91.preheader, label %vec.epilog.iter.check314
vec.epilog.iter.check314: ; preds = %middle.block297
%min.epilog.iters.check317 = icmp ult i64 %n.mod.vf304, 8
br i1 %min.epilog.iters.check317, label %for.body75.us.1.preheader, label %vec.epilog.ph315
vec.epilog.ph315: ; preds = %vector.main.loop.iter.check302, %vec.epilog.iter.check314
%vec.epilog.resume.val318 = phi i64 [ %n.vec305, %vec.epilog.iter.check314 ], [ 0, %vector.main.loop.iter.check302 ]
%n.mod.vf319 = and i64 %call2, 7
%n.vec320 = sub nsw i64 %wide.trip.count257, %n.mod.vf319
br label %vec.epilog.vector.body323
vec.epilog.vector.body323: ; preds = %vec.epilog.vector.body323, %vec.epilog.ph315
%index324 = phi i64 [ %vec.epilog.resume.val318, %vec.epilog.ph315 ], [ %index.next326, %vec.epilog.vector.body323 ]
%34 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %index324
%wide.load325 = load <8 x i8>, ptr %34, align 1, !tbaa !5
%35 = icmp eq <8 x i8> %wide.load325, <i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82>
%36 = select <8 x i1> %35, <8 x i8> <i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76>, <8 x i8> <i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82>
store <8 x i8> %36, ptr %34, align 1, !tbaa !5
%index.next326 = add nuw i64 %index324, 8
%37 = icmp eq i64 %index.next326, %n.vec320
br i1 %37, label %vec.epilog.middle.block312, label %vec.epilog.vector.body323, !llvm.loop !17
vec.epilog.middle.block312: ; preds = %vec.epilog.vector.body323
%cmp.n322 = icmp eq i64 %n.mod.vf319, 0
br i1 %cmp.n322, label %for.cond91.preheader, label %for.body75.us.1.preheader
for.body75.us.1.preheader: ; preds = %iter.check300, %vec.epilog.iter.check314, %vec.epilog.middle.block312
%indvars.iv269.1.ph = phi i64 [ 0, %iter.check300 ], [ %n.vec305, %vec.epilog.iter.check314 ], [ %n.vec320, %vec.epilog.middle.block312 ]
br label %for.body75.us.1
for.body75.us.1: ; preds = %for.body75.us.1.preheader, %for.body75.us.1
%indvars.iv269.1 = phi i64 [ %indvars.iv.next270.1, %for.body75.us.1 ], [ %indvars.iv269.1.ph, %for.body75.us.1.preheader ]
%arrayidx77.us.1 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv269.1
%38 = load i8, ptr %arrayidx77.us.1, align 1, !tbaa !5
%cmp79.us.1 = icmp eq i8 %38, 82
%conv81.us.1 = select i1 %cmp79.us.1, i8 76, i8 82
store i8 %conv81.us.1, ptr %arrayidx77.us.1, align 1, !tbaa !5
%indvars.iv.next270.1 = add nuw nsw i64 %indvars.iv269.1, 1
%exitcond273.1.not = icmp eq i64 %indvars.iv.next270.1, %wide.trip.count257
br i1 %exitcond273.1.not, label %for.cond91.preheader, label %for.body75.us.1, !llvm.loop !18
for.body75.us: ; preds = %for.body75.us.preheader, %for.body75.us
%indvars.iv269 = phi i64 [ %indvars.iv.next270, %for.body75.us ], [ %indvars.iv269.ph, %for.body75.us.preheader ]
%arrayidx77.us = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv269
%39 = load i8, ptr %arrayidx77.us, align 1, !tbaa !5
%cmp79.us = icmp eq i8 %39, 82
%conv81.us = select i1 %cmp79.us, i8 76, i8 82
store i8 %conv81.us, ptr %arrayidx77.us, align 1, !tbaa !5
%indvars.iv.next270 = add nuw nsw i64 %indvars.iv269, 1
%exitcond273.not = icmp eq i64 %indvars.iv.next270, %wide.trip.count257
br i1 %exitcond273.not, label %for.cond.cleanup74.us, label %for.body75.us, !llvm.loop !19
for.body51.us: ; preds = %for.body51.us, %for.body51.us.preheader.new
%indvars.iv264 = phi i64 [ 0, %for.body51.us.preheader.new ], [ %indvars.iv.next265.1343, %for.body51.us ]
%niter337 = phi i64 [ 0, %for.body51.us.preheader.new ], [ %niter337.next.1, %for.body51.us ]
%arrayidx54.us = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv264
%40 = load i32, ptr %arrayidx54.us, align 4, !tbaa !8
%41 = xor i64 %indvars.iv264, -1
%sub56.us = add i64 %call2, %41
%sext284 = shl i64 %sub56.us, 32
%idxprom57.us = ashr exact i64 %sext284, 32
%arrayidx58.us = getelementptr inbounds i32, ptr %call4, i64 %idxprom57.us
%42 = load i32, ptr %arrayidx58.us, align 4, !tbaa !8
store i32 %42, ptr %arrayidx54.us, align 4, !tbaa !8
store i32 %40, ptr %arrayidx58.us, align 4, !tbaa !8
%indvars.iv.next265 = or i64 %indvars.iv264, 1
%arrayidx54.us.1339 = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv.next265
%43 = load i32, ptr %arrayidx54.us.1339, align 4, !tbaa !8
%44 = xor i64 %indvars.iv264, 4294967294
%sub56.us.1340 = add i64 %call2, %44
%sext284.1 = shl i64 %sub56.us.1340, 32
%idxprom57.us.1341 = ashr exact i64 %sext284.1, 32
%arrayidx58.us.1342 = getelementptr inbounds i32, ptr %call4, i64 %idxprom57.us.1341
%45 = load i32, ptr %arrayidx58.us.1342, align 4, !tbaa !8
store i32 %45, ptr %arrayidx54.us.1339, align 4, !tbaa !8
store i32 %43, ptr %arrayidx58.us.1342, align 4, !tbaa !8
%indvars.iv.next265.1343 = add nuw nsw i64 %indvars.iv264, 2
%niter337.next.1 = add i64 %niter337, 2
%niter337.ncmp.1 = icmp eq i64 %niter337.next.1, %unroll_iter336
br i1 %niter337.ncmp.1, label %iter.check.loopexit.unr-lcssa, label %for.body51.us, !llvm.loop !13
for.body28.us: ; preds = %for.body28.us, %for.body28.us.preheader.new
%indvars.iv259 = phi i64 [ 0, %for.body28.us.preheader.new ], [ %indvars.iv.next260.1332, %for.body28.us ]
%niter = phi i64 [ 0, %for.body28.us.preheader.new ], [ %niter.next.1, %for.body28.us ]
%arrayidx30.us = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv259
%46 = load i8, ptr %arrayidx30.us, align 2, !tbaa !5
%47 = xor i64 %indvars.iv259, -1
%sub32.us = add i64 %call2, %47
%sext283 = shl i64 %sub32.us, 32
%idxprom33.us = ashr exact i64 %sext283, 32
%arrayidx34.us = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %idxprom33.us
%48 = load i8, ptr %arrayidx34.us, align 1, !tbaa !5
store i8 %48, ptr %arrayidx30.us, align 2, !tbaa !5
store i8 %46, ptr %arrayidx34.us, align 1, !tbaa !5
%indvars.iv.next260 = or i64 %indvars.iv259, 1
%arrayidx30.us.1328 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv.next260
%49 = load i8, ptr %arrayidx30.us.1328, align 1, !tbaa !5
%50 = xor i64 %indvars.iv259, 4294967294
%sub32.us.1329 = add i64 %call2, %50
%sext283.1 = shl i64 %sub32.us.1329, 32
%idxprom33.us.1330 = ashr exact i64 %sext283.1, 32
%arrayidx34.us.1331 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %idxprom33.us.1330
%51 = load i8, ptr %arrayidx34.us.1331, align 1, !tbaa !5
store i8 %51, ptr %arrayidx30.us.1328, align 1, !tbaa !5
store i8 %49, ptr %arrayidx34.us.1331, align 1, !tbaa !5
%indvars.iv.next260.1332 = add nuw nsw i64 %indvars.iv259, 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.cond46.preheader.us.unr-lcssa, label %for.body28.us, !llvm.loop !12
for.body10.us: ; preds = %for.cond6.preheader.us.preheader, %for.inc.us
%indvars.iv253 = phi i64 [ 0, %for.cond6.preheader.us.preheader ], [ %indvars.iv.next254, %for.inc.us ]
%count.0142.us = phi i32 [ 0, %for.cond6.preheader.us.preheader ], [ %count.1.us, %for.inc.us ]
%arrayidx.us = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv253
%52 = load i8, ptr %arrayidx.us, align 1, !tbaa !5
%cmp12.us = icmp eq i8 %52, 82
%inc.us = add nsw i32 %count.0142.us, 1
br i1 %cmp12.us, label %for.inc.us, label %if.else.us
if.else.us: ; preds = %for.body10.us
%53 = insertelement <2 x i32> poison, i32 %inc.us, i64 0
%54 = insertelement <2 x i32> %53, i32 %count.0142.us, i64 1
%55 = sdiv <2 x i32> %54, <i32 2, i32 2>
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv253
%56 = load <2 x i32>, ptr %gep, align 4, !tbaa !8
%57 = add nsw <2 x i32> %56, %55
store <2 x i32> %57, ptr %gep, align 4, !tbaa !8
br label %for.inc.us
for.inc.us: ; preds = %for.body10.us, %if.else.us
%count.1.us = phi i32 [ 0, %if.else.us ], [ %inc.us, %for.body10.us ]
%indvars.iv.next254 = add nuw nsw i64 %indvars.iv253, 1
%exitcond258.not = icmp eq i64 %indvars.iv.next254, %wide.trip.count257
br i1 %exitcond258.not, label %for.cond6.for.cond23.preheader_crit_edge.us, label %for.body10.us, !llvm.loop !10
iter.check.loopexit.unr-lcssa: ; preds = %for.body51.us, %for.body51.us.preheader
%indvars.iv264.unr = phi i64 [ 0, %for.body51.us.preheader ], [ %indvars.iv.next265.1343, %for.body51.us ]
%lcmp.mod335.not = icmp eq i64 %xtraiter334, 0
br i1 %lcmp.mod335.not, label %iter.check, label %for.body51.us.epil
for.body51.us.epil: ; preds = %iter.check.loopexit.unr-lcssa
%arrayidx54.us.epil = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv264.unr
%58 = load i32, ptr %arrayidx54.us.epil, align 4, !tbaa !8
%59 = xor i64 %indvars.iv264.unr, -1
%sub56.us.epil = add i64 %call2, %59
%sext284.epil = shl i64 %sub56.us.epil, 32
%idxprom57.us.epil = ashr exact i64 %sext284.epil, 32
%arrayidx58.us.epil = getelementptr inbounds i32, ptr %call4, i64 %idxprom57.us.epil
%60 = load i32, ptr %arrayidx58.us.epil, align 4, !tbaa !8
store i32 %60, ptr %arrayidx54.us.epil, align 4, !tbaa !8
store i32 %58, ptr %arrayidx58.us.epil, align 4, !tbaa !8
br label %iter.check
iter.check: ; preds = %for.body51.us.epil, %iter.check.loopexit.unr-lcssa, %for.cond6.for.cond23.preheader_crit_edge.us, %for.cond46.preheader.us
%min.iters.check = icmp ult i64 %wide.trip.count257, 8
br i1 %min.iters.check, label %for.body75.us.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %iter.check
%min.iters.check289 = icmp ult i64 %wide.trip.count257, 32
br i1 %min.iters.check289, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.mod.vf = and i64 %call2, 31
%n.vec = sub nsw i64 %wide.trip.count257, %n.mod.vf
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%61 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %index
%wide.load = load <16 x i8>, ptr %61, align 16, !tbaa !5
%62 = getelementptr inbounds i8, ptr %61, i64 16
%wide.load290 = load <16 x i8>, ptr %62, align 16, !tbaa !5
%63 = icmp eq <16 x i8> %wide.load, <i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82>
%64 = icmp eq <16 x i8> %wide.load290, <i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82>
%65 = select <16 x i1> %63, <16 x i8> <i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76>, <16 x i8> <i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82>
%66 = select <16 x i1> %64, <16 x i8> <i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76>, <16 x i8> <i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82>
store <16 x i8> %65, ptr %61, align 16, !tbaa !5
store <16 x i8> %66, ptr %62, align 16, !tbaa !5
%index.next = add nuw i64 %index, 32
%67 = icmp eq i64 %index.next, %n.vec
br i1 %67, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.mod.vf, 0
br i1 %cmp.n, label %for.cond.cleanup74.us, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%min.epilog.iters.check = icmp ult i64 %n.mod.vf, 8
br i1 %min.epilog.iters.check, label %for.body75.us.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
%n.mod.vf291 = and i64 %call2, 7
%n.vec292 = sub nsw i64 %wide.trip.count257, %n.mod.vf291
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index294 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next296, %vec.epilog.vector.body ]
%68 = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %index294
%wide.load295 = load <8 x i8>, ptr %68, align 1, !tbaa !5
%69 = icmp eq <8 x i8> %wide.load295, <i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82>
%70 = select <8 x i1> %69, <8 x i8> <i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76, i8 76>, <8 x i8> <i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82, i8 82>
store <8 x i8> %70, ptr %68, align 1, !tbaa !5
%index.next296 = add nuw i64 %index294, 8
%71 = icmp eq i64 %index.next296, %n.vec292
br i1 %71, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !21
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
%cmp.n293 = icmp eq i64 %n.mod.vf291, 0
br i1 %cmp.n293, label %for.cond.cleanup74.us, label %for.body75.us.preheader
for.body75.us.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv269.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec292, %vec.epilog.middle.block ]
br label %for.body75.us
for.cond46.preheader.us.unr-lcssa: ; preds = %for.body28.us, %for.body28.us.preheader
%indvars.iv259.unr = phi i64 [ 0, %for.body28.us.preheader ], [ %indvars.iv.next260.1332, %for.body28.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond46.preheader.us, label %for.body28.us.epil
for.body28.us.epil: ; preds = %for.cond46.preheader.us.unr-lcssa
%arrayidx30.us.epil = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %indvars.iv259.unr
%72 = load i8, ptr %arrayidx30.us.epil, align 1, !tbaa !5
%73 = xor i64 %indvars.iv259.unr, -1
%sub32.us.epil = add i64 %call2, %73
%sext283.epil = shl i64 %sub32.us.epil, 32
%idxprom33.us.epil = ashr exact i64 %sext283.epil, 32
%arrayidx34.us.epil = getelementptr inbounds [100001 x i8], ptr %s, i64 0, i64 %idxprom33.us.epil
%74 = load i8, ptr %arrayidx34.us.epil, align 1, !tbaa !5
store i8 %74, ptr %arrayidx30.us.epil, align 1, !tbaa !5
store i8 %72, ptr %arrayidx34.us.epil, align 1, !tbaa !5
br label %for.cond46.preheader.us
for.cond46.preheader.us: ; preds = %for.cond46.preheader.us.unr-lcssa, %for.body28.us.epil
br i1 %cmp25144, label %for.body51.us.preheader, label %iter.check
for.body51.us.preheader: ; preds = %for.cond46.preheader.us
%xtraiter334 = and i64 %wide.trip.count262, 1
%75 = icmp eq i64 %76, 0
br i1 %75, label %iter.check.loopexit.unr-lcssa, label %for.body51.us.preheader.new
for.body51.us.preheader.new: ; preds = %for.body51.us.preheader
%unroll_iter336 = and i64 %wide.trip.count262, 4294967294
br label %for.body51.us
for.cond6.for.cond23.preheader_crit_edge.us: ; preds = %for.inc.us
br i1 %cmp25144, label %for.body28.us.preheader, label %iter.check
for.body28.us.preheader: ; preds = %for.cond6.for.cond23.preheader_crit_edge.us
%wide.trip.count262 = zext i32 %div24 to i64
%76 = add nsw i64 %wide.trip.count262, -1
%xtraiter = and i64 %wide.trip.count262, 1
%77 = icmp eq i64 %76, 0
br i1 %77, label %for.cond46.preheader.us.unr-lcssa, label %for.body28.us.preheader.new
for.body28.us.preheader.new: ; preds = %for.body28.us.preheader
%unroll_iter = and i64 %wide.trip.count262, 4294967294
br label %for.body28.us
for.cond91.preheader: ; preds = %for.body75.us.1, %vec.epilog.middle.block312, %middle.block297
br i1 %cmp7141, label %for.body95.preheader, label %for.cond.cleanup94
for.body95.preheader: ; preds = %for.cond91.preheader
%wide.trip.count277 = and i64 %call2, 4294967295
br label %for.body95
for.cond.cleanup94: ; preds = %for.body95, %entry, %for.cond91.preheader
%78 = load ptr, ptr @stdout, align 8, !tbaa !22
%call.i = call i32 @putc(i32 noundef 10, ptr noundef %78)
call void @free(ptr noundef %call4) #6
call void @llvm.lifetime.end.p0(i64 100001, ptr nonnull %s) #6
ret i32 0
for.body95: ; preds = %for.body95.preheader, %for.body95
%indvars.iv274 = phi i64 [ 0, %for.body95.preheader ], [ %indvars.iv.next275, %for.body95 ]
%arrayidx97 = getelementptr inbounds i32, ptr %call4, i64 %indvars.iv274
%79 = load i32, ptr %arrayidx97, align 4, !tbaa !8
%call98 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %79)
%indvars.iv.next275 = add nuw nsw i64 %indvars.iv274, 1
%exitcond278.not = icmp eq i64 %indvars.iv.next275, %wide.trip.count277
br i1 %exitcond278.not, label %for.cond.cleanup94, label %for.body95, !llvm.loop !24
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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 nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree 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 #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { nounwind allocsize(0,1) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = 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, !15, !16}
!18 = distinct !{!18, !11, !16, !15}
!19 = distinct !{!19, !11, !16, !15}
!20 = distinct !{!20, !11, !15, !16}
!21 = distinct !{!21, !11, !15, !16}
!22 = !{!23, !23, i64 0}
!23 = !{!"any pointer", !6, i64 0}
!24 = distinct !{!24, !11}
|
#include <stdio.h>
#include <math.h>
double time (int a, int b, int x, int y, int v){
double xa = x - a;
double yb = y - b;
return sqrt(xa*xa + yb * yb)/v;
}
int main(){
int a, b, n, x, y, v, i;
double min = 2e31, t;
scanf("%d %d", &a, &b);
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%d %d %d", &x, &y, &v);
t = time(a, b, x, y, v);
if (t < min) min = t;
}
printf("%lf", min);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24929/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24929/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [9 x i8] c"%d %d %d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local double @time(i32 noundef %a, i32 noundef %b, i32 noundef %x, i32 noundef %y, i32 noundef %v) local_unnamed_addr #0 {
entry:
%sub = sub nsw i32 %x, %a
%conv = sitofp i32 %sub to double
%sub1 = sub nsw i32 %y, %b
%conv2 = sitofp i32 %sub1 to double
%mul3 = fmul double %conv2, %conv2
%0 = tail call double @llvm.fmuladd.f64(double %conv, double %conv, double %mul3)
%sqrt = tail call double @llvm.sqrt.f64(double %0)
%conv4 = sitofp i32 %v to double
%div = fdiv double %sqrt, %conv4
ret double %div
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%n = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #6
call 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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp9 = icmp sgt i32 %0, 0
br i1 %cmp9, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.011 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%min.010 = phi double [ %min.1, %for.body ], [ 2.000000e+31, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %v)
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%3 = load i32, ptr %x, align 4, !tbaa !5
%4 = load i32, ptr %y, align 4, !tbaa !5
%5 = load i32, ptr %v, align 4, !tbaa !5
%sub.i = sub nsw i32 %3, %1
%conv.i = sitofp i32 %sub.i to double
%sub1.i = sub nsw i32 %4, %2
%conv2.i = sitofp i32 %sub1.i to double
%mul3.i = fmul double %conv2.i, %conv2.i
%6 = call double @llvm.fmuladd.f64(double %conv.i, double %conv.i, double %mul3.i)
%sqrt.i = call double @llvm.sqrt.f64(double %6)
%conv4.i = sitofp i32 %5 to double
%div.i = fdiv double %sqrt.i, %conv4.i
%cmp4 = fcmp olt double %div.i, %min.010
%min.1 = select i1 %cmp4, double %div.i, double %min.010
%inc = add nuw nsw i32 %i.011, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%min.0.lcssa = phi double [ 2.000000e+31, %entry ], [ %min.1, %for.body ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %min.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #6
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
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #6
ret i32 0
}
; Function Attrs: 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 double @llvm.sqrt.f64(double) #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef struct{
double x, y, v;
double time;
}coordenadas;
int main(){
int i, aux;
double final, aux2, aux3, aux4, a, b;
coordenadas * indices;
scanf("%lf %lf", &a, &b);
scanf("%d", &aux);
indices =malloc(aux*sizeof(coordenadas));
for(i=0; i < aux;i++){
scanf("%lf %lf %lf", &indices[i].x, &indices[i].y, &indices[i].v);
}
final = (sqrt(pow((indices[0].x - a), 2) + pow((indices[0].y - b), 2)))/indices[0].v;
for(i=1; i < aux; i++){
aux2 = indices[i].x;
aux3 = indices[i].y;
aux4 = indices[i].v;
aux2 = (sqrt(pow((aux2 - a), 2) + pow((aux3 - b), 2))/aux4);
if(aux2 < final)
final = aux2;
}
printf("%.20lf\n", final);
free(indices);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_24934/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_24934/source.c"
target datalayout = "e-m:e-p270: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.coordenadas = type { double, double, double, double }
@.str = private unnamed_addr constant [8 x i8] c"%lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [12 x i8] c"%lf %lf %lf\00", align 1
@.str.3 = private unnamed_addr constant [8 x i8] c"%.20lf\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%aux = alloca i32, align 4
%a = alloca double, align 8
%b = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %aux) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %aux)
%0 = load i32, ptr %aux, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 5
%call2 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp70 = icmp sgt i32 %0, 0
br i1 %cmp70, 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 %struct.coordenadas, ptr %call2, i64 %indvars.iv
%y = getelementptr inbounds %struct.coordenadas, ptr %call2, i64 %indvars.iv, i32 1
%v = getelementptr inbounds %struct.coordenadas, ptr %call2, i64 %indvars.iv, i32 2
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef %arrayidx, ptr noundef nonnull %y, ptr noundef nonnull %v)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %aux, 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 = load <2 x double>, ptr %call2, align 8, !tbaa !11
%v18.phi.trans.insert = getelementptr inbounds %struct.coordenadas, ptr %call2, i64 0, i32 2
%.pre80 = load double, ptr %v18.phi.trans.insert, align 8, !tbaa !13
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%4 = phi i32 [ %1, %for.end.loopexit ], [ %0, %entry ]
%5 = phi double [ %.pre80, %for.end.loopexit ], [ undef, %entry ]
%6 = phi <2 x double> [ %3, %for.end.loopexit ], [ undef, %entry ]
%7 = load double, ptr %a, align 8, !tbaa !11
%8 = load double, ptr %b, align 8, !tbaa !11
%9 = insertelement <2 x double> poison, double %7, i64 0
%10 = insertelement <2 x double> %9, double %8, i64 1
%11 = fsub <2 x double> %6, %10
%12 = fmul <2 x double> %11, %11
%shift = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%13 = fadd <2 x double> %12, %shift
%add = extractelement <2 x double> %13, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add)
%div = fdiv double %sqrt, %5
%cmp2072 = icmp sgt i32 %4, 1
br i1 %cmp2072, label %for.body22.lr.ph, label %for.end43
for.body22.lr.ph: ; preds = %for.end
%wide.trip.count = zext i32 %4 to i64
br label %for.body22
for.body22: ; preds = %for.body22.lr.ph, %for.body22
%indvars.iv76 = phi i64 [ 1, %for.body22.lr.ph ], [ %indvars.iv.next77, %for.body22 ]
%final.073 = phi double [ %div, %for.body22.lr.ph ], [ %final.1, %for.body22 ]
%arrayidx24 = getelementptr inbounds %struct.coordenadas, ptr %call2, i64 %indvars.iv76
%v31 = getelementptr inbounds %struct.coordenadas, ptr %call2, i64 %indvars.iv76, i32 2
%14 = load double, ptr %v31, align 8, !tbaa !13
%15 = load <2 x double>, ptr %arrayidx24, align 8, !tbaa !11
%16 = fsub <2 x double> %15, %10
%17 = fmul <2 x double> %16, %16
%shift81 = shufflevector <2 x double> %17, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%18 = fadd <2 x double> %17, %shift81
%add36 = extractelement <2 x double> %18, i64 0
%sqrt69 = call double @llvm.sqrt.f64(double %add36)
%div38 = fdiv double %sqrt69, %14
%cmp39 = fcmp olt double %div38, %final.073
%final.1 = select i1 %cmp39, double %div38, double %final.073
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%exitcond.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count
br i1 %exitcond.not, label %for.end43, label %for.body22, !llvm.loop !15
for.end43: ; preds = %for.body22, %for.end
%final.0.lcssa = phi double [ %div, %for.end ], [ %final.1, %for.body22 ]
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %final.0.lcssa)
call void @free(ptr noundef nonnull %call2) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %aux) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #5
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !12, i64 16}
!14 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#include <string.h>
#define LEN_MAX 80
#define LEN_MAX1 (LEN_MAX+1)
#define NMAX 20
void remove_feed(char *text);
void decode(char *input,char *output);
char shift(char in);
int check_decoded(char *text);
int main(){
int n=0;
char input[LEN_MAX1], output[LEN_MAX1];
while(fgets(input,sizeof(input),stdin)!=NULL){
if(strlen(input)<=1) break;
remove_feed(input);
if(n>=NMAX) break;
decode(input,output);
printf("%s\n",output);
++n;
}
return 0;
}
void remove_feed(char *text){
int i;
for(i=0;i<strlen(text);i++){
if(text[i]=='\n'){ text[i]='\0'; break; }
}
}
void decode(char *input,char *output){
int i, j, k, len;
len=strlen(input);
for(i=0;i<26;i++){
strcpy(output,input);
for(j=0;j<len;j++){
if(output[j]==' '||output[j]=='.') continue;
for(k=0;k<i;k++) output[j]=shift(output[j]);
}
if(check_decoded(output)==1) break;
}
}
char shift(char in){
if(in=='z') return 'a';
return (in+1);
}
#define NKEY 3
int check_decoded(char *text){
int i, j, flag;
char key[NKEY][5] = { "the", "this", "that" };
char comp[10];
for(i=0;i<NKEY;i++){
if(strcmp(text,key[i])==0) goto decoded;
sprintf(comp," %s ",key[i]);
if(strstr(text,comp)!=NULL) goto decoded;
sprintf(comp," %s.",key[i]);
if(strstr(text,comp)!=NULL) goto decoded;
for(j=0,flag=1;j<strlen(key[i]);j++){
if(key[i][j]!=text[j]){ flag=0; break; }
}
if(flag==1&&(text[strlen(key[i])]=='.'||text[strlen(key[i])]==' ')) goto decoded;
}
return 0;
decoded:
return 1;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249398/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249398/source.c"
target datalayout = "e-m:e-p270: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
@__const.check_decoded.key = private unnamed_addr constant [3 x [5 x i8]] [[5 x i8] c"the\00\00", [5 x i8] c"this\00", [5 x i8] c"that\00"], align 1
@.str.1 = private unnamed_addr constant [5 x i8] c" %s \00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c" %s.\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%input = alloca [81 x i8], align 16
%output = alloca [81 x i8], align 16
call void @llvm.lifetime.start.p0(i64 81, ptr nonnull %input) #9
call void @llvm.lifetime.start.p0(i64 81, ptr nonnull %output) #9
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call14 = call ptr @fgets(ptr noundef nonnull %input, i32 noundef 81, ptr noundef %0)
%cmp.not15 = icmp eq ptr %call14, null
br i1 %cmp.not15, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end7
%n.016 = phi i32 [ %inc, %if.end7 ], [ 0, %entry ]
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %input) #10
%cmp3 = icmp ult i64 %call2, 2
br i1 %cmp3, label %while.end, label %for.body.i
for.cond.i: ; preds = %for.body.i
%indvars.iv.next.i = add nuw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %call2
br i1 %exitcond.not.i, label %remove_feed.exit, label %for.body.i, !llvm.loop !9
for.body.i: ; preds = %while.body, %for.cond.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.cond.i ], [ 0, %while.body ]
%arrayidx.i = getelementptr inbounds i8, ptr %input, i64 %indvars.iv.i
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !11
%cmp3.i = icmp eq i8 %1, 10
br i1 %cmp3.i, label %if.then.i, label %for.cond.i
if.then.i: ; preds = %for.body.i
%arrayidx.i.le = getelementptr inbounds i8, ptr %input, i64 %indvars.iv.i
store i8 0, ptr %arrayidx.i.le, align 1, !tbaa !11
br label %remove_feed.exit
remove_feed.exit: ; preds = %for.cond.i, %if.then.i
%exitcond = icmp eq i32 %n.016, 20
br i1 %exitcond, label %while.end, label %if.end7
if.end7: ; preds = %remove_feed.exit
call void @decode(ptr noundef nonnull %input, ptr noundef nonnull %output)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %output)
%inc = add nuw nsw i32 %n.016, 1
%2 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %input, i32 noundef 81, ptr noundef %2)
%cmp.not = icmp eq ptr %call, null
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %if.end7, %while.body, %remove_feed.exit, %entry
call void @llvm.lifetime.end.p0(i64 81, ptr nonnull %output) #9
call void @llvm.lifetime.end.p0(i64 81, ptr nonnull %input) #9
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(argmem: readwrite) uwtable
define dso_local void @remove_feed(ptr nocapture noundef %text) local_unnamed_addr #4 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %text) #10
%cmp12.not = icmp eq i64 %call, 0
br i1 %cmp12.not, label %for.end, label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %call
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !9
for.body: ; preds = %entry, %for.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i8, ptr %text, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !11
%cmp3 = icmp eq i8 %0, 10
br i1 %cmp3, label %if.then, label %for.cond
if.then: ; preds = %for.body
%arrayidx.le = getelementptr inbounds i8, ptr %text, i64 %indvars.iv
store i8 0, ptr %arrayidx.le, align 1, !tbaa !11
br label %for.end
for.end: ; preds = %for.cond, %entry, %if.then
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @decode(ptr nocapture noundef readonly %input, ptr noundef %output) local_unnamed_addr #0 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %input) #10
%conv = trunc i64 %call to i32
%cmp452 = icmp sgt i32 %conv, 0
br i1 %cmp452, label %for.body.us.preheader, label %for.body
for.body.us.preheader: ; preds = %entry
%wide.trip.count = and i64 %call, 4294967295
br label %for.body.us
for.body.us: ; preds = %for.body.us.preheader, %for.cond3.for.end26_crit_edge.us
%i.054.us = phi i32 [ %inc33.us, %for.cond3.for.end26_crit_edge.us ], [ 0, %for.body.us.preheader ]
%call2.us = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %output, ptr noundef nonnull dereferenceable(1) %input) #9
%cmp1649.us.not = icmp eq i32 %i.054.us, 0
br i1 %cmp1649.us.not, label %for.cond3.for.end26_crit_edge.us, label %for.body6.us.us.preheader
for.body6.us.us.preheader: ; preds = %for.body.us
%xtraiter = and i32 %i.054.us, 3
%0 = icmp ult i32 %i.054.us, 4
%unroll_iter = and i32 %i.054.us, 2147483644
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br label %for.body6.us.us
for.cond3.for.end26_crit_edge.us: ; preds = %for.inc24.us.us, %for.body.us
%call27.us = tail call i32 @check_decoded(ptr noundef %output), !range !13
%cmp28.not.us = icmp eq i32 %call27.us, 0
%inc33.us = add nuw nsw i32 %i.054.us, 1
%cmp.us = icmp ult i32 %i.054.us, 25
%or.cond = and i1 %cmp28.not.us, %cmp.us
br i1 %or.cond, label %for.body.us, label %for.end34, !llvm.loop !14
for.body6.us.us: ; preds = %for.body6.us.us.preheader, %for.inc24.us.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc24.us.us ], [ 0, %for.body6.us.us.preheader ]
%arrayidx.us.us = getelementptr inbounds i8, ptr %output, i64 %indvars.iv
%1 = load i8, ptr %arrayidx.us.us, align 1, !tbaa !11
switch i8 %1, label %for.body18.us.us.preheader [
i8 32, label %for.inc24.us.us
i8 46, label %for.inc24.us.us
]
for.body18.us.us.preheader: ; preds = %for.body6.us.us
br i1 %0, label %for.cond15.for.inc24.loopexit_crit_edge.us.us.unr-lcssa, label %for.body18.us.us
for.inc24.us.us: ; preds = %for.cond15.for.inc24.loopexit_crit_edge.us.us, %for.body6.us.us, %for.body6.us.us
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond70.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond70.not, label %for.cond3.for.end26_crit_edge.us, label %for.body6.us.us, !llvm.loop !15
for.body18.us.us: ; preds = %for.body18.us.us.preheader, %for.body18.us.us
%retval.0.i51.us.us = phi i8 [ %retval.0.i.us.us.3, %for.body18.us.us ], [ %1, %for.body18.us.us.preheader ]
%niter = phi i32 [ %niter.next.3, %for.body18.us.us ], [ 0, %for.body18.us.us.preheader ]
%cmp.i.us.us = icmp eq i8 %retval.0.i51.us.us, 122
%add.i.us.us = add i8 %retval.0.i51.us.us, 1
%retval.0.i.us.us = select i1 %cmp.i.us.us, i8 97, i8 %add.i.us.us
%cmp.i.us.us.1 = icmp eq i8 %retval.0.i.us.us, 122
%add.i.us.us.1 = add i8 %retval.0.i.us.us, 1
%retval.0.i.us.us.1 = select i1 %cmp.i.us.us.1, i8 97, i8 %add.i.us.us.1
%cmp.i.us.us.2 = icmp eq i8 %retval.0.i.us.us.1, 122
%add.i.us.us.2 = add i8 %retval.0.i.us.us.1, 1
%retval.0.i.us.us.2 = select i1 %cmp.i.us.us.2, i8 97, i8 %add.i.us.us.2
%cmp.i.us.us.3 = icmp eq i8 %retval.0.i.us.us.2, 122
%add.i.us.us.3 = add i8 %retval.0.i.us.us.2, 1
%retval.0.i.us.us.3 = select i1 %cmp.i.us.us.3, i8 97, i8 %add.i.us.us.3
%niter.next.3 = add i32 %niter, 4
%niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond15.for.inc24.loopexit_crit_edge.us.us.unr-lcssa, label %for.body18.us.us, !llvm.loop !16
for.cond15.for.inc24.loopexit_crit_edge.us.us.unr-lcssa: ; preds = %for.body18.us.us, %for.body18.us.us.preheader
%retval.0.i.us.us.lcssa.ph = phi i8 [ undef, %for.body18.us.us.preheader ], [ %retval.0.i.us.us.3, %for.body18.us.us ]
%retval.0.i51.us.us.unr = phi i8 [ %1, %for.body18.us.us.preheader ], [ %retval.0.i.us.us.3, %for.body18.us.us ]
br i1 %lcmp.mod.not, label %for.cond15.for.inc24.loopexit_crit_edge.us.us, label %for.body18.us.us.epil
for.body18.us.us.epil: ; preds = %for.cond15.for.inc24.loopexit_crit_edge.us.us.unr-lcssa, %for.body18.us.us.epil
%retval.0.i51.us.us.epil = phi i8 [ %retval.0.i.us.us.epil, %for.body18.us.us.epil ], [ %retval.0.i51.us.us.unr, %for.cond15.for.inc24.loopexit_crit_edge.us.us.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body18.us.us.epil ], [ 0, %for.cond15.for.inc24.loopexit_crit_edge.us.us.unr-lcssa ]
%cmp.i.us.us.epil = icmp eq i8 %retval.0.i51.us.us.epil, 122
%add.i.us.us.epil = add i8 %retval.0.i51.us.us.epil, 1
%retval.0.i.us.us.epil = select i1 %cmp.i.us.us.epil, i8 97, i8 %add.i.us.us.epil
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond15.for.inc24.loopexit_crit_edge.us.us, label %for.body18.us.us.epil, !llvm.loop !17
for.cond15.for.inc24.loopexit_crit_edge.us.us: ; preds = %for.body18.us.us.epil, %for.cond15.for.inc24.loopexit_crit_edge.us.us.unr-lcssa
%retval.0.i.us.us.lcssa = phi i8 [ %retval.0.i.us.us.lcssa.ph, %for.cond15.for.inc24.loopexit_crit_edge.us.us.unr-lcssa ], [ %retval.0.i.us.us.epil, %for.body18.us.us.epil ]
store i8 %retval.0.i.us.us.lcssa, ptr %arrayidx.us.us, align 1, !tbaa !11
br label %for.inc24.us.us
for.body: ; preds = %entry, %for.body
%i.054 = phi i32 [ %inc33, %for.body ], [ 0, %entry ]
%call2 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %output, ptr noundef nonnull dereferenceable(1) %input) #9
%call27 = tail call i32 @check_decoded(ptr noundef %output), !range !13
%cmp28.not = icmp eq i32 %call27, 0
%inc33 = add nuw nsw i32 %i.054, 1
%cmp = icmp ult i32 %i.054, 25
%or.cond66 = select i1 %cmp28.not, i1 %cmp, i1 false
br i1 %or.cond66, label %for.body, label %for.end34, !llvm.loop !14
for.end34: ; preds = %for.body, %for.cond3.for.end26_crit_edge.us
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local signext i8 @shift(i8 noundef signext %in) local_unnamed_addr #6 {
entry:
%cmp = icmp eq i8 %in, 122
%add = add i8 %in, 1
%retval.0 = select i1 %cmp, i8 97, i8 %add
ret i8 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @check_decoded(ptr noundef readonly %text) local_unnamed_addr #0 {
entry:
%key = alloca [3 x [5 x i8]], align 1
%comp = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 15, ptr nonnull %key) #9
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(15) %key, ptr noundef nonnull align 1 dereferenceable(15) @__const.check_decoded.key, i64 15, i1 false)
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %comp) #9
%call = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %text, ptr noundef nonnull dereferenceable(1) %key) #10
%cmp1 = icmp eq i32 %call, 0
br i1 %cmp1, label %cleanup, label %if.end
if.end: ; preds = %entry
%call6 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %comp, ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %key) #9
%call8 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %text, ptr noundef nonnull dereferenceable(1) %comp) #10
%cmp9.not = icmp eq ptr %call8, null
br i1 %cmp9.not, label %if.end11, label %cleanup
if.end11: ; preds = %if.end
%call16 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %comp, ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %key) #9
%call18 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %text, ptr noundef nonnull dereferenceable(1) %comp) #10
%cmp19.not = icmp eq ptr %call18, null
br i1 %cmp19.not, label %for.cond22.preheader, label %cleanup
for.cond22.preheader: ; preds = %if.end11
%call26 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %key) #10
%cmp27.not86.not = icmp eq i64 %call26, 0
br i1 %cmp27.not86.not, label %land.lhs.true, label %for.body29
for.cond22: ; preds = %for.body29
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %call26
br i1 %exitcond.not, label %land.lhs.true, label %for.body29, !llvm.loop !19
for.body29: ; preds = %for.cond22.preheader, %for.cond22
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond22 ], [ 0, %for.cond22.preheader ]
%arrayidx33 = getelementptr inbounds [3 x [5 x i8]], ptr %key, i64 0, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx33, align 1, !tbaa !11
%arrayidx36 = getelementptr inbounds i8, ptr %text, i64 %indvars.iv
%1 = load i8, ptr %arrayidx36, align 1, !tbaa !11
%cmp38.not = icmp eq i8 %0, %1
br i1 %cmp38.not, label %for.cond22, label %for.inc62
land.lhs.true: ; preds = %for.cond22, %for.cond22.preheader
%arrayidx48 = getelementptr inbounds i8, ptr %text, i64 %call26
%2 = load i8, ptr %arrayidx48, align 1, !tbaa !11
switch i8 %2, label %for.inc62 [
i8 46, label %cleanup
i8 32, label %cleanup
]
for.inc62: ; preds = %for.body29, %land.lhs.true
%arrayidx.1 = getelementptr inbounds [3 x [5 x i8]], ptr %key, i64 0, i64 1
%call.1 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %text, ptr noundef nonnull dereferenceable(1) %arrayidx.1) #10
%cmp1.1 = icmp eq i32 %call.1, 0
br i1 %cmp1.1, label %cleanup, label %if.end.1
if.end.1: ; preds = %for.inc62
%call6.1 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %comp, ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %arrayidx.1) #9
%call8.1 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %text, ptr noundef nonnull dereferenceable(1) %comp) #10
%cmp9.not.1 = icmp eq ptr %call8.1, null
br i1 %cmp9.not.1, label %if.end11.1, label %cleanup
if.end11.1: ; preds = %if.end.1
%call16.1 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %comp, ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %arrayidx.1) #9
%call18.1 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %text, ptr noundef nonnull dereferenceable(1) %comp) #10
%cmp19.not.1 = icmp eq ptr %call18.1, null
br i1 %cmp19.not.1, label %for.cond22.preheader.1, label %cleanup
for.cond22.preheader.1: ; preds = %if.end11.1
%call26.1 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %arrayidx.1) #10
%cmp27.not86.not.1 = icmp eq i64 %call26.1, 0
br i1 %cmp27.not86.not.1, label %land.lhs.true.1, label %for.body29.1
for.body29.1: ; preds = %for.cond22.preheader.1, %for.cond22.1
%indvars.iv.1 = phi i64 [ %indvars.iv.next.1, %for.cond22.1 ], [ 0, %for.cond22.preheader.1 ]
%arrayidx33.1 = getelementptr inbounds [3 x [5 x i8]], ptr %key, i64 0, i64 1, i64 %indvars.iv.1
%3 = load i8, ptr %arrayidx33.1, align 1, !tbaa !11
%arrayidx36.1 = getelementptr inbounds i8, ptr %text, i64 %indvars.iv.1
%4 = load i8, ptr %arrayidx36.1, align 1, !tbaa !11
%cmp38.not.1 = icmp eq i8 %3, %4
br i1 %cmp38.not.1, label %for.cond22.1, label %for.inc62.1
for.cond22.1: ; preds = %for.body29.1
%indvars.iv.next.1 = add nuw i64 %indvars.iv.1, 1
%exitcond.1.not = icmp eq i64 %indvars.iv.next.1, %call26.1
br i1 %exitcond.1.not, label %land.lhs.true.1, label %for.body29.1, !llvm.loop !19
land.lhs.true.1: ; preds = %for.cond22.1, %for.cond22.preheader.1
%arrayidx48.1 = getelementptr inbounds i8, ptr %text, i64 %call26.1
%5 = load i8, ptr %arrayidx48.1, align 1, !tbaa !11
switch i8 %5, label %for.inc62.1 [
i8 46, label %cleanup
i8 32, label %cleanup
]
for.inc62.1: ; preds = %for.body29.1, %land.lhs.true.1
%arrayidx.2 = getelementptr inbounds [3 x [5 x i8]], ptr %key, i64 0, i64 2
%call.2 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %text, ptr noundef nonnull dereferenceable(1) %arrayidx.2) #10
%cmp1.2 = icmp eq i32 %call.2, 0
br i1 %cmp1.2, label %cleanup, label %if.end.2
if.end.2: ; preds = %for.inc62.1
%call6.2 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %comp, ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %arrayidx.2) #9
%call8.2 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %text, ptr noundef nonnull dereferenceable(1) %comp) #10
%cmp9.not.2 = icmp eq ptr %call8.2, null
br i1 %cmp9.not.2, label %if.end11.2, label %cleanup
if.end11.2: ; preds = %if.end.2
%call16.2 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %comp, ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %arrayidx.2) #9
%call18.2 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %text, ptr noundef nonnull dereferenceable(1) %comp) #10
%cmp19.not.2 = icmp eq ptr %call18.2, null
br i1 %cmp19.not.2, label %for.cond22.preheader.2, label %cleanup
for.cond22.preheader.2: ; preds = %if.end11.2
%call26.2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %arrayidx.2) #10
%cmp27.not86.not.2 = icmp eq i64 %call26.2, 0
br i1 %cmp27.not86.not.2, label %land.lhs.true.2, label %for.body29.2
for.body29.2: ; preds = %for.cond22.preheader.2, %for.cond22.2
%indvars.iv.2 = phi i64 [ %indvars.iv.next.2, %for.cond22.2 ], [ 0, %for.cond22.preheader.2 ]
%arrayidx33.2 = getelementptr inbounds [3 x [5 x i8]], ptr %key, i64 0, i64 2, i64 %indvars.iv.2
%6 = load i8, ptr %arrayidx33.2, align 1, !tbaa !11
%arrayidx36.2 = getelementptr inbounds i8, ptr %text, i64 %indvars.iv.2
%7 = load i8, ptr %arrayidx36.2, align 1, !tbaa !11
%cmp38.not.2 = icmp eq i8 %6, %7
br i1 %cmp38.not.2, label %for.cond22.2, label %cleanup
for.cond22.2: ; preds = %for.body29.2
%indvars.iv.next.2 = add nuw i64 %indvars.iv.2, 1
%exitcond.2.not = icmp eq i64 %indvars.iv.next.2, %call26.2
br i1 %exitcond.2.not, label %land.lhs.true.2, label %for.body29.2, !llvm.loop !19
land.lhs.true.2: ; preds = %for.cond22.2, %for.cond22.preheader.2
%arrayidx48.2 = getelementptr inbounds i8, ptr %text, i64 %call26.2
%8 = load i8, ptr %arrayidx48.2, align 1, !tbaa !11
%switch.selectcmp.case1 = icmp eq i8 %8, 46
%switch.selectcmp.case2 = icmp eq i8 %8, 32
%switch.selectcmp = or i1 %switch.selectcmp.case1, %switch.selectcmp.case2
%9 = zext i1 %switch.selectcmp to i32
br label %cleanup
cleanup: ; preds = %for.body29.2, %land.lhs.true.2, %if.end11.2, %if.end.2, %for.inc62.1, %land.lhs.true.1, %land.lhs.true.1, %if.end11.1, %if.end.1, %for.inc62, %entry, %if.end, %if.end11, %land.lhs.true, %land.lhs.true
%retval.0 = phi i32 [ 1, %land.lhs.true ], [ 1, %land.lhs.true ], [ 1, %if.end11 ], [ 1, %if.end ], [ 1, %entry ], [ 1, %for.inc62 ], [ 1, %if.end.1 ], [ 1, %if.end11.1 ], [ 1, %land.lhs.true.1 ], [ 1, %land.lhs.true.1 ], [ 1, %for.inc62.1 ], [ 1, %if.end.2 ], [ 1, %if.end11.2 ], [ %9, %land.lhs.true.2 ], [ 0, %for.body29.2 ]
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %comp) #9
call void @llvm.lifetime.end.p0(i64 15, ptr nonnull %key) #9
ret i32 %retval.0
}
; 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) #7
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture 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: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @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 = { nofree nounwind "no-trapping-math"="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 memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree 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 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 #7 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nofree nounwind }
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 = !{!"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}
!13 = !{i32 0, i32 2}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 80
int main()
{
int i,j=97;
char str[MAX];
char str1[MAX];
char arr[26];
for (i = 0; i < 26; i++)
{
arr[i] = j;
++j;
}
i = 1;
while (fgets(str1,81,stdin)!=NULL)
{
//printf("%s",str);
//printf("%s",str1);
while (1)
{
int j = 0;
strcpy(str, str1);
int len = strlen(str);
while (len)
{
if (str[j] >= 'a'&&str[j] <= 'z')
{
str[j] = arr[(str[j]-'a'+i)%26];
}
++j;
--len;
}
if (strstr(str, "the") || strstr(str, "this") || strstr(str, "that"))
{
break;
}
++i;
}
printf("%s",str);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249534/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249534/source.c"
target datalayout = "e-m:e-p270: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 [4 x i8] c"the\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"this\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"that\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [80 x i8], align 16
%str1 = alloca [80 x i8], align 16
%arr = alloca [26 x i8], align 16
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %str) #5
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %str1) #5
call void @llvm.lifetime.start.p0(i64 26, ptr nonnull %arr) #5
store <16 x i8> <i8 97, i8 98, i8 99, i8 100, i8 101, i8 102, i8 103, i8 104, i8 105, i8 106, i8 107, i8 108, i8 109, i8 110, i8 111, i8 112>, ptr %arr, align 16, !tbaa !5
%arrayidx.16 = getelementptr inbounds [26 x i8], ptr %arr, i64 0, i64 16
store <8 x i8> <i8 113, i8 114, i8 115, i8 116, i8 117, i8 118, i8 119, i8 120>, ptr %arrayidx.16, align 16, !tbaa !5
%arrayidx.24 = getelementptr inbounds [26 x i8], ptr %arr, i64 0, i64 24
store i8 121, ptr %arrayidx.24, align 8, !tbaa !5
%arrayidx.25 = getelementptr inbounds [26 x i8], ptr %arr, i64 0, i64 25
store i8 122, ptr %arrayidx.25, align 1, !tbaa !5
%0 = load ptr, ptr @stdin, align 8, !tbaa !8
%call76 = call ptr @fgets(ptr noundef nonnull %str1, i32 noundef 81, ptr noundef %0)
%cmp2.not77 = icmp eq ptr %call76, null
br i1 %cmp2.not77, label %while.end50, label %while.cond4.outer
while.cond4.outer.loopexit: ; preds = %lor.lhs.false39
%inc45 = add nuw nsw i32 %i.2.ph, 1
br label %while.cond4.outer
while.cond4.outer: ; preds = %entry, %while.cond4.outer.loopexit
%i.2.ph = phi i32 [ %inc45, %while.cond4.outer.loopexit ], [ 1, %entry ]
%sub = add i32 %i.2.ph, -97
br label %while.cond4
while.cond4: ; preds = %while.cond4.outer, %while.end47
%call9 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) %str1) #5
%call11 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #6
%conv12 = trunc i64 %call11 to i32
%tobool.not73 = icmp eq i32 %conv12, 0
br i1 %tobool.not73, label %while.end, label %while.body14
while.body14: ; preds = %while.cond4, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %while.cond4 ]
%len.075 = phi i32 [ %dec, %if.end ], [ %conv12, %while.cond4 ]
%arrayidx16 = getelementptr inbounds [80 x i8], ptr %str, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx16, align 1, !tbaa !5
%2 = add i8 %1, -97
%or.cond = icmp ult i8 %2, 26
br i1 %or.cond, label %if.then, label %if.end
if.then: ; preds = %while.body14
%conv17 = zext i8 %1 to i32
%add = add i32 %sub, %conv17
%rem = srem i32 %add, 26
%idxprom28 = sext i32 %rem to i64
%arrayidx29 = getelementptr inbounds [26 x i8], ptr %arr, i64 0, i64 %idxprom28
%3 = load i8, ptr %arrayidx29, align 1, !tbaa !5
store i8 %3, ptr %arrayidx16, align 1, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %while.body14
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%dec = add nsw i32 %len.075, -1
%tobool.not = icmp eq i32 %dec, 0
br i1 %tobool.not, label %while.end, label %while.body14, !llvm.loop !10
while.end: ; preds = %if.end, %while.cond4
%call34 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str) #6
%tobool35.not = icmp eq ptr %call34, null
br i1 %tobool35.not, label %lor.lhs.false, label %while.end47
lor.lhs.false: ; preds = %while.end
%call37 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str.1) #6
%tobool38.not = icmp eq ptr %call37, null
br i1 %tobool38.not, label %lor.lhs.false39, label %while.end47
lor.lhs.false39: ; preds = %lor.lhs.false
%call41 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @.str.2) #6
%tobool42.not = icmp eq ptr %call41, null
br i1 %tobool42.not, label %while.cond4.outer.loopexit, label %while.end47
while.end47: ; preds = %lor.lhs.false, %while.end, %lor.lhs.false39
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %str)
%4 = load ptr, ptr @stdin, align 8, !tbaa !8
%call = call ptr @fgets(ptr noundef nonnull %str1, i32 noundef 81, ptr noundef %4)
%cmp2.not = icmp eq ptr %call, null
br i1 %cmp2.not, label %while.end50, label %while.cond4, !llvm.loop !12
while.end50: ; preds = %while.end47, %entry
call void @llvm.lifetime.end.p0(i64 26, ptr nonnull %arr) #5
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %str1) #5
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %str) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; 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 #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree 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 #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
typedef struct element_{
int h, p, q;
} element;
void elem_copy(element* src, element* dst) {
src->h = dst->h;
src->p = dst->p;
src->q = dst->q;
}
int main(void) {
int n, m, a, i, j;
int line[105];
element elem[1001];
element e;
int t;
while(scanf("%d %d %d\n", &n, &m, &a)==3) {
if(n==0 && m==0 && a==0) break;
for(i=0;i<=100;i++) line[i] = i;
for(i=0;i<m;i++) {
scanf("%d %d %d\n", &(elem[i].h), &(elem[i].p), &(elem[i].q));
}
for(i=0;i<m-1;i++) {
for(j=i+1;j<m;j++) {
if(elem[i].h < elem[j].h) {
elem_copy(&e, &elem[i]);
elem_copy(&elem[i], &elem[j]);
elem_copy(&elem[j], &e);
}
}
}
for(i=0;i<m;i++) {
t = line[elem[i].p];
line[elem[i].p] = line[elem[i].q];
line[elem[i].q] = t;
}
for(i=0;i<=n;i++) {
if(line[i] == a) {
printf("%d\n", i);
break;
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249578/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249578/source.c"
target datalayout = "e-m:e-p270: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.element_ = type { i32, i32, i32 }
@.str = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @elem_copy(ptr nocapture noundef writeonly %src, ptr nocapture noundef readonly %dst) local_unnamed_addr #0 {
entry:
%0 = load <2 x i32>, ptr %dst, align 4, !tbaa !5
store <2 x i32> %0, ptr %src, align 4, !tbaa !5
%q = getelementptr inbounds %struct.element_, ptr %dst, i64 0, i32 2
%1 = load i32, ptr %q, align 4, !tbaa !9
%q3 = getelementptr inbounds %struct.element_, ptr %src, i64 0, i32 2
store i32 %1, ptr %q3, align 4, !tbaa !9
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca i32, align 4
%line = alloca [105 x i32], align 16
%elem = alloca [1001 x %struct.element_], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 420, ptr nonnull %line) #4
call void @llvm.lifetime.start.p0(i64 12012, ptr nonnull %elem) #4
%call135 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %a)
%cmp136 = icmp eq i32 %call135, 3
br i1 %cmp136, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %entry
%0 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 4
%1 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 8
%2 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 12
%3 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 16
%4 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 20
%5 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 24
%6 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 28
%7 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 32
%8 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 36
%9 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 40
%10 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 44
%11 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 48
%12 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 52
%13 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 56
%14 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 60
%15 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 64
%16 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 68
%17 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 72
%18 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 76
%19 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 80
%20 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 84
%21 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 88
%22 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 92
%23 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 96
%arrayidx = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 100
br label %while.body
while.body: ; preds = %while.body.preheader, %for.end85
%24 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp eq i32 %24, 0
%25 = load i32, ptr %m, align 4
%cmp2 = icmp eq i32 %25, 0
%or.cond = select i1 %cmp1, i1 %cmp2, i1 false
%26 = load i32, ptr %a, align 4
%cmp4 = icmp eq i32 %26, 0
%or.cond86 = select i1 %or.cond, i1 %cmp4, i1 false
br i1 %or.cond86, label %while.end, label %vector.body
vector.body: ; preds = %while.body
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, ptr %line, align 16, !tbaa !5
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, ptr %0, align 16, !tbaa !5
store <4 x i32> <i32 8, i32 9, i32 10, i32 11>, ptr %1, align 16, !tbaa !5
store <4 x i32> <i32 12, i32 13, i32 14, i32 15>, ptr %2, align 16, !tbaa !5
store <4 x i32> <i32 16, i32 17, i32 18, i32 19>, ptr %3, align 16, !tbaa !5
store <4 x i32> <i32 20, i32 21, i32 22, i32 23>, ptr %4, align 16, !tbaa !5
store <4 x i32> <i32 24, i32 25, i32 26, i32 27>, ptr %5, align 16, !tbaa !5
store <4 x i32> <i32 28, i32 29, i32 30, i32 31>, ptr %6, align 16, !tbaa !5
store <4 x i32> <i32 32, i32 33, i32 34, i32 35>, ptr %7, align 16, !tbaa !5
store <4 x i32> <i32 36, i32 37, i32 38, i32 39>, ptr %8, align 16, !tbaa !5
store <4 x i32> <i32 40, i32 41, i32 42, i32 43>, ptr %9, align 16, !tbaa !5
store <4 x i32> <i32 44, i32 45, i32 46, i32 47>, ptr %10, align 16, !tbaa !5
store <4 x i32> <i32 48, i32 49, i32 50, i32 51>, ptr %11, align 16, !tbaa !5
store <4 x i32> <i32 52, i32 53, i32 54, i32 55>, ptr %12, align 16, !tbaa !5
store <4 x i32> <i32 56, i32 57, i32 58, i32 59>, ptr %13, align 16, !tbaa !5
store <4 x i32> <i32 60, i32 61, i32 62, i32 63>, ptr %14, align 16, !tbaa !5
store <4 x i32> <i32 64, i32 65, i32 66, i32 67>, ptr %15, align 16, !tbaa !5
store <4 x i32> <i32 68, i32 69, i32 70, i32 71>, ptr %16, align 16, !tbaa !5
store <4 x i32> <i32 72, i32 73, i32 74, i32 75>, ptr %17, align 16, !tbaa !5
store <4 x i32> <i32 76, i32 77, i32 78, i32 79>, ptr %18, align 16, !tbaa !5
store <4 x i32> <i32 80, i32 81, i32 82, i32 83>, ptr %19, align 16, !tbaa !5
store <4 x i32> <i32 84, i32 85, i32 86, i32 87>, ptr %20, align 16, !tbaa !5
store <4 x i32> <i32 88, i32 89, i32 90, i32 91>, ptr %21, align 16, !tbaa !5
store <4 x i32> <i32 92, i32 93, i32 94, i32 95>, ptr %22, align 16, !tbaa !5
store <4 x i32> <i32 96, i32 97, i32 98, i32 99>, ptr %23, align 16, !tbaa !5
store i32 100, ptr %arrayidx, align 16, !tbaa !5
%cmp7125 = icmp sgt i32 %25, 0
br i1 %cmp7125, label %for.body8, label %for.cond74.preheader
for.cond19.preheader: ; preds = %for.body8
%cmp20129 = icmp sgt i32 %28, 1
br i1 %cmp20129, label %for.body21.preheader, label %for.cond48.preheader
for.body21.preheader: ; preds = %for.cond19.preheader
%sub = add nsw i32 %28, -1
%27 = zext i32 %28 to i64
%wide.trip.count152 = zext i32 %sub to i64
%wide.trip.count = zext i32 %28 to i64
br label %for.body21
for.body8: ; preds = %vector.body, %for.body8
%indvars.iv140 = phi i64 [ %indvars.iv.next141, %for.body8 ], [ 0, %vector.body ]
%arrayidx10 = getelementptr inbounds [1001 x %struct.element_], ptr %elem, i64 0, i64 %indvars.iv140
%p = getelementptr inbounds [1001 x %struct.element_], ptr %elem, i64 0, i64 %indvars.iv140, i32 1
%q = getelementptr inbounds [1001 x %struct.element_], ptr %elem, i64 0, i64 %indvars.iv140, i32 2
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx10, ptr noundef nonnull %p, ptr noundef nonnull %q)
%indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1
%28 = load i32, ptr %m, align 4, !tbaa !5
%29 = sext i32 %28 to i64
%cmp7 = icmp slt i64 %indvars.iv.next141, %29
br i1 %cmp7, label %for.body8, label %for.cond19.preheader, !llvm.loop !11
for.cond19.loopexit: ; preds = %for.inc42, %for.body21
%indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
%exitcond153.not = icmp eq i64 %indvars.iv.next150, %wide.trip.count152
br i1 %exitcond153.not, label %for.cond48.preheader, label %for.body21, !llvm.loop !13
for.cond48.preheader: ; preds = %for.cond19.loopexit, %for.cond19.preheader
%cmp49131 = icmp sgt i32 %28, 0
br i1 %cmp49131, label %for.body50.preheader, label %for.cond74.preheader
for.body50.preheader: ; preds = %for.cond48.preheader
%wide.trip.count157 = zext i32 %28 to i64
%xtraiter = and i64 %wide.trip.count157, 1
%30 = icmp eq i32 %28, 1
br i1 %30, label %for.cond74.preheader.loopexit.unr-lcssa, label %for.body50.preheader.new
for.body50.preheader.new: ; preds = %for.body50.preheader
%unroll_iter = and i64 %wide.trip.count157, 4294967294
br label %for.body50
for.body21: ; preds = %for.body21.preheader, %for.cond19.loopexit
%indvars.iv149 = phi i64 [ 0, %for.body21.preheader ], [ %indvars.iv.next150, %for.cond19.loopexit ]
%indvars.iv143 = phi i64 [ 1, %for.body21.preheader ], [ %indvars.iv.next144, %for.cond19.loopexit ]
%indvars.iv.next150 = add nuw nsw i64 %indvars.iv149, 1
%cmp23127 = icmp ult i64 %indvars.iv.next150, %27
br i1 %cmp23127, label %for.body24.lr.ph, label %for.cond19.loopexit
for.body24.lr.ph: ; preds = %for.body21
%arrayidx26 = getelementptr inbounds [1001 x %struct.element_], ptr %elem, i64 0, i64 %indvars.iv149
%p.i = getelementptr inbounds [1001 x %struct.element_], ptr %elem, i64 0, i64 %indvars.iv149, i32 1
br label %for.body24
for.body24: ; preds = %for.body24.lr.ph, %for.inc42
%indvars.iv145 = phi i64 [ %indvars.iv143, %for.body24.lr.ph ], [ %indvars.iv.next146, %for.inc42 ]
%31 = load i32, ptr %arrayidx26, align 4, !tbaa !14
%arrayidx29 = getelementptr inbounds [1001 x %struct.element_], ptr %elem, i64 0, i64 %indvars.iv145
%32 = load i32, ptr %arrayidx29, align 4, !tbaa !14
%cmp31 = icmp slt i32 %31, %32
br i1 %cmp31, label %if.then32, label %for.inc42
if.then32: ; preds = %for.body24
store i32 %32, ptr %arrayidx26, align 4, !tbaa !14
%p.i115 = getelementptr inbounds [1001 x %struct.element_], ptr %elem, i64 0, i64 %indvars.iv145, i32 1
store i32 %31, ptr %arrayidx29, align 4, !tbaa !14
%33 = load <2 x i32>, ptr %p.i, align 4, !tbaa !5
%34 = load <2 x i32>, ptr %p.i115, align 4, !tbaa !5
store <2 x i32> %34, ptr %p.i, align 4, !tbaa !5
store <2 x i32> %33, ptr %p.i115, align 4, !tbaa !5
br label %for.inc42
for.inc42: ; preds = %for.body24, %if.then32
%indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
%exitcond148.not = icmp eq i64 %indvars.iv.next146, %wide.trip.count
br i1 %exitcond148.not, label %for.cond19.loopexit, label %for.body24, !llvm.loop !15
for.cond74.preheader.loopexit.unr-lcssa: ; preds = %for.body50, %for.body50.preheader
%indvars.iv154.unr = phi i64 [ 0, %for.body50.preheader ], [ %indvars.iv.next155.1, %for.body50 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond74.preheader, label %for.body50.epil
for.body50.epil: ; preds = %for.cond74.preheader.loopexit.unr-lcssa
%p53.epil = getelementptr inbounds [1001 x %struct.element_], ptr %elem, i64 0, i64 %indvars.iv154.unr, i32 1
%35 = load i32, ptr %p53.epil, align 4, !tbaa !16
%idxprom54.epil = sext i32 %35 to i64
%arrayidx55.epil = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 %idxprom54.epil
%36 = load i32, ptr %arrayidx55.epil, align 4, !tbaa !5
%q58.epil = getelementptr inbounds [1001 x %struct.element_], ptr %elem, i64 0, i64 %indvars.iv154.unr, i32 2
%37 = load i32, ptr %q58.epil, align 4, !tbaa !9
%idxprom59.epil = sext i32 %37 to i64
%arrayidx60.epil = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 %idxprom59.epil
%38 = load i32, ptr %arrayidx60.epil, align 4, !tbaa !5
store i32 %38, ptr %arrayidx55.epil, align 4, !tbaa !5
store i32 %36, ptr %arrayidx60.epil, align 4, !tbaa !5
br label %for.cond74.preheader
for.cond74.preheader: ; preds = %for.body50.epil, %for.cond74.preheader.loopexit.unr-lcssa, %vector.body, %for.cond48.preheader
%39 = load i32, ptr %n, align 4, !tbaa !5
%cmp75.not133 = icmp slt i32 %39, 0
br i1 %cmp75.not133, label %for.end85, label %for.body76.lr.ph
for.body76.lr.ph: ; preds = %for.cond74.preheader
%40 = load i32, ptr %a, align 4, !tbaa !5
%41 = add nuw i32 %39, 1
%wide.trip.count162 = zext i32 %41 to i64
br label %for.body76
for.body50: ; preds = %for.body50, %for.body50.preheader.new
%indvars.iv154 = phi i64 [ 0, %for.body50.preheader.new ], [ %indvars.iv.next155.1, %for.body50 ]
%niter = phi i64 [ 0, %for.body50.preheader.new ], [ %niter.next.1, %for.body50 ]
%p53 = getelementptr inbounds [1001 x %struct.element_], ptr %elem, i64 0, i64 %indvars.iv154, i32 1
%42 = load i32, ptr %p53, align 4, !tbaa !16
%idxprom54 = sext i32 %42 to i64
%arrayidx55 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 %idxprom54
%43 = load i32, ptr %arrayidx55, align 4, !tbaa !5
%q58 = getelementptr inbounds [1001 x %struct.element_], ptr %elem, i64 0, i64 %indvars.iv154, i32 2
%44 = load i32, ptr %q58, align 8, !tbaa !9
%idxprom59 = sext i32 %44 to i64
%arrayidx60 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 %idxprom59
%45 = load i32, ptr %arrayidx60, align 4, !tbaa !5
store i32 %45, ptr %arrayidx55, align 4, !tbaa !5
store i32 %43, ptr %arrayidx60, align 4, !tbaa !5
%indvars.iv.next155 = or i64 %indvars.iv154, 1
%p53.1 = getelementptr inbounds [1001 x %struct.element_], ptr %elem, i64 0, i64 %indvars.iv.next155, i32 1
%46 = load i32, ptr %p53.1, align 8, !tbaa !16
%idxprom54.1 = sext i32 %46 to i64
%arrayidx55.1 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 %idxprom54.1
%47 = load i32, ptr %arrayidx55.1, align 4, !tbaa !5
%q58.1 = getelementptr inbounds [1001 x %struct.element_], ptr %elem, i64 0, i64 %indvars.iv.next155, i32 2
%48 = load i32, ptr %q58.1, align 4, !tbaa !9
%idxprom59.1 = sext i32 %48 to i64
%arrayidx60.1 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 %idxprom59.1
%49 = load i32, ptr %arrayidx60.1, align 4, !tbaa !5
store i32 %49, ptr %arrayidx55.1, align 4, !tbaa !5
store i32 %47, ptr %arrayidx60.1, align 4, !tbaa !5
%indvars.iv.next155.1 = add nuw nsw i64 %indvars.iv154, 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.cond74.preheader.loopexit.unr-lcssa, label %for.body50, !llvm.loop !17
for.body76: ; preds = %for.body76.lr.ph, %for.inc83
%indvars.iv159 = phi i64 [ 0, %for.body76.lr.ph ], [ %indvars.iv.next160, %for.inc83 ]
%arrayidx78 = getelementptr inbounds [105 x i32], ptr %line, i64 0, i64 %indvars.iv159
%50 = load i32, ptr %arrayidx78, align 4, !tbaa !5
%cmp79 = icmp eq i32 %50, %40
br i1 %cmp79, label %if.then80, label %for.inc83
if.then80: ; preds = %for.body76
%51 = trunc i64 %indvars.iv159 to i32
%call81 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %51)
br label %for.end85
for.inc83: ; preds = %for.body76
%indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
%exitcond163.not = icmp eq i64 %indvars.iv.next160, %wide.trip.count162
br i1 %exitcond163.not, label %for.end85, label %for.body76, !llvm.loop !18
for.end85: ; preds = %for.inc83, %for.cond74.preheader, %if.then80
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %a)
%cmp = icmp eq i32 %call, 3
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !19
while.end: ; preds = %for.end85, %while.body, %entry
call void @llvm.lifetime.end.p0(i64 12012, ptr nonnull %elem) #4
call void @llvm.lifetime.end.p0(i64 420, ptr nonnull %line) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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(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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"element_", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!10, !6, i64 0}
!15 = distinct !{!15, !12}
!16 = !{!10, !6, i64 4}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
|
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n, i, minb, maxa;
int a[100000], b[10000];
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%d %d", &a[i], &b[i]);
if (i == 0){
minb = b[i];
maxa = a[i];
}
else{
if (maxa < a[i]){
minb = b[i];
maxa = a[i];
}
}
}
printf("%d", minb + maxa);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249620/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249620/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca [100000 x i32], align 16
%b = alloca [10000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %0, 0
call void @llvm.assume(i1 %cmp29)
%call3.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%1 = load i32, ptr %b, align 16, !tbaa !5
%2 = load i32, ptr %a, align 16, !tbaa !5
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp.peel = icmp sgt i32 %3, 1
br i1 %cmp.peel, label %if.else, label %for.end.loopexit
if.else: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %entry ]
%maxa.032 = phi i32 [ %maxa.1, %for.inc ], [ %2, %entry ]
%minb.031 = phi i32 [ %minb.1, %for.inc ], [ %1, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %a, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [10000 x i32], ptr %b, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp11 = icmp slt i32 %maxa.032, %4
br i1 %cmp11, label %if.then12, label %for.inc
if.then12: ; preds = %if.else
%5 = load i32, ptr %arrayidx2, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then12, %if.else
%minb.1 = phi i32 [ %5, %if.then12 ], [ %minb.031, %if.else ]
%maxa.1 = phi i32 [ %4, %if.then12 ], [ %maxa.032, %if.else ]
%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 %if.else, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc, %entry
%minb.1.lcssa = phi i32 [ %1, %entry ], [ %minb.1, %for.inc ]
%maxa.1.lcssa = phi i32 [ %2, %entry ], [ %maxa.1, %for.inc ]
%8 = add nsw i32 %maxa.1.lcssa, %minb.1.lcssa
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8)
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #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 willreturn memory(inaccessiblemem: 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, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
|
// AOJ 1345: Bit String Reordering
// 2017.12.4 bal4u@uu
#include <stdio.h>
#define INF 1000
int b[16];
int zero[16], one[16];
int swap(int *a, int goal, int fr, int to)
{
int i;
for (i = fr+1; i < to; i++) {
if (a[i] == goal) { a[i] = a[fr], a[fr] = goal; return i - fr; }
}
return INF;
}
int main()
{
int n, m, p, i, j, bit, cnt0, cnt1;
scanf("%d%d", &n, &m);
for (i = 0; i < n; i++) scanf("%d", b+i);
for (bit = 0, j = i = 0; i < m; i++, bit = !bit) {
scanf("%d", &p);
while (p--) zero[j] = bit, one[j++] = !bit;
}
for (cnt0 = cnt1 = 0, i = 0; i < n; i++) {
if (zero[i] != b[i]) cnt0 += swap(zero, b[i], i, n);
if ( one[i] != b[i]) cnt1 += swap( one, b[i], i, n);
}
if (cnt0 > cnt1) cnt0 = cnt1;
printf("%d\n", cnt0);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249671/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249671/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@b = dso_local global [16 x i32] zeroinitializer, align 16
@zero = dso_local local_unnamed_addr global [16 x i32] zeroinitializer, align 16
@one = dso_local local_unnamed_addr global [16 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @swap(ptr nocapture noundef %a, i32 noundef %goal, i32 noundef %fr, i32 noundef %to) local_unnamed_addr #0 {
entry:
%0 = sext i32 %fr to i64
%1 = sext i32 %to to i64
br label %for.cond
for.cond: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %0, %entry ]
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%cmp = icmp slt i64 %indvars.iv.next, %1
br i1 %cmp, label %for.body, label %cleanup
for.body: ; preds = %for.cond
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %2, %goal
br i1 %cmp1, label %if.then, label %for.cond, !llvm.loop !9
if.then: ; preds = %for.body
%arrayidx.le = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next
%3 = trunc i64 %indvars.iv.next to i32
%arrayidx3 = getelementptr inbounds i32, ptr %a, i64 %0
%4 = load i32, ptr %arrayidx3, align 4, !tbaa !5
store i32 %4, ptr %arrayidx.le, align 4, !tbaa !5
store i32 %goal, ptr %arrayidx3, align 4, !tbaa !5
%sub = sub nsw i32 %3, %fr
br label %cleanup
cleanup: ; preds = %for.cond, %if.then
%retval.0 = phi i32 [ %sub, %if.then ], [ 1000, %for.cond ]
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
%p = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #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
%cmp83 = icmp sgt i32 %0, 0
br i1 %cmp83, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %3, %for.body ]
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp391 = icmp sgt i32 %2, 0
br i1 %cmp391, label %for.body4, label %for.cond16.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr @b, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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.cond2.preheader, !llvm.loop !11
for.cond16.preheader.loopexit: ; preds = %for.inc10
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond16.preheader
for.cond16.preheader: ; preds = %for.cond16.preheader.loopexit, %for.cond2.preheader
%5 = phi i32 [ %.pre, %for.cond16.preheader.loopexit ], [ %1, %for.cond2.preheader ]
%cmp1795 = icmp sgt i32 %5, 0
br i1 %cmp1795, label %for.body18.lr.ph, label %for.end40
for.body18.lr.ph: ; preds = %for.cond16.preheader
%6 = zext i32 %5 to i64
%wide.trip.count = zext i32 %5 to i64
br label %for.body18
for.body4: ; preds = %for.cond2.preheader, %for.inc10
%bit.094 = phi i32 [ %lnot.ext14, %for.inc10 ], [ 0, %for.cond2.preheader ]
%j.093 = phi i32 [ %j.1.lcssa, %for.inc10 ], [ 0, %for.cond2.preheader ]
%i.192 = phi i32 [ %inc11, %for.inc10 ], [ 0, %for.cond2.preheader ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %p)
%p.promoted = load i32, ptr %p, align 4, !tbaa !5
%tobool.not87 = icmp eq i32 %p.promoted, 0
br i1 %tobool.not87, label %for.inc10, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.body4
%tobool6.not = icmp eq i32 %bit.094, 0
%lnot.ext = zext i1 %tobool6.not to i32
%7 = sext i32 %j.093 to i64
%8 = zext i32 %p.promoted to i64
%min.iters.check = icmp ult i32 %p.promoted, 8
br i1 %min.iters.check, label %while.body.preheader, label %vector.ph
vector.ph: ; preds = %while.body.lr.ph
%n.vec = and i64 %8, 4294967288
%ind.end = add nsw i64 %n.vec, %7
%.cast = trunc i64 %n.vec to i32
%ind.end116 = sub i32 %p.promoted, %.cast
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %bit.094, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert118 = insertelement <4 x i32> poison, i32 %lnot.ext, i64 0
%broadcast.splat119 = shufflevector <4 x i32> %broadcast.splatinsert118, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = add i64 %index, %7
%9 = getelementptr inbounds [16 x i32], ptr @zero, i64 0, i64 %offset.idx
store <4 x i32> %broadcast.splat, ptr %9, align 4, !tbaa !5
%10 = getelementptr inbounds i32, ptr %9, i64 4
store <4 x i32> %broadcast.splat, ptr %10, align 4, !tbaa !5
%11 = getelementptr inbounds [16 x i32], ptr @one, i64 0, i64 %offset.idx
store <4 x i32> %broadcast.splat119, ptr %11, align 4, !tbaa !5
%12 = getelementptr inbounds i32, ptr %11, i64 4
store <4 x i32> %broadcast.splat119, ptr %12, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %8
br i1 %cmp.n, label %for.inc10.loopexit, label %while.body.preheader
while.body.preheader: ; preds = %while.body.lr.ph, %middle.block
%indvars.iv106.ph = phi i64 [ %7, %while.body.lr.ph ], [ %ind.end, %middle.block ]
%dec89.in.ph = phi i32 [ %p.promoted, %while.body.lr.ph ], [ %ind.end116, %middle.block ]
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%indvars.iv106 = phi i64 [ %indvars.iv.next107, %while.body ], [ %indvars.iv106.ph, %while.body.preheader ]
%dec89.in = phi i32 [ %dec89, %while.body ], [ %dec89.in.ph, %while.body.preheader ]
%dec89 = add nsw i32 %dec89.in, -1
%arrayidx = getelementptr inbounds [16 x i32], ptr @zero, i64 0, i64 %indvars.iv106
store i32 %bit.094, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next107 = add nsw i64 %indvars.iv106, 1
%arrayidx9 = getelementptr inbounds [16 x i32], ptr @one, i64 0, i64 %indvars.iv106
store i32 %lnot.ext, ptr %arrayidx9, align 4, !tbaa !5
%tobool.not = icmp eq i32 %dec89, 0
br i1 %tobool.not, label %for.inc10.loopexit, label %while.body, !llvm.loop !15
for.inc10.loopexit: ; preds = %while.body, %middle.block
%indvars.iv.next107.lcssa = phi i64 [ %ind.end, %middle.block ], [ %indvars.iv.next107, %while.body ]
%14 = trunc i64 %indvars.iv.next107.lcssa to i32
br label %for.inc10
for.inc10: ; preds = %for.inc10.loopexit, %for.body4
%j.1.lcssa = phi i32 [ %j.093, %for.body4 ], [ %14, %for.inc10.loopexit ]
store i32 -1, ptr %p, align 4, !tbaa !5
%inc11 = add nuw nsw i32 %i.192, 1
%lnot.ext14 = xor i32 %bit.094, 1
%15 = load i32, ptr %m, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc11, %15
br i1 %cmp3, label %for.body4, label %for.cond16.preheader.loopexit, !llvm.loop !16
for.body18: ; preds = %for.body18.lr.ph, %for.inc38
%indvars.iv109 = phi i64 [ 0, %for.body18.lr.ph ], [ %indvars.iv.next110, %for.inc38 ]
%cnt1.099 = phi i32 [ 0, %for.body18.lr.ph ], [ %cnt1.1, %for.inc38 ]
%cnt0.098 = phi i32 [ 0, %for.body18.lr.ph ], [ %cnt0.1, %for.inc38 ]
%arrayidx20 = getelementptr inbounds [16 x i32], ptr @zero, i64 0, i64 %indvars.iv109
%16 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%arrayidx22 = getelementptr inbounds [16 x i32], ptr @b, i64 0, i64 %indvars.iv109
%17 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23.not = icmp eq i32 %16, %17
br i1 %cmp23.not, label %if.end, label %for.cond.i
for.cond.i: ; preds = %for.body18, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ %indvars.iv109, %for.body18 ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%cmp.i = icmp ult i64 %indvars.iv.next.i, %6
br i1 %cmp.i, label %for.body.i, label %swap.exit
for.body.i: ; preds = %for.cond.i
%arrayidx.i = getelementptr inbounds i32, ptr @zero, i64 %indvars.iv.next.i
%18 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp eq i32 %18, %17
br i1 %cmp1.i, label %if.then.i, label %for.cond.i, !llvm.loop !9
if.then.i: ; preds = %for.body.i
%19 = trunc i64 %indvars.iv.next.i to i32
store i32 %16, ptr %arrayidx.i, align 4, !tbaa !5
store i32 %17, ptr %arrayidx20, align 4, !tbaa !5
%20 = trunc i64 %indvars.iv109 to i32
%sub.i = sub nuw nsw i32 %19, %20
br label %swap.exit
swap.exit: ; preds = %for.cond.i, %if.then.i
%retval.0.i = phi i32 [ %sub.i, %if.then.i ], [ 1000, %for.cond.i ]
%add = add nsw i32 %retval.0.i, %cnt0.098
br label %if.end
if.end: ; preds = %swap.exit, %for.body18
%cnt0.1 = phi i32 [ %add, %swap.exit ], [ %cnt0.098, %for.body18 ]
%arrayidx28 = getelementptr inbounds [16 x i32], ptr @one, i64 0, i64 %indvars.iv109
%21 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%cmp31.not = icmp eq i32 %21, %17
br i1 %cmp31.not, label %for.inc38, label %for.cond.i68
for.cond.i68: ; preds = %if.end, %for.body.i73
%indvars.iv.i69 = phi i64 [ %indvars.iv.next.i70, %for.body.i73 ], [ %indvars.iv109, %if.end ]
%indvars.iv.next.i70 = add nuw nsw i64 %indvars.iv.i69, 1
%cmp.i71 = icmp ult i64 %indvars.iv.next.i70, %6
br i1 %cmp.i71, label %for.body.i73, label %swap.exit80
for.body.i73: ; preds = %for.cond.i68
%arrayidx.i74 = getelementptr inbounds i32, ptr @one, i64 %indvars.iv.next.i70
%22 = load i32, ptr %arrayidx.i74, align 4, !tbaa !5
%cmp1.i75 = icmp eq i32 %22, %17
br i1 %cmp1.i75, label %if.then.i76, label %for.cond.i68, !llvm.loop !9
if.then.i76: ; preds = %for.body.i73
%23 = trunc i64 %indvars.iv.next.i70 to i32
store i32 %21, ptr %arrayidx.i74, align 4, !tbaa !5
store i32 %17, ptr %arrayidx28, align 4, !tbaa !5
%24 = trunc i64 %indvars.iv109 to i32
%sub.i79 = sub nuw nsw i32 %23, %24
br label %swap.exit80
swap.exit80: ; preds = %for.cond.i68, %if.then.i76
%retval.0.i72 = phi i32 [ %sub.i79, %if.then.i76 ], [ 1000, %for.cond.i68 ]
%add36 = add nsw i32 %retval.0.i72, %cnt1.099
br label %for.inc38
for.inc38: ; preds = %if.end, %swap.exit80
%cnt1.1 = phi i32 [ %add36, %swap.exit80 ], [ %cnt1.099, %if.end ]
%indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
%exitcond.not = icmp eq i64 %indvars.iv.next110, %wide.trip.count
br i1 %exitcond.not, label %for.end40, label %for.body18, !llvm.loop !17
for.end40: ; preds = %for.inc38, %for.cond16.preheader
%cnt0.0.lcssa = phi i32 [ 0, %for.cond16.preheader ], [ %cnt0.1, %for.inc38 ]
%cnt1.0.lcssa = phi i32 [ 0, %for.cond16.preheader ], [ %cnt1.1, %for.inc38 ]
%spec.select = call i32 @llvm.smin.i32(i32 %cnt0.0.lcssa, i32 %cnt1.0.lcssa)
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %spec.select)
call void @llvm.lifetime.end.p0(i64 4, 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
#define abs(x) (((x)>0)?(x):-(x))
int main()
{
int i, j, k, n;
scanf("%d %d", &n, &k);
int h[n+k];
int cost[n+k];
for (i=0; i<n; i++) scanf("%d", &h[i]);
for (; i<n+k; i++) {
h[i] = h[n-1];
cost[i] = 0;
}
for (i=n-1; i>=0; i--) {
for (j=k; j>0; j--) {
if (j==k || cost[i] > abs(h[i]-h[i+j])+cost[i+j])
cost[i] = abs(h[i]-h[i+j])+cost[i+j];
}
}
printf("%d\n", cost[0]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249714/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249714/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%k = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = load i32, ptr %k, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = zext i32 %add to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %2, align 16
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = load i32, ptr %k, align 4, !tbaa !5
%add1 = add i32 %5, %4
%6 = zext i32 %add1 to i64
%vla2 = alloca i32, i64 %6, align 16
%cmp124 = icmp sgt i32 %4, 0
br i1 %cmp124, label %for.body, label %for.cond4.preheader
for.cond4.preheader.loopexit: ; preds = %for.body
%7 = trunc i64 %indvars.iv.next to i32
%.pre = load i32, ptr %k, align 4, !tbaa !5
%.pre149 = add i32 %.pre, %21
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond4.preheader.loopexit, %entry
%add5.pre-phi = phi i32 [ %.pre149, %for.cond4.preheader.loopexit ], [ %add1, %entry ]
%8 = phi i32 [ %.pre, %for.cond4.preheader.loopexit ], [ %5, %entry ]
%i.0.lcssa = phi i32 [ %7, %for.cond4.preheader.loopexit ], [ 0, %entry ]
%.lcssa123 = phi i32 [ %21, %for.cond4.preheader.loopexit ], [ %4, %entry ]
%cmp6127 = icmp slt i32 %i.0.lcssa, %add5.pre-phi
br i1 %cmp6127, label %for.body7.lr.ph, label %for.cond18.preheader
for.body7.lr.ph: ; preds = %for.cond4.preheader
%sub = add nsw i32 %.lcssa123, -1
%idxprom8 = sext i32 %sub to i64
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %idxprom8
%9 = zext i32 %i.0.lcssa to i64
%10 = shl nuw nsw i64 %9, 2
%scevgep = getelementptr i8, ptr %vla2, i64 %10
%11 = xor i32 %i.0.lcssa, -1
%12 = add i32 %add5.pre-phi, %11
%13 = zext i32 %12 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = add nuw nsw i64 %14, 4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep, i8 0, i64 %15, i1 false), !tbaa !5
%wide.trip.count = zext i32 %add5.pre-phi to i64
%16 = sub nsw i64 %wide.trip.count, %9
%17 = xor i64 %9, -1
%18 = add nsw i64 %17, %wide.trip.count
%xtraiter = and i64 %16, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body7.prol.loopexit, label %for.body7.prol
for.body7.prol: ; preds = %for.body7.lr.ph, %for.body7.prol
%indvars.iv137.prol = phi i64 [ %indvars.iv.next138.prol, %for.body7.prol ], [ %9, %for.body7.lr.ph ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body7.prol ], [ 0, %for.body7.lr.ph ]
%19 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%arrayidx11.prol = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv137.prol
store i32 %19, ptr %arrayidx11.prol, align 4, !tbaa !5
%indvars.iv.next138.prol = add nuw nsw i64 %indvars.iv137.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body7.prol.loopexit, label %for.body7.prol, !llvm.loop !9
for.body7.prol.loopexit: ; preds = %for.body7.prol, %for.body7.lr.ph
%indvars.iv137.unr = phi i64 [ %9, %for.body7.lr.ph ], [ %indvars.iv.next138.prol, %for.body7.prol ]
%20 = icmp ult i64 %18, 3
br i1 %20, label %for.cond18.preheader, label %for.body7.lr.ph.new
for.body7.lr.ph.new: ; preds = %for.body7.prol.loopexit
%invariant.gep = getelementptr i32, ptr %vla, i64 1
%invariant.gep152 = getelementptr i32, ptr %vla, i64 2
%invariant.gep154 = getelementptr i32, ptr %vla, i64 3
br label %for.body7
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
%21 = load i32, ptr %n, align 4, !tbaa !5
%22 = sext i32 %21 to i64
%cmp = icmp slt i64 %indvars.iv.next, %22
br i1 %cmp, label %for.body, label %for.cond4.preheader.loopexit, !llvm.loop !11
for.cond18.preheader: ; preds = %for.body7.prol.loopexit, %for.body7, %for.cond4.preheader
%cmp19133 = icmp sgt i32 %.lcssa123, 0
%cmp22130 = icmp sgt i32 %8, 0
%or.cond = select i1 %cmp19133, i1 %cmp22130, i1 false
br i1 %or.cond, label %for.cond21.preheader.us.preheader, label %for.end86
for.cond21.preheader.us.preheader: ; preds = %for.cond18.preheader
%23 = zext i32 %8 to i64
%24 = zext i32 %.lcssa123 to i64
%cmp22.us.peel = icmp ugt i32 %8, 1
br label %for.cond21.preheader.us
for.cond21.preheader.us: ; preds = %for.cond21.preheader.us.preheader, %for.cond21.for.cond18.loopexit_crit_edge.us
%indvars.iv145.in = phi i64 [ %24, %for.cond21.preheader.us.preheader ], [ %indvars.iv145, %for.cond21.for.cond18.loopexit_crit_edge.us ]
%indvars.iv145 = add nsw i64 %indvars.iv145.in, -1
%arrayidx26.us = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv145
%arrayidx28.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv145
%.pre148.pre = load i32, ptr %arrayidx28.us, align 4, !tbaa !5
%.pre150.peel = add nuw nsw i64 %indvars.iv145, %23
%arrayidx56.us.peel = getelementptr inbounds i32, ptr %vla, i64 %.pre150.peel
%25 = load i32, ptr %arrayidx56.us.peel, align 4, !tbaa !5
%sub57.us.peel = sub nsw i32 %.pre148.pre, %25
%cond75.us.peel = call i32 @llvm.abs.i32(i32 %sub57.us.peel, i1 true)
%arrayidx78.us.peel = getelementptr inbounds i32, ptr %vla2, i64 %.pre150.peel
%26 = load i32, ptr %arrayidx78.us.peel, align 4, !tbaa !5
%add79.us.peel = add nsw i32 %cond75.us.peel, %26
store i32 %add79.us.peel, ptr %arrayidx26.us, align 4, !tbaa !5
br i1 %cmp22.us.peel, label %for.body23.us, label %for.cond21.for.cond18.loopexit_crit_edge.us
for.body23.us: ; preds = %for.cond21.preheader.us, %for.inc82.us
%indvars.iv140.in = phi i64 [ %indvars.iv140, %for.inc82.us ], [ %23, %for.cond21.preheader.us ]
%indvars.iv140 = add nsw i64 %indvars.iv140.in, -1
%27 = load i32, ptr %arrayidx26.us, align 4, !tbaa !5
%28 = add nuw nsw i64 %indvars.iv140, %indvars.iv145
%arrayidx31.us = getelementptr inbounds i32, ptr %vla, i64 %28
%29 = load i32, ptr %arrayidx31.us, align 4, !tbaa !5
%sub32.us = sub nsw i32 %.pre148.pre, %29
%cond.us = call i32 @llvm.abs.i32(i32 %sub32.us, i1 true)
%arrayidx49.us = getelementptr inbounds i32, ptr %vla2, i64 %28
%30 = load i32, ptr %arrayidx49.us, align 4, !tbaa !5
%add50.us = add nsw i32 %cond.us, %30
%cmp51.us = icmp sgt i32 %27, %add50.us
br i1 %cmp51.us, label %if.then.us, label %for.inc82.us
if.then.us: ; preds = %for.body23.us
%arrayidx56.us = getelementptr inbounds i32, ptr %vla, i64 %28
%31 = load i32, ptr %arrayidx56.us, align 4, !tbaa !5
%sub57.us = sub nsw i32 %.pre148.pre, %31
%cond75.us = call i32 @llvm.abs.i32(i32 %sub57.us, i1 true)
%arrayidx78.us = getelementptr inbounds i32, ptr %vla2, i64 %28
%32 = load i32, ptr %arrayidx78.us, align 4, !tbaa !5
%add79.us = add nsw i32 %cond75.us, %32
store i32 %add79.us, ptr %arrayidx26.us, align 4, !tbaa !5
br label %for.inc82.us
for.inc82.us: ; preds = %if.then.us, %for.body23.us
%cmp22.us = icmp sgt i64 %indvars.iv140.in, 2
br i1 %cmp22.us, label %for.body23.us, label %for.cond21.for.cond18.loopexit_crit_edge.us, !llvm.loop !13
for.cond21.for.cond18.loopexit_crit_edge.us: ; preds = %for.inc82.us, %for.cond21.preheader.us
%cmp19.us = icmp sgt i64 %indvars.iv145.in, 1
br i1 %cmp19.us, label %for.cond21.preheader.us, label %for.end86, !llvm.loop !15
for.body7: ; preds = %for.body7, %for.body7.lr.ph.new
%indvars.iv137 = phi i64 [ %indvars.iv137.unr, %for.body7.lr.ph.new ], [ %indvars.iv.next138.3, %for.body7 ]
%33 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv137
store i32 %33, ptr %arrayidx11, align 4, !tbaa !5
%34 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv137
store i32 %34, ptr %gep, align 4, !tbaa !5
%35 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%gep153 = getelementptr i32, ptr %invariant.gep152, i64 %indvars.iv137
store i32 %35, ptr %gep153, align 4, !tbaa !5
%36 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%gep155 = getelementptr i32, ptr %invariant.gep154, i64 %indvars.iv137
store i32 %36, ptr %gep155, align 4, !tbaa !5
%indvars.iv.next138.3 = add nuw nsw i64 %indvars.iv137, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next138.3, %wide.trip.count
br i1 %exitcond.not.3, label %for.cond18.preheader, label %for.body7, !llvm.loop !16
for.end86: ; preds = %for.cond21.for.cond18.loopexit_crit_edge.us, %for.cond18.preheader
%37 = load i32, ptr %vla2, align 16, !tbaa !5
%call88 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %37)
call void @llvm.stackrestore.p0(ptr %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12, !14}
!14 = !{!"llvm.loop.peeled.count", i32 1}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
|
#include <stdio.h>
int min(int a,int b){
if(a>b) return b;
else return a;
}
int abs(int a){
if(a>0) return a;
else return -1*a;
}
int main(void) {
int n;
int k;
int x=0;
int tmp = 0;
scanf("%d%d",&n,&k);
int dp[n];
int cost[n];
for(int i=0;i<n;i++){
scanf("%d",&cost[i]);
}
dp[0] = 0;
dp[1] = abs(cost[0]-cost[1]);
for(int i=2;i<n;i++){
//dp[i] = min(dp[i-2]+abs(cost[i-2]-cost[i]),dp[i-1]+abs(cost[i-1]-cost[i]));
if(i-k<0) x = i;
else x = k;
for(int j=i-x;j<i;j++){
if(j==i-x) tmp = dp[j]+abs(cost[i]-cost[j]);
if(tmp>dp[j]+abs(cost[i]-cost[j])) tmp = dp[j]+abs(cost[i]-cost[j]);
}
dp[i] = tmp;
}
printf("%d",dp[n-1]);
/*for(int i=0;i<n;i++){
printf("%d\n",dp[i]);
}*/
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249808/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249808/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%b.a = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %b.a
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @abs(i32 noundef %a) local_unnamed_addr #1 {
entry:
%retval.0 = tail call i32 @llvm.abs.i32(i32 %a, i1 true)
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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
%cmp83 = icmp sgt i32 %3, 0
br i1 %cmp83, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
store i32 0, ptr %vla, align 16, !tbaa !5
br label %for.cond.cleanup10
for.cond.cleanup: ; preds = %for.body
%.pre = load i32, ptr %vla1, align 16, !tbaa !5
%arrayidx5.phi.trans.insert = getelementptr inbounds i32, ptr %vla1, i64 1
%.pre101 = load i32, ptr %arrayidx5.phi.trans.insert, align 4, !tbaa !5
%5 = sub nsw i32 %.pre, %.pre101
store i32 0, ptr %vla, align 16, !tbaa !5
%6 = call i32 @llvm.abs.i32(i32 %5, i1 true)
%arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 1
store i32 %6, ptr %arrayidx6, align 4, !tbaa !5
%cmp989 = icmp sgt i32 %8, 2
br i1 %cmp989, label %for.body11.lr.ph, label %for.cond.cleanup10
for.body11.lr.ph: ; preds = %for.cond.cleanup
%7 = load i32, ptr %k, align 4, !tbaa !5
%wide.trip.count = zext i32 %8 to i64
%cmp1685 = icmp sgt i32 %7, 0
br label %for.body11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.cond.cleanup10: ; preds = %for.cond.cleanup17, %for.cond.cleanup.thread, %for.cond.cleanup
%.lcssa106 = phi i32 [ %3, %for.cond.cleanup.thread ], [ %8, %for.cond.cleanup ], [ %8, %for.cond.cleanup17 ]
%sub57 = add nsw i32 %.lcssa106, -1
%idxprom58 = sext i32 %sub57 to i64
%arrayidx59 = getelementptr inbounds i32, ptr %vla, i64 %idxprom58
%10 = load i32, ptr %arrayidx59, align 4, !tbaa !5
%call60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %10)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
for.body11: ; preds = %for.body11.lr.ph, %for.cond.cleanup17
%indvars.iv97 = phi i64 [ 2, %for.body11.lr.ph ], [ %indvars.iv.next98, %for.cond.cleanup17 ]
%tmp.090 = phi i32 [ 0, %for.body11.lr.ph ], [ %tmp.1.lcssa, %for.cond.cleanup17 ]
%11 = trunc i64 %indvars.iv97 to i32
%smin = call i32 @llvm.smin.i32(i32 %7, i32 %11)
%12 = sext i32 %smin to i64
%13 = sub nsw i64 %indvars.iv97, %12
br i1 %cmp1685, label %for.body18.lr.ph, label %for.cond.cleanup17
for.body18.lr.ph: ; preds = %for.body11
%14 = sub i32 %11, %smin
%15 = sext i32 %14 to i64
%arrayidx25 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv97
%16 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%arrayidx23 = getelementptr inbounds i32, ptr %vla, i64 %13
%arrayidx27 = getelementptr inbounds i32, ptr %vla1, i64 %13
br label %for.body18
for.cond.cleanup17: ; preds = %if.end29, %for.body11
%tmp.1.lcssa = phi i32 [ %tmp.090, %for.body11 ], [ %spec.select, %if.end29 ]
%arrayidx53 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv97
store i32 %tmp.1.lcssa, ptr %arrayidx53, align 4, !tbaa !5
%indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
%exitcond.not = icmp eq i64 %indvars.iv.next98, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup10, label %for.body11, !llvm.loop !11
for.body18: ; preds = %for.body18.lr.ph, %if.end29
%indvars.iv94 = phi i64 [ %15, %for.body18.lr.ph ], [ %indvars.iv.next95, %if.end29 ]
%tmp.186 = phi i32 [ %tmp.090, %for.body18.lr.ph ], [ %spec.select, %if.end29 ]
%17 = icmp eq i64 %indvars.iv94, %13
br i1 %17, label %if.then21, label %if.end29
if.then21: ; preds = %for.body18
%18 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%19 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%sub28 = sub nsw i32 %16, %19
%20 = call i32 @llvm.abs.i32(i32 %sub28, i1 true)
%add = add nsw i32 %20, %18
br label %if.end29
if.end29: ; preds = %if.then21, %for.body18
%tmp.2 = phi i32 [ %add, %if.then21 ], [ %tmp.186, %for.body18 ]
%arrayidx31 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv94
%21 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%arrayidx35 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv94
%22 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%sub36 = sub nsw i32 %16, %22
%23 = call i32 @llvm.abs.i32(i32 %sub36, i1 true)
%add37 = add nsw i32 %23, %21
%spec.select = call i32 @llvm.smin.i32(i32 %tmp.2, i32 %add37)
%indvars.iv.next95 = add nsw i64 %indvars.iv94, 1
%cmp16 = icmp slt i64 %indvars.iv.next95, %indvars.iv97
br i1 %cmp16, label %for.body18, label %for.cond.cleanup17, !llvm.loop !12
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6
; 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) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<stdlib.h>
int MIN(int a,int b){return a<b?a:b;}
int main(){
int n,m,i,j,h[100010],d[100010]={};
scanf("%d %d",&n,&m);
for(i=0;i<n;i++)scanf("%d",&h[i]);
for(i=1;i<n;i++)d[i]=1e9;
for(i=0;i<n;i++){
for(j=0;j<m&&i+j+1<n;j++)d[i+j+1]=MIN(d[i+j+1],d[i]+abs(h[i]-h[i+j+1]));
}
printf("%d\n",d[n-1]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249851/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249851/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @MIN(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%h = alloca [100010 x i32], align 16
%d = alloca [100010 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #7
call void @llvm.lifetime.start.p0(i64 400040, ptr nonnull %h) #7
call void @llvm.lifetime.start.p0(i64 400040, ptr nonnull %d) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400040) %d, i8 0, i64 400040, i1 false)
%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
%cmp64 = icmp sgt i32 %0, 0
br i1 %cmp64, label %for.body, label %for.end41
for.cond2.preheader: ; preds = %for.body
%cmp366 = icmp sgt i32 %5, 1
br i1 %cmp366, label %for.body4.preheader, label %for.cond10.preheader
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %5 to i64
%1 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %5, 9
br i1 %min.iters.check, label %for.body4.preheader95, label %vector.ph
vector.ph: ; preds = %for.body4.preheader
%n.vec = and i64 %1, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = or i64 %index, 1
%2 = getelementptr inbounds [100010 x i32], ptr %d, i64 0, i64 %offset.idx
store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %2, align 4, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %3, align 4, !tbaa !5
%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 !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %1, %n.vec
br i1 %cmp.n, label %for.cond10.preheader, label %for.body4.preheader95
for.body4.preheader95: ; preds = %for.body4.preheader, %middle.block
%indvars.iv75.ph = phi i64 [ 1, %for.body4.preheader ], [ %ind.end, %middle.block ]
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100010 x i32], ptr %h, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !13
for.cond10.preheader: ; preds = %for.body4, %middle.block, %for.cond2.preheader
%cmp1170 = icmp sgt i32 %5, 0
br i1 %cmp1170, label %for.cond13.preheader.lr.ph, label %for.end41
for.cond13.preheader.lr.ph: ; preds = %for.cond10.preheader
%7 = load i32, ptr %m, align 4, !tbaa !5
%cmp1468 = icmp sgt i32 %7, 0
br i1 %cmp1468, label %for.cond13.preheader.us.preheader, label %for.end41
for.cond13.preheader.us.preheader: ; preds = %for.cond13.preheader.lr.ph
%8 = zext i32 %5 to i64
%wide.trip.count87 = zext i32 %5 to i64
%wide.trip.count82 = zext i32 %7 to i64
br label %for.cond13.preheader.us
for.cond13.preheader.us: ; preds = %for.cond13.preheader.us.preheader, %for.inc39.us
%indvars.iv84 = phi i64 [ 0, %for.cond13.preheader.us.preheader ], [ %indvars.iv.next85, %for.inc39.us ]
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%arrayidx23.us = getelementptr inbounds [100010 x i32], ptr %d, i64 0, i64 %indvars.iv84
%arrayidx25.us = getelementptr inbounds [100010 x i32], ptr %h, i64 0, i64 %indvars.iv84
br label %land.rhs.us
land.rhs.us: ; preds = %for.cond13.preheader.us, %for.body17.us
%indvars.iv78 = phi i64 [ 0, %for.cond13.preheader.us ], [ %indvars.iv.next79, %for.body17.us ]
%9 = add nuw nsw i64 %indvars.iv.next85, %indvars.iv78
%cmp16.us = icmp ult i64 %9, %8
br i1 %cmp16.us, label %for.body17.us, label %for.inc39.us
for.inc39.us: ; preds = %for.body17.us, %land.rhs.us
%exitcond88.not = icmp eq i64 %indvars.iv.next85, %wide.trip.count87
br i1 %exitcond88.not, label %for.end41, label %for.cond13.preheader.us, !llvm.loop !14
for.body17.us: ; preds = %land.rhs.us
%arrayidx21.us = getelementptr inbounds [100010 x i32], ptr %d, i64 0, i64 %9
%10 = load i32, ptr %arrayidx21.us, align 4, !tbaa !5
%11 = load i32, ptr %arrayidx23.us, align 4, !tbaa !5
%12 = load i32, ptr %arrayidx25.us, align 4, !tbaa !5
%arrayidx29.us = getelementptr inbounds [100010 x i32], ptr %h, i64 0, i64 %9
%13 = load i32, ptr %arrayidx29.us, align 4, !tbaa !5
%sub.us = sub nsw i32 %12, %13
%14 = call i32 @llvm.abs.i32(i32 %sub.us, i1 true)
%add30.us = add nsw i32 %14, %11
%cond.i.us = call i32 @llvm.smin.i32(i32 %10, i32 %add30.us)
store i32 %cond.i.us, ptr %arrayidx21.us, align 4, !tbaa !5
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%exitcond83.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count82
br i1 %exitcond83.not, label %for.inc39.us, label %land.rhs.us, !llvm.loop !15
for.body4: ; preds = %for.body4.preheader95, %for.body4
%indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.body4 ], [ %indvars.iv75.ph, %for.body4.preheader95 ]
%arrayidx6 = getelementptr inbounds [100010 x i32], ptr %d, i64 0, i64 %indvars.iv75
store i32 1000000000, ptr %arrayidx6, align 4, !tbaa !5
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%exitcond.not = icmp eq i64 %indvars.iv.next76, %wide.trip.count
br i1 %exitcond.not, label %for.cond10.preheader, label %for.body4, !llvm.loop !16
for.end41: ; preds = %for.inc39.us, %entry, %for.cond13.preheader.lr.ph, %for.cond10.preheader
%.lcssa9194 = phi i32 [ %5, %for.cond10.preheader ], [ %5, %for.cond13.preheader.lr.ph ], [ %0, %entry ], [ %5, %for.inc39.us ]
%sub42 = add nsw i32 %.lcssa9194, -1
%idxprom43 = sext i32 %sub42 to i64
%arrayidx44 = getelementptr inbounds [100010 x i32], ptr %d, i64 0, i64 %idxprom43
%15 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%call45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15)
call void @llvm.lifetime.end.p0(i64 400040, ptr nonnull %d) #7
call void @llvm.lifetime.end.p0(i64 400040, ptr nonnull %h) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #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 i32 @llvm.smin.i32(i32, i32) #6
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 = { 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !12, !11}
|
#include <stdio.h>
#include <math.h>
int main(){
double x1,x2;
double y1,y2;
scanf("%lf %lf",&x1,&y1);
scanf("%lf %lf",&x2,&y2);
x1-=x2;
y1-=y2;
printf("%lf\n",sqrt(x1*x1+y1*y1));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249901/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249901/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%x2 = alloca double, align 8
%y1 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x2, align 8, !tbaa !5
%1 = load double, ptr %x1, align 8, !tbaa !5
%sub = fsub double %1, %0
store double %sub, ptr %x1, align 8, !tbaa !5
%2 = load double, ptr %y2, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%sub2 = fsub double %3, %2
store double %sub2, ptr %y1, align 8, !tbaa !5
%mul3 = fmul double %sub2, %sub2
%4 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul3)
%sqrt = call double @llvm.sqrt.f64(double %4)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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 double @llvm.sqrt.f64(double) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
int main(){
double x1,x2;
double y1,y2;
scanf("%lf %lf",&x1,&y1);
scanf("%lf %lf",&x2,&y2);
x1-=x2;
y1-=y2;
printf("%lf\n",sqrt(x1*x1+y1*y1));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249945/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249945/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%x2 = alloca double, align 8
%y1 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x2, align 8, !tbaa !5
%1 = load double, ptr %x1, align 8, !tbaa !5
%sub = fsub double %1, %0
store double %sub, ptr %x1, align 8, !tbaa !5
%2 = load double, ptr %y2, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%sub2 = fsub double %3, %2
store double %sub2, ptr %y1, align 8, !tbaa !5
%mul3 = fmul double %sub2, %sub2
%4 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul3)
%sqrt = call double @llvm.sqrt.f64(double %4)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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 double @llvm.sqrt.f64(double) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
int main(void) {
// your code goes here
double x1,y1;
double x2,y2;
double d;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
d = pow((x1-x2),2)+pow((y1-y2),2);
d = sqrt(d);
printf("%f",d);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_249996/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_249996/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%f\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x1, align 8, !tbaa !5
%1 = load double, ptr %x2, align 8, !tbaa !5
%2 = load double, ptr %y1, align 8, !tbaa !5
%3 = load double, ptr %y2, align 8, !tbaa !5
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %2, i64 1
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %3, i64 1
%8 = fsub <2 x double> %5, %7
%9 = fmul <2 x double> %8, %8
%shift = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%10 = fadd <2 x double> %9, %shift
%add = extractelement <2 x double> %10, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
int main(void){
double x1,y1;
double x2,y2;
double distance;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
distance=sqrt(pow(x2-x1,2)+pow(y2-y1,2));
printf("%.8f\n",distance);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250037/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250037/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%.8f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x2, align 8, !tbaa !5
%1 = load double, ptr %x1, align 8, !tbaa !5
%2 = load double, ptr %y2, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %2, i64 1
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %3, i64 1
%8 = fsub <2 x double> %5, %7
%9 = fmul <2 x double> %8, %8
%shift = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%10 = fadd <2 x double> %9, %shift
%add = extractelement <2 x double> %10, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
int main(void){
double x1,y1,x2,y2,d;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
d=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
printf("%lf\n",d);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250080/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250080/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x2, align 8, !tbaa !5
%1 = load double, ptr %x1, align 8, !tbaa !5
%sub = fsub double %0, %1
%2 = load double, ptr %y2, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%sub2 = fsub double %2, %3
%mul4 = fmul double %sub2, %sub2
%4 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul4)
%sqrt = call double @llvm.sqrt.f64(double %4)
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
int main(void)
{
double x1, y1, x2, y2;
scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
printf("%lf\n", sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250123/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250123/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x2, align 8, !tbaa !5
%1 = load double, ptr %x1, align 8, !tbaa !5
%2 = load double, ptr %y2, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %2, i64 1
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %3, i64 1
%8 = fsub <2 x double> %5, %7
%9 = fmul <2 x double> %8, %8
%shift = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%10 = fadd <2 x double> %9, %shift
%add = extractelement <2 x double> %10, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
int main(void){
double x1,y1,x2,y2,xkyo,ykyo,alkyo=0;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
xkyo=pow(x2-x1,2);
ykyo=pow(y2-y1,2);
alkyo=sqrt(xkyo+ykyo);
printf("%lf\n",alkyo);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250174/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250174/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x2, align 8, !tbaa !5
%1 = load double, ptr %x1, align 8, !tbaa !5
%2 = load double, ptr %y2, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %2, i64 1
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %3, i64 1
%8 = fsub <2 x double> %5, %7
%9 = fmul <2 x double> %8, %8
%shift = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%10 = fadd <2 x double> %9, %shift
%add = extractelement <2 x double> %10, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include<math.h>
int main(void){
double x1,x2,y1,y2, a;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
a=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
a=sqrt(a);
printf("%f", a);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250217/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250217/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%f\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%x2 = alloca double, align 8
%y1 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x1, align 8, !tbaa !5
%1 = load double, ptr %x2, align 8, !tbaa !5
%sub = fsub double %0, %1
%2 = load double, ptr %y1, align 8, !tbaa !5
%3 = load double, ptr %y2, align 8, !tbaa !5
%sub2 = fsub double %2, %3
%mul4 = fmul double %sub2, %sub2
%4 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul4)
%sqrt = call double @llvm.sqrt.f64(double %4)
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
int main(void){
double x1,y1,x2,y2;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
printf("%f\n",sqrt(pow(x2-x1,2) + pow(y2-y1,2)) );
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250268/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250268/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x2, align 8, !tbaa !5
%1 = load double, ptr %x1, align 8, !tbaa !5
%2 = load double, ptr %y2, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %2, i64 1
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %3, i64 1
%8 = fsub <2 x double> %5, %7
%9 = fmul <2 x double> %8, %8
%shift = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%10 = fadd <2 x double> %9, %shift
%add = extractelement <2 x double> %10, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
int main (void) {
double x1,x2,y1,y2;
scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
printf("%lf",sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250310/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250310/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%x2 = alloca double, align 8
%y1 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x1, align 8, !tbaa !5
%1 = load double, ptr %x2, align 8, !tbaa !5
%sub = fsub double %0, %1
%2 = load double, ptr %y1, align 8, !tbaa !5
%3 = load double, ptr %y2, align 8, !tbaa !5
%sub2 = fsub double %2, %3
%mul4 = fmul double %sub2, %sub2
%4 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul4)
%sqrt = call double @llvm.sqrt.f64(double %4)
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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 double @llvm.sqrt.f64(double) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
int main(void) {
double x1 = 0;
double y1 = 0;
double x2 = 0;
double y2 = 0;
scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
double result = sqrt(pow(fabs(x1 - x2),2) + pow(fabs(y1 - y2),2));
printf("%lf", result);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250354/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250354/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4
store double 0.000000e+00, ptr %x1, align 8, !tbaa !5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4
store double 0.000000e+00, ptr %y1, align 8, !tbaa !5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4
store double 0.000000e+00, ptr %x2, align 8, !tbaa !5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #4
store double 0.000000e+00, ptr %y2, align 8, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x1, align 8, !tbaa !5
%1 = load double, ptr %x2, align 8, !tbaa !5
%2 = load double, ptr %y1, align 8, !tbaa !5
%3 = load double, ptr %y2, align 8, !tbaa !5
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %2, i64 1
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %3, i64 1
%8 = fsub <2 x double> %5, %7
%9 = fmul <2 x double> %8, %8
%shift = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%10 = fadd <2 x double> %9, %shift
%add = extractelement <2 x double> %10, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
int main()
{
double x1, y1, x2, y2;
scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2);
printf("%.8lf\n", hypot(x1-x2, y1-y2));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250398/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250398/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf%lf%lf%lf\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%.8lf\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x1, align 8, !tbaa !5
%1 = load double, ptr %x2, align 8, !tbaa !5
%sub = fsub double %0, %1
%2 = load double, ptr %y1, align 8, !tbaa !5
%3 = load double, ptr %y2, align 8, !tbaa !5
%sub1 = fsub double %2, %3
%call2 = call double @hypot(double noundef %sub, double noundef %sub1) #4
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %call2)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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: nounwind
declare double @hypot(double noundef, double noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 "no-trapping-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"}
|
#include <stdio.h>
#include <math.h>
int main(void)
{
double x1;
double x2;
double y1;
double y2;
//座標を入力する
scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2);
//結果を出力する
printf("%lf\n", sqrt(pow((x2 - x1), 2) + pow((y2 - y1), 2)));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250440/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250440/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf%lf%lf%lf\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%x2 = alloca double, align 8
%y1 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x2, align 8, !tbaa !5
%1 = load double, ptr %x1, align 8, !tbaa !5
%2 = load double, ptr %y2, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %2, i64 1
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %3, i64 1
%8 = fsub <2 x double> %5, %7
%9 = fmul <2 x double> %8, %8
%shift = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%10 = fadd <2 x double> %9, %shift
%add = extractelement <2 x double> %10, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add)
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
int main(){
double x, y, x1, y1, x2, y2;
scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
x = x2 - x1;
y = y2 - y1;
printf("%f\n", sqrt(x * x + y * y));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250484/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250484/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x2, align 8, !tbaa !5
%1 = load double, ptr %x1, align 8, !tbaa !5
%sub = fsub double %0, %1
%2 = load double, ptr %y2, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%sub1 = fsub double %2, %3
%mul2 = fmul double %sub1, %sub1
%4 = call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul2)
%sqrt = call double @llvm.sqrt.f64(double %4)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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 double @llvm.sqrt.f64(double) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void)
{
int kukan[10], a1, a2, sum, i, sure, surea;
while(scanf( "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &kukan[0], &kukan[1], &kukan[2], &kukan[3],
&kukan[4], &kukan[5], &kukan[6], &kukan[7], &kukan[8], &kukan[9],
&a1, &a2) != EOF) {
sum = 0;
for(i = 0; i < 10; i++){
sum += kukan[i];
}
sure = sum * a1 / (a1 + a2);
surea = sum * a1 % (a1 + a2);
sum = 0;
for(i = 0 ; i < 10; i++){
sum += kukan[i];
if(sure < sum) break;
else if(sure == sum) {
if(kukan[i] > kukan[i+1] || surea > 0)
i = i + 1;
break;
}
}
printf( "%d\n", i + 1 );
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250534/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250534/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [36 x i8] c"%d,%d,%d,%d,%d,%d,%d,%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:
%kukan = alloca [10 x i32], align 16
%a1 = alloca i32, align 4
%a2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %kukan) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a2) #3
%arrayidx1 = getelementptr inbounds [10 x i32], ptr %kukan, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [10 x i32], ptr %kukan, i64 0, i64 2
%arrayidx3 = getelementptr inbounds [10 x i32], ptr %kukan, i64 0, i64 3
%arrayidx4 = getelementptr inbounds [10 x i32], ptr %kukan, i64 0, i64 4
%arrayidx5 = getelementptr inbounds [10 x i32], ptr %kukan, i64 0, i64 5
%arrayidx6 = getelementptr inbounds [10 x i32], ptr %kukan, i64 0, i64 6
%arrayidx7 = getelementptr inbounds [10 x i32], ptr %kukan, i64 0, i64 7
%arrayidx8 = getelementptr inbounds [10 x i32], ptr %kukan, i64 0, i64 8
%arrayidx9 = getelementptr inbounds [10 x i32], ptr %kukan, i64 0, i64 9
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %kukan, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx6, ptr noundef nonnull %arrayidx7, ptr noundef nonnull %arrayidx8, ptr noundef nonnull %arrayidx9, ptr noundef nonnull %a1, ptr noundef nonnull %a2)
%cmp.not61 = icmp eq i32 %call60, -1
br i1 %cmp.not61, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end37
%0 = load i32, ptr %kukan, align 16, !tbaa !5
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%add.1 = add nsw i32 %1, %0
%2 = load i32, ptr %arrayidx2, align 8, !tbaa !5
%add.2 = add nsw i32 %2, %add.1
%3 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%add.3 = add nsw i32 %3, %add.2
%4 = load i32, ptr %arrayidx4, align 16, !tbaa !5
%add.4 = add nsw i32 %4, %add.3
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%add.5 = add nsw i32 %5, %add.4
%6 = load i32, ptr %arrayidx6, align 8, !tbaa !5
%add.6 = add nsw i32 %6, %add.5
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add.7 = add nsw i32 %7, %add.6
%8 = load i32, ptr %arrayidx8, align 16, !tbaa !5
%add.8 = add nsw i32 %8, %add.7
%9 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%add.9 = add nsw i32 %9, %add.8
%10 = load i32, ptr %a1, align 4, !tbaa !5
%mul = mul nsw i32 %10, %add.9
%11 = load i32, ptr %a2, align 4, !tbaa !5
%add12 = add nsw i32 %11, %10
%div = sdiv i32 %mul, %add12
%rem = srem i32 %mul, %add12
%cmp21 = icmp slt i32 %div, %0
br i1 %cmp21, label %for.end37, label %if.else
if.else: ; preds = %for.cond.preheader
%cmp22 = icmp eq i32 %div, %0
br i1 %cmp22, label %if.then23, label %for.inc35
if.then23: ; preds = %if.else.9, %if.else.8, %if.else.7, %if.else.6, %if.else.5, %if.else.4, %if.else.3, %if.else.2, %if.else.1, %if.else
%i.158.lcssa63.wide = phi i32 [ 0, %if.else ], [ 1, %if.else.1 ], [ 2, %if.else.2 ], [ 3, %if.else.3 ], [ 4, %if.else.4 ], [ 5, %if.else.5 ], [ 6, %if.else.6 ], [ 7, %if.else.7 ], [ 8, %if.else.8 ], [ 9, %if.else.9 ]
%.lcssa62 = phi i32 [ %0, %if.else ], [ %1, %if.else.1 ], [ %2, %if.else.2 ], [ %3, %if.else.3 ], [ %4, %if.else.4 ], [ %5, %if.else.5 ], [ %6, %if.else.6 ], [ %7, %if.else.7 ], [ %8, %if.else.8 ], [ %9, %if.else.9 ]
%add26 = add nuw nsw i32 %i.158.lcssa63.wide, 1
%idxprom27 = zext i32 %add26 to i64
%arrayidx28 = getelementptr inbounds [10 x i32], ptr %kukan, i64 0, i64 %idxprom27
%12 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %.lcssa62, %12
%cmp30 = icmp sgt i32 %rem, 0
%or.cond = or i1 %cmp29, %cmp30
%spec.select = select i1 %or.cond, i32 %add26, i32 %i.158.lcssa63.wide
br label %for.end37
for.inc35: ; preds = %if.else
%cmp21.1 = icmp slt i32 %div, %add.1
br i1 %cmp21.1, label %for.end37, label %if.else.1
if.else.1: ; preds = %for.inc35
%cmp22.1 = icmp eq i32 %div, %add.1
br i1 %cmp22.1, label %if.then23, label %for.inc35.1
for.inc35.1: ; preds = %if.else.1
%cmp21.2 = icmp slt i32 %div, %add.2
br i1 %cmp21.2, label %for.end37, label %if.else.2
if.else.2: ; preds = %for.inc35.1
%cmp22.2 = icmp eq i32 %div, %add.2
br i1 %cmp22.2, label %if.then23, label %for.inc35.2
for.inc35.2: ; preds = %if.else.2
%cmp21.3 = icmp slt i32 %div, %add.3
br i1 %cmp21.3, label %for.end37, label %if.else.3
if.else.3: ; preds = %for.inc35.2
%cmp22.3 = icmp eq i32 %div, %add.3
br i1 %cmp22.3, label %if.then23, label %for.inc35.3
for.inc35.3: ; preds = %if.else.3
%cmp21.4 = icmp slt i32 %div, %add.4
br i1 %cmp21.4, label %for.end37, label %if.else.4
if.else.4: ; preds = %for.inc35.3
%cmp22.4 = icmp eq i32 %div, %add.4
br i1 %cmp22.4, label %if.then23, label %for.inc35.4
for.inc35.4: ; preds = %if.else.4
%cmp21.5 = icmp slt i32 %div, %add.5
br i1 %cmp21.5, label %for.end37, label %if.else.5
if.else.5: ; preds = %for.inc35.4
%cmp22.5 = icmp eq i32 %div, %add.5
br i1 %cmp22.5, label %if.then23, label %for.inc35.5
for.inc35.5: ; preds = %if.else.5
%cmp21.6 = icmp slt i32 %div, %add.6
br i1 %cmp21.6, label %for.end37, label %if.else.6
if.else.6: ; preds = %for.inc35.5
%cmp22.6 = icmp eq i32 %div, %add.6
br i1 %cmp22.6, label %if.then23, label %for.inc35.6
for.inc35.6: ; preds = %if.else.6
%cmp21.7 = icmp slt i32 %div, %add.7
br i1 %cmp21.7, label %for.end37, label %if.else.7
if.else.7: ; preds = %for.inc35.6
%cmp22.7 = icmp eq i32 %div, %add.7
br i1 %cmp22.7, label %if.then23, label %for.inc35.7
for.inc35.7: ; preds = %if.else.7
%cmp21.8 = icmp slt i32 %div, %add.8
br i1 %cmp21.8, label %for.end37, label %if.else.8
if.else.8: ; preds = %for.inc35.7
%cmp22.8 = icmp eq i32 %div, %add.8
br i1 %cmp22.8, label %if.then23, label %for.inc35.8
for.inc35.8: ; preds = %if.else.8
%cmp21.9 = icmp slt i32 %div, %add.9
br i1 %cmp21.9, label %for.end37, label %if.else.9
if.else.9: ; preds = %for.inc35.8
%cmp22.9 = icmp eq i32 %div, %add.9
br i1 %cmp22.9, label %if.then23, label %for.end37
for.end37: ; preds = %for.cond.preheader, %for.inc35, %for.inc35.1, %for.inc35.2, %for.inc35.3, %for.inc35.4, %for.inc35.5, %for.inc35.6, %for.inc35.7, %for.inc35.8, %if.else.9, %if.then23
%i.2 = phi i32 [ %spec.select, %if.then23 ], [ 0, %for.cond.preheader ], [ 1, %for.inc35 ], [ 2, %for.inc35.1 ], [ 3, %for.inc35.2 ], [ 4, %for.inc35.3 ], [ 5, %for.inc35.4 ], [ 6, %for.inc35.5 ], [ 7, %for.inc35.6 ], [ 8, %for.inc35.7 ], [ 9, %for.inc35.8 ], [ 10, %if.else.9 ]
%add38 = add nuw nsw i32 %i.2, 1
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add38)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %kukan, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx6, ptr noundef nonnull %arrayidx7, ptr noundef nonnull %arrayidx8, ptr noundef nonnull %arrayidx9, ptr noundef nonnull %a1, ptr noundef nonnull %a2)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !9
while.end: ; preds = %for.end37, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a1) #3
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %kukan) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(int argc,char* argv[]){
int len[10];
int v_1,v_2,i;
int sum;
double time;
while(scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",&len[0],&len[1],&len[2],&len[3],&len[4],&len[5],&len[6],&len[7],&len[8],&len[9],&v_1,&v_2) != EOF){
sum = 0;
for(i = 0;i < 10;i++){
sum += len[i];
}
time = (double)(sum)/(v_1 + v_2);
sum = 0;
for(i = 0;i < 10;i++){
sum += len[i];
if(sum >= (v_1 * time)){
printf("%d\n",i+1);
break;
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250585/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250585/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [36 x i8] c"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%len = alloca [10 x i32], align 16
%v_1 = alloca i32, align 4
%v_2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %len) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v_1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v_2) #3
%arrayidx1 = getelementptr inbounds [10 x i32], ptr %len, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [10 x i32], ptr %len, i64 0, i64 2
%arrayidx3 = getelementptr inbounds [10 x i32], ptr %len, i64 0, i64 3
%arrayidx4 = getelementptr inbounds [10 x i32], ptr %len, i64 0, i64 4
%arrayidx5 = getelementptr inbounds [10 x i32], ptr %len, i64 0, i64 5
%arrayidx6 = getelementptr inbounds [10 x i32], ptr %len, i64 0, i64 6
%arrayidx7 = getelementptr inbounds [10 x i32], ptr %len, i64 0, i64 7
%arrayidx8 = getelementptr inbounds [10 x i32], ptr %len, i64 0, i64 8
%arrayidx9 = getelementptr inbounds [10 x i32], ptr %len, i64 0, i64 9
%call44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %len, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx6, ptr noundef nonnull %arrayidx7, ptr noundef nonnull %arrayidx8, ptr noundef nonnull %arrayidx9, ptr noundef nonnull %v_1, ptr noundef nonnull %v_2)
%cmp.not45 = icmp eq i32 %call44, -1
br i1 %cmp.not45, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end29
%0 = load i32, ptr %len, align 16, !tbaa !5
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%add.1 = add nsw i32 %1, %0
%2 = load i32, ptr %arrayidx2, align 8, !tbaa !5
%add.2 = add nsw i32 %2, %add.1
%3 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%add.3 = add nsw i32 %3, %add.2
%4 = load i32, ptr %arrayidx4, align 16, !tbaa !5
%add.4 = add nsw i32 %4, %add.3
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%add.5 = add nsw i32 %5, %add.4
%6 = load i32, ptr %arrayidx6, align 8, !tbaa !5
%add.6 = add nsw i32 %6, %add.5
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%add.7 = add nsw i32 %7, %add.6
%8 = load i32, ptr %arrayidx8, align 16, !tbaa !5
%add.8 = add nsw i32 %8, %add.7
%9 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%add.9 = add nsw i32 %9, %add.8
%conv = sitofp i32 %add.9 to double
%10 = load i32, ptr %v_1, align 4, !tbaa !5
%11 = load i32, ptr %v_2, align 4, !tbaa !5
%add12 = add nsw i32 %11, %10
%conv13 = sitofp i32 %add12 to double
%div = fdiv double %conv, %conv13
%conv22 = sitofp i32 %10 to double
%mul = fmul double %div, %conv22
%conv21 = sitofp i32 %0 to double
%cmp23 = fcmp ugt double %mul, %conv21
br i1 %cmp23, label %for.inc27, label %if.then
if.then: ; preds = %for.inc27.8, %for.inc27.7, %for.inc27.6, %for.inc27.5, %for.inc27.4, %for.inc27.3, %for.inc27.2, %for.inc27.1, %for.inc27, %for.cond.preheader
%i.143.lcssa.wide = phi i32 [ 1, %for.cond.preheader ], [ 2, %for.inc27 ], [ 3, %for.inc27.1 ], [ 4, %for.inc27.2 ], [ 5, %for.inc27.3 ], [ 6, %for.inc27.4 ], [ 7, %for.inc27.5 ], [ 8, %for.inc27.6 ], [ 9, %for.inc27.7 ], [ 10, %for.inc27.8 ]
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.143.lcssa.wide)
br label %for.end29
for.inc27: ; preds = %for.cond.preheader
%conv21.1 = sitofp i32 %add.1 to double
%cmp23.1 = fcmp ugt double %mul, %conv21.1
br i1 %cmp23.1, label %for.inc27.1, label %if.then
for.inc27.1: ; preds = %for.inc27
%conv21.2 = sitofp i32 %add.2 to double
%cmp23.2 = fcmp ugt double %mul, %conv21.2
br i1 %cmp23.2, label %for.inc27.2, label %if.then
for.inc27.2: ; preds = %for.inc27.1
%conv21.3 = sitofp i32 %add.3 to double
%cmp23.3 = fcmp ugt double %mul, %conv21.3
br i1 %cmp23.3, label %for.inc27.3, label %if.then
for.inc27.3: ; preds = %for.inc27.2
%conv21.4 = sitofp i32 %add.4 to double
%cmp23.4 = fcmp ugt double %mul, %conv21.4
br i1 %cmp23.4, label %for.inc27.4, label %if.then
for.inc27.4: ; preds = %for.inc27.3
%conv21.5 = sitofp i32 %add.5 to double
%cmp23.5 = fcmp ugt double %mul, %conv21.5
br i1 %cmp23.5, label %for.inc27.5, label %if.then
for.inc27.5: ; preds = %for.inc27.4
%conv21.6 = sitofp i32 %add.6 to double
%cmp23.6 = fcmp ugt double %mul, %conv21.6
br i1 %cmp23.6, label %for.inc27.6, label %if.then
for.inc27.6: ; preds = %for.inc27.5
%conv21.7 = sitofp i32 %add.7 to double
%cmp23.7 = fcmp ugt double %mul, %conv21.7
br i1 %cmp23.7, label %for.inc27.7, label %if.then
for.inc27.7: ; preds = %for.inc27.6
%conv21.8 = sitofp i32 %add.8 to double
%cmp23.8 = fcmp ugt double %mul, %conv21.8
br i1 %cmp23.8, label %for.inc27.8, label %if.then
for.inc27.8: ; preds = %for.inc27.7
%cmp23.9 = fcmp ugt double %mul, %conv
br i1 %cmp23.9, label %for.end29, label %if.then
for.end29: ; preds = %for.inc27.8, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %len, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx6, ptr noundef nonnull %arrayidx7, ptr noundef nonnull %arrayidx8, ptr noundef nonnull %arrayidx9, ptr noundef nonnull %v_1, ptr noundef nonnull %v_2)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !9
while.end: ; preds = %for.end29, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v_2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v_1) #3
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %len) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int a[10];
int sum;
int v[2];
int i, j;
float time;
while (scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", a, a+1, a+2, a+3, a+4, a+5, a+6, a+7, a+8, a+9, v, v+1) != EOF){
sum = 0;
for (i = 0; i < 10; i++){
sum += a[i];
}
time = 0;
for (i = 0; i < 10; i++){
sum -= a[i];
time += (float)a[i] / v[0];
if (v[1] * time >= sum){
printf("%d\n", i + 1);
break;
}
}
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250628/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250628/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [36 x i8] c"%d,%d,%d,%d,%d,%d,%d,%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 [10 x i32], align 16
%v = alloca [2 x i32], align 4
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %v) #3
%add.ptr = getelementptr inbounds i32, ptr %a, i64 1
%add.ptr3 = getelementptr inbounds i32, ptr %a, i64 2
%add.ptr5 = getelementptr inbounds i32, ptr %a, i64 3
%add.ptr7 = getelementptr inbounds i32, ptr %a, i64 4
%add.ptr9 = getelementptr inbounds i32, ptr %a, i64 5
%add.ptr11 = getelementptr inbounds i32, ptr %a, i64 6
%add.ptr13 = getelementptr inbounds i32, ptr %a, i64 7
%add.ptr15 = getelementptr inbounds i32, ptr %a, i64 8
%add.ptr17 = getelementptr inbounds i32, ptr %a, i64 9
%add.ptr20 = getelementptr inbounds i32, ptr %v, i64 1
%call58 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %add.ptr, ptr noundef nonnull %add.ptr3, ptr noundef nonnull %add.ptr5, ptr noundef nonnull %add.ptr7, ptr noundef nonnull %add.ptr9, ptr noundef nonnull %add.ptr11, ptr noundef nonnull %add.ptr13, ptr noundef nonnull %add.ptr15, ptr noundef nonnull %add.ptr17, ptr noundef nonnull %v, ptr noundef nonnull %add.ptr20)
%cmp.not59 = icmp eq i32 %call58, -1
br i1 %cmp.not59, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end41
%0 = load i32, ptr %a, align 16, !tbaa !5
%1 = load i32, ptr %add.ptr, align 4, !tbaa !5
%add.1 = add nsw i32 %1, %0
%2 = load i32, ptr %add.ptr3, align 8, !tbaa !5
%add.2 = add nsw i32 %2, %add.1
%3 = load i32, ptr %add.ptr5, align 4, !tbaa !5
%add.3 = add nsw i32 %3, %add.2
%4 = load i32, ptr %add.ptr7, align 16, !tbaa !5
%add.4 = add nsw i32 %4, %add.3
%5 = load i32, ptr %add.ptr9, align 4, !tbaa !5
%add.5 = add nsw i32 %5, %add.4
%6 = load i32, ptr %add.ptr11, align 8, !tbaa !5
%add.6 = add nsw i32 %6, %add.5
%7 = load i32, ptr %add.ptr13, align 4, !tbaa !5
%add.7 = add nsw i32 %7, %add.6
%8 = load i32, ptr %add.ptr15, align 16, !tbaa !5
%add.8 = add nsw i32 %8, %add.7
%9 = load i32, ptr %add.ptr17, align 4, !tbaa !5
%add.9 = add nsw i32 %9, %add.8
%10 = load i32, ptr %v, align 4, !tbaa !5
%conv30 = sitofp i32 %10 to float
%11 = load i32, ptr %add.ptr20, align 4, !tbaa !5
%conv33 = sitofp i32 %11 to float
%sub = sub nsw i32 %add.9, %0
%conv = sitofp i32 %0 to float
%div = fdiv float %conv, %conv30
%add31 = fadd float %div, 0.000000e+00
%mul = fmul float %add31, %conv33
%conv34 = sitofp i32 %sub to float
%cmp35 = fcmp ult float %mul, %conv34
br i1 %cmp35, label %for.inc39, label %if.then
if.then: ; preds = %for.inc39.8, %for.inc39.7, %for.inc39.6, %for.inc39.5, %for.inc39.4, %for.inc39.3, %for.inc39.2, %for.inc39.1, %for.inc39, %for.cond.preheader
%i.155.lcssa.wide = phi i32 [ 1, %for.cond.preheader ], [ 2, %for.inc39 ], [ 3, %for.inc39.1 ], [ 4, %for.inc39.2 ], [ 5, %for.inc39.3 ], [ 6, %for.inc39.4 ], [ 7, %for.inc39.5 ], [ 8, %for.inc39.6 ], [ 9, %for.inc39.7 ], [ 10, %for.inc39.8 ]
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.155.lcssa.wide)
br label %for.end41
for.inc39: ; preds = %for.cond.preheader
%sub.1 = sub nsw i32 %sub, %1
%conv.1 = sitofp i32 %1 to float
%div.1 = fdiv float %conv.1, %conv30
%add31.1 = fadd float %add31, %div.1
%mul.1 = fmul float %add31.1, %conv33
%conv34.1 = sitofp i32 %sub.1 to float
%cmp35.1 = fcmp ult float %mul.1, %conv34.1
br i1 %cmp35.1, label %for.inc39.1, label %if.then
for.inc39.1: ; preds = %for.inc39
%sub.2 = sub nsw i32 %sub.1, %2
%conv.2 = sitofp i32 %2 to float
%div.2 = fdiv float %conv.2, %conv30
%add31.2 = fadd float %add31.1, %div.2
%mul.2 = fmul float %add31.2, %conv33
%conv34.2 = sitofp i32 %sub.2 to float
%cmp35.2 = fcmp ult float %mul.2, %conv34.2
br i1 %cmp35.2, label %for.inc39.2, label %if.then
for.inc39.2: ; preds = %for.inc39.1
%sub.3 = sub nsw i32 %sub.2, %3
%conv.3 = sitofp i32 %3 to float
%div.3 = fdiv float %conv.3, %conv30
%add31.3 = fadd float %add31.2, %div.3
%mul.3 = fmul float %add31.3, %conv33
%conv34.3 = sitofp i32 %sub.3 to float
%cmp35.3 = fcmp ult float %mul.3, %conv34.3
br i1 %cmp35.3, label %for.inc39.3, label %if.then
for.inc39.3: ; preds = %for.inc39.2
%sub.4 = sub nsw i32 %sub.3, %4
%conv.4 = sitofp i32 %4 to float
%div.4 = fdiv float %conv.4, %conv30
%add31.4 = fadd float %add31.3, %div.4
%mul.4 = fmul float %add31.4, %conv33
%conv34.4 = sitofp i32 %sub.4 to float
%cmp35.4 = fcmp ult float %mul.4, %conv34.4
br i1 %cmp35.4, label %for.inc39.4, label %if.then
for.inc39.4: ; preds = %for.inc39.3
%sub.5 = sub nsw i32 %sub.4, %5
%conv.5 = sitofp i32 %5 to float
%div.5 = fdiv float %conv.5, %conv30
%add31.5 = fadd float %add31.4, %div.5
%mul.5 = fmul float %add31.5, %conv33
%conv34.5 = sitofp i32 %sub.5 to float
%cmp35.5 = fcmp ult float %mul.5, %conv34.5
br i1 %cmp35.5, label %for.inc39.5, label %if.then
for.inc39.5: ; preds = %for.inc39.4
%sub.6 = sub nsw i32 %sub.5, %6
%conv.6 = sitofp i32 %6 to float
%div.6 = fdiv float %conv.6, %conv30
%add31.6 = fadd float %add31.5, %div.6
%mul.6 = fmul float %add31.6, %conv33
%conv34.6 = sitofp i32 %sub.6 to float
%cmp35.6 = fcmp ult float %mul.6, %conv34.6
br i1 %cmp35.6, label %for.inc39.6, label %if.then
for.inc39.6: ; preds = %for.inc39.5
%sub.7 = sub nsw i32 %sub.6, %7
%conv.7 = sitofp i32 %7 to float
%div.7 = fdiv float %conv.7, %conv30
%add31.7 = fadd float %add31.6, %div.7
%mul.7 = fmul float %add31.7, %conv33
%conv34.7 = sitofp i32 %sub.7 to float
%cmp35.7 = fcmp ult float %mul.7, %conv34.7
br i1 %cmp35.7, label %for.inc39.7, label %if.then
for.inc39.7: ; preds = %for.inc39.6
%sub.8 = sub nsw i32 %sub.7, %8
%conv.8 = sitofp i32 %8 to float
%div.8 = fdiv float %conv.8, %conv30
%add31.8 = fadd float %add31.7, %div.8
%mul.8 = fmul float %add31.8, %conv33
%conv34.8 = sitofp i32 %sub.8 to float
%cmp35.8 = fcmp ult float %mul.8, %conv34.8
br i1 %cmp35.8, label %for.inc39.8, label %if.then
for.inc39.8: ; preds = %for.inc39.7
%sub.9 = sub nsw i32 %sub.8, %9
%conv.9 = sitofp i32 %9 to float
%div.9 = fdiv float %conv.9, %conv30
%add31.9 = fadd float %add31.8, %div.9
%mul.9 = fmul float %add31.9, %conv33
%conv34.9 = sitofp i32 %sub.9 to float
%cmp35.9 = fcmp ult float %mul.9, %conv34.9
br i1 %cmp35.9, label %for.end41, label %if.then
for.end41: ; preds = %for.inc39.8, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %add.ptr, ptr noundef nonnull %add.ptr3, ptr noundef nonnull %add.ptr5, ptr noundef nonnull %add.ptr7, ptr noundef nonnull %add.ptr9, ptr noundef nonnull %add.ptr11, ptr noundef nonnull %add.ptr13, ptr noundef nonnull %add.ptr15, ptr noundef nonnull %add.ptr17, ptr noundef nonnull %v, ptr noundef nonnull %add.ptr20)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !9
while.end: ; preds = %for.end41, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %v) #3
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#pragma warning(disable:4996)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>
#pragma region 定義
typedef long long ll;
typedef unsigned long long ull;
#define _itoa(A,N) sprintf(A, "%d", N);
int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);
int _gcd(int a, int b);
int _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);
int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);
//昇順
int s_asort(const void* a, const void* b) {
return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
return(strcmp((char*)b, (char*)a));
}
int i_dsort(const void* a, const void* b) {
return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
return(*(int*)a - *(int*)b);
}
int i_gcd(int a, int b);
int i_gcd(int a, int b) {
if (!b)return a;
return i_gcd(b, a % b);
}
int i_lcm(int a, int b);
int i_lcm(int a, int b) {
return (a * b) / i_gcd(a, b);
}
int ll_gcd(ll a, ll b);
int ll_gcd(ll a, ll b) {
if (!b)return a;
return ll_gcd(b, a % b);
}
int ll_lcm(ll a, ll b);
int ll_lcm(ll a, ll b) {
return (a * b) / ll_gcd(a, b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数2つで得る
//#define pai 3.1415926535
//#define _USE_MATH_DEFINES でM_PIが使える
#define deg_rad(X) (X*(M_PI/180))
int _swp(int* a, int* b)
{
int tmp;
tmp = *b; *b = *a; *a = tmp;
return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))
int _cknum(char* a, int n) {
int i;
char t = '0';
for (i = 0; i < n; i++) {
if (a[i] < '0' || a[i]>'9') return 1;
}
return 0;
}
int _atoi(char* s, int len) {
char tmp[20];
memcpy(tmp, s, len);
tmp[len] = 0x00;
return (atoi(tmp));
}
//素因数分解 pf素数が入る pc 素数の数
//ll _pfact(ll a);
//static ll pf[100000000];
//static ll pc;
//
//ll _pfact(ll a) {
// long i, r;
// if (a % 2 == 0) {
// pf[pc] = 2; pc++;
// return(_pfact(a / 2));
// }
// r = sqrt(a);
// for (i = 3; i <= r; i += 2) {
// if (a % i == 0) {
// pf[pc] = i; pc++;
// return(_pfact(a / i));
// }
// }
// if (a != 1) {
// pf[pc] = a; pc++;
// }
// return 0;
//
//}
//同じものの最初の文字をNULLにして降順
int _sort(const void* a, const void* b);
int _sort(const void* a, const void* b) {
char rc;
rc = strcmp((char*)b, (char*)a);
if (rc == 0) {
*(char*)a = 0x00;
return(1);
}
return(rc);
}
// 立っている ビットの数
int bitcount(unsigned int uc);
int bitcount(unsigned int uc)
{
int bit;
for (bit = 0; 0 != uc; uc = (unsigned int)(uc >> 1))
if (0 != (uc & 1))++bit;
return bit;
}//bitco
//10進数の桁数の総和
int _sumdig(int n);
int _sumdig(int n) {
int sum = 0;
while (n > 0) { sum += n % 10;n /= 10;}
return(sum);
}
#define _rnd(a,b) ((a+b-1)/b) // A/Bの余りを繰り上げる
#define _abs(x) ((x)<0 ? -(x) : (x))
#define _MAX 200000
#pragma endregion
// ABC145 C - Average Length
//int main(void) {
// int n,i, x[9],y[9],cnt=0;
// double sum=0;
//
// scanf("%d", &n);
// for (i = 0; i < n; i++)
// scanf("%d %d", &x[i], &y[i]);
//
// for(i=0;i<n-1;i++)
// for (int j = i + 1; j < n; j++) {
// sum += hypot(x[i] - x[j], y[i] - y[j]);
// cnt++;
// printf("%d %lf\n", cnt, sum);
// }
// printf("%lf\n",sum/cnt);
// return 0;
//}
//
int popnum(int* a, int n);
int popnum(int* a, int n) {
int cnt = 0;
for (int i = 0; i < n; i++) {
cnt += *(a + i);
}
return cnt;
}
static int c[10001];
int main(void) {
int n;
scanf("%d", &n);
ll tmp;
int nn;
nn = sqrt(n);
for (int i = 1; i < nn; i++) {
for (int j = 1; j < nn; j++) {
for (int k = 1; k < nn; k++) {
tmp = i * i + j * j + k * k + i * j + i * k + k * j;
if (tmp > n)continue;
c[tmp]++;
}
}
}
for(int i=1;i<=n;i++)
printf("%d\n",c[i]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250679/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250679/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@c = internal unnamed_addr global [10001 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_asort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #15
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_dsort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #15
ret i32 %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @i_dsort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @i_asort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @i_gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4 = icmp eq i32 %b, 0
br i1 %tobool.not4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%b.tr6 = phi i32 [ %rem, %if.end ], [ %b, %entry ]
%a.tr5 = phi i32 [ %b.tr6, %if.end ], [ %a, %entry ]
%rem = srem i32 %a.tr5, %b.tr6
%tobool.not = icmp eq i32 %rem, 0
br i1 %tobool.not, label %return, label %if.end
return: ; preds = %if.end, %entry
%a.tr.lcssa = phi i32 [ %a, %entry ], [ %b.tr6, %if.end ]
ret i32 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @i_lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4.i = icmp eq i32 %b, 0
br i1 %tobool.not4.i, label %i_gcd.exit, label %if.end.i
if.end.i: ; preds = %entry, %if.end.i
%b.tr6.i = phi i32 [ %rem.i, %if.end.i ], [ %b, %entry ]
%a.tr5.i = phi i32 [ %b.tr6.i, %if.end.i ], [ %a, %entry ]
%rem.i = srem i32 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i32 %rem.i, 0
br i1 %tobool.not.i, label %i_gcd.exit, label %if.end.i
i_gcd.exit: ; preds = %if.end.i, %entry
%a.tr.lcssa.i = phi i32 [ %a, %entry ], [ %b.tr6.i, %if.end.i ]
%mul = mul nsw i32 %b, %a
%div = sdiv i32 %mul, %a.tr.lcssa.i
ret i32 %div
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @ll_gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4 = icmp eq i64 %b, 0
br i1 %tobool.not4, label %if.then, label %if.end
if.then: ; preds = %if.end, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %if.end ]
%conv = trunc i64 %a.tr.lcssa to i32
ret i32 %conv
if.end: ; preds = %entry, %if.end
%b.tr6 = phi i64 [ %rem, %if.end ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %if.end ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %if.then, label %if.end
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @ll_lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%tobool.not4.i = icmp eq i64 %b, 0
br i1 %tobool.not4.i, label %ll_gcd.exit, label %if.end.i
if.end.i: ; preds = %entry, %if.end.i
%b.tr6.i = phi i64 [ %rem.i, %if.end.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %if.end.i ], [ %a, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%tobool.not.i = icmp eq i64 %rem.i, 0
br i1 %tobool.not.i, label %ll_gcd.exit, label %if.end.i
ll_gcd.exit: ; preds = %if.end.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %if.end.i ]
%mul = mul nsw i64 %b, %a
%sext = shl i64 %a.tr.lcssa.i, 32
%conv = ashr exact i64 %sext, 32
%div = sdiv i64 %mul, %conv
%conv1 = trunc i64 %div to i32
ret i32 %conv1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @_swp(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
store i32 %1, ptr %b, align 4, !tbaa !5
store i32 %0, ptr %a, align 4, !tbaa !5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #5
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @_cknum(ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #6 {
entry:
%cmp13 = icmp sgt i32 %n, 0
br i1 %cmp13, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !9
for.body: ; preds = %for.body.preheader, %for.cond
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds i8, ptr %a, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !11
%1 = add i8 %0, -58
%or.cond = icmp ult i8 %1, -10
br i1 %or.cond, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn uwtable
define dso_local i32 @_atoi(ptr nocapture noundef readonly %s, i32 noundef %len) local_unnamed_addr #7 {
entry:
%tmp = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %tmp) #16
%conv = sext i32 %len to i64
call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %tmp, ptr align 1 %s, i64 %conv, i1 false)
%arrayidx = getelementptr inbounds [20 x i8], ptr %tmp, i64 0, i64 %conv
store i8 0, ptr %arrayidx, align 1, !tbaa !11
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %tmp, ptr noundef null, i32 noundef 10) #16
%conv.i = trunc i64 %call.i to i32
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %tmp) #16
ret i32 %conv.i
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #8
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local i32 @_sort(ptr nocapture noundef %a, ptr nocapture noundef readonly %b) local_unnamed_addr #9 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #15
%sext = shl i32 %call, 24
%cmp = icmp eq i32 %sext, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i8 0, ptr %a, align 1, !tbaa !11
br label %cleanup
if.end: ; preds = %entry
%conv1 = ashr exact i32 %sext, 24
br label %cleanup
cleanup: ; preds = %if.end, %if.then
%retval.0 = phi i32 [ 1, %if.then ], [ %conv1, %if.end ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @bitcount(i32 noundef %uc) local_unnamed_addr #3 {
entry:
%cmp.not5 = icmp eq i32 %uc, 0
br i1 %cmp.not5, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%bit.07 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%uc.addr.06 = phi i32 [ %shr, %for.body ], [ %uc, %entry ]
%and = and i32 %uc.addr.06, 1
%spec.select = add i32 %bit.07, %and
%shr = lshr i32 %uc.addr.06, 1
%cmp.not = icmp ult i32 %uc.addr.06, 2
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body, %entry
%bit.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ]
ret i32 %bit.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @_sumdig(i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp4 = icmp sgt i32 %n, 0
br i1 %cmp4, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%sum.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%n.addr.05 = phi i32 [ %div, %while.body ], [ %n, %entry ]
%rem = urem i32 %n.addr.05, 10
%add = add nuw nsw i32 %sum.06, %rem
%div = udiv i32 %n.addr.05, 10
%cmp.not = icmp ult i32 %n.addr.05, 10
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %while.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %sum.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @popnum(ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #6 {
entry:
%cmp4 = icmp sgt i32 %n, 0
br i1 %cmp4, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader10, 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 ], [ %2, %vector.body ]
%vec.phi8 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i32, ptr %a, i64 %index
%wide.load = load <4 x i32>, ptr %0, align 4, !tbaa !5
%1 = getelementptr inbounds i32, ptr %0, i64 4
%wide.load9 = load <4 x i32>, ptr %1, align 4, !tbaa !5
%2 = add <4 x i32> %wide.load, %vec.phi
%3 = add <4 x i32> %wide.load9, %vec.phi8
%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 !14
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %3, %2
%5 = tail 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.preheader10
for.body.preheader10: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%cnt.05.ph = phi i32 [ 0, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %5, %middle.block ], [ %add, %for.body ]
ret i32 %cnt.0.lcssa
for.body: ; preds = %for.body.preheader10, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader10 ]
%cnt.05 = phi i32 [ %add, %for.body ], [ %cnt.05.ph, %for.body.preheader10 ]
%add.ptr = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%6 = load i32, ptr %add.ptr, align 4, !tbaa !5
%add = add nsw i32 %6, %cnt.05
%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 !17
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #10 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #16
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%call1 = call double @sqrt(double noundef %conv) #16
%conv2 = fptosi double %call1 to i32
%cmp72 = icmp sgt i32 %conv2, 1
%.pre = load i32, ptr %n, align 4
br i1 %cmp72, label %for.cond4.preheader.lr.ph, label %for.cond35.preheader
for.cond4.preheader.lr.ph: ; preds = %entry
%wide.trip.count = zext i32 %conv2 to i64
%1 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %1, 1
%2 = icmp eq i32 %conv2, 2
%unroll_iter = and i64 %1, -2
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond4.preheader.us
for.cond4.preheader.us: ; preds = %for.cond4.for.cond.cleanup7_crit_edge.split.us.us, %for.cond4.preheader.lr.ph
%i.073.us = phi i32 [ 1, %for.cond4.preheader.lr.ph ], [ %inc32.us, %for.cond4.for.cond.cleanup7_crit_edge.split.us.us ]
%mul.us = mul nsw i32 %i.073.us, %i.073.us
br label %for.cond9.preheader.us.us
for.cond9.preheader.us.us: ; preds = %for.cond9.for.cond.cleanup12_crit_edge.us.us, %for.cond4.preheader.us
%j.071.us.us = phi i32 [ 1, %for.cond4.preheader.us ], [ %inc29.us.us, %for.cond9.for.cond.cleanup12_crit_edge.us.us ]
%reass.add.us.us = add nuw i32 %j.071.us.us, %i.073.us
%reass.mul67.us.us = mul i32 %reass.add.us.us, %j.071.us.us
%add20.us.us = add i32 %reass.mul67.us.us, %mul.us
br i1 %2, label %for.cond9.for.cond.cleanup12_crit_edge.us.us.unr-lcssa, label %for.body13.us.us
for.body13.us.us: ; preds = %for.cond9.preheader.us.us, %for.inc.us.us.1
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.inc.us.us.1 ], [ 1, %for.cond9.preheader.us.us ]
%niter = phi i64 [ %niter.next.1, %for.inc.us.us.1 ], [ 0, %for.cond9.preheader.us.us ]
%3 = trunc i64 %indvars.iv to i32
%reass.add65.us.us = add i32 %reass.add.us.us, %3
%reass.mul.us.us = mul i32 %reass.add65.us.us, %3
%add22.us.us = add i32 %add20.us.us, %reass.mul.us.us
%cmp25.us.us = icmp sgt i32 %add22.us.us, %.pre
br i1 %cmp25.us.us, label %for.inc.us.us, label %if.end.us.us
if.end.us.us: ; preds = %for.body13.us.us
%conv23.us.us = zext i32 %add22.us.us to i64
%arrayidx.us.us = getelementptr inbounds [10001 x i32], ptr @c, i64 0, i64 %conv23.us.us
%4 = load i32, ptr %arrayidx.us.us, align 4, !tbaa !5
%inc.us.us = add nsw i32 %4, 1
store i32 %inc.us.us, ptr %arrayidx.us.us, align 4, !tbaa !5
br label %for.inc.us.us
for.inc.us.us: ; preds = %if.end.us.us, %for.body13.us.us
%5 = trunc i64 %indvars.iv to i32
%6 = add i32 %5, 1
%reass.add65.us.us.1 = add i32 %reass.add.us.us, %6
%reass.mul.us.us.1 = mul i32 %reass.add65.us.us.1, %6
%add22.us.us.1 = add i32 %add20.us.us, %reass.mul.us.us.1
%cmp25.us.us.1 = icmp sgt i32 %add22.us.us.1, %.pre
br i1 %cmp25.us.us.1, label %for.inc.us.us.1, label %if.end.us.us.1
if.end.us.us.1: ; preds = %for.inc.us.us
%conv23.us.us.1 = zext i32 %add22.us.us.1 to i64
%arrayidx.us.us.1 = getelementptr inbounds [10001 x i32], ptr @c, i64 0, i64 %conv23.us.us.1
%7 = load i32, ptr %arrayidx.us.us.1, align 4, !tbaa !5
%inc.us.us.1 = add nsw i32 %7, 1
store i32 %inc.us.us.1, ptr %arrayidx.us.us.1, align 4, !tbaa !5
br label %for.inc.us.us.1
for.inc.us.us.1: ; preds = %if.end.us.us.1, %for.inc.us.us
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond9.for.cond.cleanup12_crit_edge.us.us.unr-lcssa, label %for.body13.us.us, !llvm.loop !18
for.cond9.for.cond.cleanup12_crit_edge.us.us.unr-lcssa: ; preds = %for.inc.us.us.1, %for.cond9.preheader.us.us
%indvars.iv.unr = phi i64 [ 1, %for.cond9.preheader.us.us ], [ %indvars.iv.next.1, %for.inc.us.us.1 ]
br i1 %lcmp.mod.not, label %for.cond9.for.cond.cleanup12_crit_edge.us.us, label %for.body13.us.us.epil
for.body13.us.us.epil: ; preds = %for.cond9.for.cond.cleanup12_crit_edge.us.us.unr-lcssa
%8 = trunc i64 %indvars.iv.unr to i32
%reass.add65.us.us.epil = add i32 %reass.add.us.us, %8
%reass.mul.us.us.epil = mul i32 %reass.add65.us.us.epil, %8
%add22.us.us.epil = add i32 %add20.us.us, %reass.mul.us.us.epil
%cmp25.us.us.epil = icmp sgt i32 %add22.us.us.epil, %.pre
br i1 %cmp25.us.us.epil, label %for.cond9.for.cond.cleanup12_crit_edge.us.us, label %if.end.us.us.epil
if.end.us.us.epil: ; preds = %for.body13.us.us.epil
%conv23.us.us.epil = zext i32 %add22.us.us.epil to i64
%arrayidx.us.us.epil = getelementptr inbounds [10001 x i32], ptr @c, i64 0, i64 %conv23.us.us.epil
%9 = load i32, ptr %arrayidx.us.us.epil, align 4, !tbaa !5
%inc.us.us.epil = add nsw i32 %9, 1
store i32 %inc.us.us.epil, ptr %arrayidx.us.us.epil, align 4, !tbaa !5
br label %for.cond9.for.cond.cleanup12_crit_edge.us.us
for.cond9.for.cond.cleanup12_crit_edge.us.us: ; preds = %for.body13.us.us.epil, %if.end.us.us.epil, %for.cond9.for.cond.cleanup12_crit_edge.us.us.unr-lcssa
%inc29.us.us = add nuw nsw i32 %j.071.us.us, 1
%exitcond77.not = icmp eq i32 %inc29.us.us, %conv2
br i1 %exitcond77.not, label %for.cond4.for.cond.cleanup7_crit_edge.split.us.us, label %for.cond9.preheader.us.us, !llvm.loop !19
for.cond4.for.cond.cleanup7_crit_edge.split.us.us: ; preds = %for.cond9.for.cond.cleanup12_crit_edge.us.us
%inc32.us = add nuw nsw i32 %i.073.us, 1
%exitcond78.not = icmp eq i32 %inc32.us, %conv2
br i1 %exitcond78.not, label %for.cond35.preheader, label %for.cond4.preheader.us, !llvm.loop !20
for.cond35.preheader: ; preds = %for.cond4.for.cond.cleanup7_crit_edge.split.us.us, %entry
%cmp36.not74 = icmp slt i32 %.pre, 1
br i1 %cmp36.not74, label %for.cond.cleanup38, label %for.body39
for.cond.cleanup38: ; preds = %for.body39, %for.cond35.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #16
ret i32 0
for.body39: ; preds = %for.cond35.preheader, %for.body39
%indvars.iv79 = phi i64 [ %indvars.iv.next80, %for.body39 ], [ 1, %for.cond35.preheader ]
%arrayidx40 = getelementptr inbounds [10001 x i32], ptr @c, i64 0, i64 %indvars.iv79
%10 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %10)
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%11 = load i32, ptr %n, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp36.not.not = icmp slt i64 %indvars.iv79, %12
br i1 %cmp36.not.not, label %for.body39, label %for.cond.cleanup38, !llvm.loop !21
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #11
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #12
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #11
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #13
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #14
attributes #0 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nounwind willreturn uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #12 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #13 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #14 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #15 = { nounwind willreturn memory(read) }
attributes #16 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10, !16, !15}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,num;
scanf("%d",&n);
int *a = calloc(n,sizeof(int));
for(int x = 1;x < n;x++)
{
for(int y = 1;y < n;y++)
for(int z = 1;(num = x * x + y * y + z * z + x * y + x * z + y * z) <= n;z++)
{
a[num - 1]++;
}
}
for(int i = 0;i < n;i++)
printf("%d\n",a[i]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250729/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250729/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #5
%cmp67 = icmp sgt i32 %0, 1
br i1 %cmp67, label %for.cond3.preheader.us, label %for.cond29.preheader
for.cond3.preheader.us: ; preds = %entry, %for.cond3.for.cond.cleanup6_crit_edge.us
%x.068.us = phi i32 [ %inc27.us, %for.cond3.for.cond.cleanup6_crit_edge.us ], [ 1, %entry ]
%mul.us = mul nsw i32 %x.068.us, %x.068.us
br label %for.cond8.preheader.us
for.body21.us: ; preds = %for.cond8.preheader.us, %for.body21.us
%add1764.us = phi i32 [ %add17.us, %for.body21.us ], [ %add1761.us, %for.cond8.preheader.us ]
%z.063.us = phi i32 [ %inc22.us, %for.body21.us ], [ 1, %for.cond8.preheader.us ]
%sub.us = add nsw i32 %add1764.us, -1
%idxprom.us = sext i32 %sub.us to i64
%arrayidx.us = getelementptr inbounds i32, ptr %call1, i64 %idxprom.us
%1 = load i32, ptr %arrayidx.us, align 4, !tbaa !5
%inc.us = add nsw i32 %1, 1
store i32 %inc.us, ptr %arrayidx.us, align 4, !tbaa !5
%inc22.us = add nuw nsw i32 %z.063.us, 1
%reass.add57.us = add i32 %reass.add.us, %inc22.us
%reass.mul.us = mul i32 %reass.add57.us, %inc22.us
%add17.us = add i32 %add15.us, %reass.mul.us
%cmp18.not.us = icmp sgt i32 %add17.us, %0
br i1 %cmp18.not.us, label %for.cond.cleanup20.us, label %for.body21.us, !llvm.loop !9
for.cond.cleanup20.us: ; preds = %for.body21.us, %for.cond8.preheader.us
%inc24.us = add nuw nsw i32 %y.066.us, 1
%exitcond.not = icmp eq i32 %inc24.us, %0
br i1 %exitcond.not, label %for.cond3.for.cond.cleanup6_crit_edge.us, label %for.cond8.preheader.us, !llvm.loop !11
for.cond8.preheader.us: ; preds = %for.cond3.preheader.us, %for.cond.cleanup20.us
%y.066.us = phi i32 [ 1, %for.cond3.preheader.us ], [ %inc24.us, %for.cond.cleanup20.us ]
%reass.add.us = add nuw i32 %y.066.us, %x.068.us
%reass.mul59.us = mul i32 %reass.add.us, %y.066.us
%add15.us = add i32 %reass.mul59.us, %mul.us
%reass.add5760.us = add nuw i32 %reass.add.us, 1
%add1761.us = add i32 %add15.us, %reass.add5760.us
%cmp18.not62.us = icmp sgt i32 %add1761.us, %0
br i1 %cmp18.not62.us, label %for.cond.cleanup20.us, label %for.body21.us
for.cond3.for.cond.cleanup6_crit_edge.us: ; preds = %for.cond.cleanup20.us
%inc27.us = add nuw nsw i32 %x.068.us, 1
%exitcond71.not = icmp eq i32 %inc27.us, %0
br i1 %exitcond71.not, label %for.cond29.preheader, label %for.cond3.preheader.us, !llvm.loop !12
for.cond29.preheader: ; preds = %for.cond3.for.cond.cleanup6_crit_edge.us, %entry
%cmp3069 = icmp sgt i32 %0, 0
br i1 %cmp3069, label %for.body33, label %for.cond.cleanup32
for.cond.cleanup32: ; preds = %for.body33, %for.cond29.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body33: ; preds = %for.cond29.preheader, %for.body33
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body33 ], [ 0, %for.cond29.preheader ]
%arrayidx35 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%2 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp30 = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp30, label %for.body33, label %for.cond.cleanup32, !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 nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind allocsize(0,1) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
typedef long long ll;
int main() {
int n;
scanf("%d", &n);
ll ans[10000] = {0};
for (int x = 1; x <= n; x++) {
for (int y = 1; y <= n; y++) {
for (int z = 1; z <= n; z++) {
int t = x * x + y * y + z * z + x * y + y * z + z * x;
if (t <= n) {
ans[t - 1]++;
} else {
break;
}
}
}
}
for (int i = 0; i < n; i++) {
printf("%lld\n", ans[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250772/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250772/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%ans = alloca [10000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 80000, ptr nonnull %ans) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(80000) %ans, i8 0, i64 80000, i1 false)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not67 = icmp slt i32 %0, 1
br i1 %cmp.not67, label %for.cond.cleanup31, label %for.cond1.preheader.preheader
for.cond1.preheader.preheader: ; preds = %entry
%1 = add nuw i32 %0, 1
%wide.trip.count = zext i32 %1 to i64
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.cond1.for.cond.cleanup3_crit_edge.split
%x.068 = phi i32 [ %inc26, %for.cond1.for.cond.cleanup3_crit_edge.split ], [ 1, %for.cond1.preheader.preheader ]
%mul = mul nsw i32 %x.068, %x.068
br label %for.cond5.preheader
for.cond29.preheader: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.split
%cmp3069 = icmp sgt i32 %0, 0
br i1 %cmp3069, label %for.body32, label %for.cond.cleanup31
for.cond5.preheader: ; preds = %for.cond1.preheader, %cleanup20
%y.066 = phi i32 [ 1, %for.cond1.preheader ], [ %inc22, %cleanup20 ]
%reass.add = add nuw i32 %y.066, %x.068
%reass.mul62 = mul i32 %reass.add, %y.066
%add15 = add i32 %reass.mul62, %mul
br label %for.body8
for.cond1.for.cond.cleanup3_crit_edge.split: ; preds = %cleanup20
%inc26 = add nuw i32 %x.068, 1
%exitcond73.not = icmp eq i32 %x.068, %0
br i1 %exitcond73.not, label %for.cond29.preheader, label %for.cond1.preheader, !llvm.loop !9
for.body8: ; preds = %for.cond5.preheader, %if.then
%indvars.iv = phi i64 [ 1, %for.cond5.preheader ], [ %indvars.iv.next, %if.then ]
%2 = trunc i64 %indvars.iv to i32
%reass.add60 = add i32 %reass.add, %2
%reass.mul = mul i32 %reass.add60, %2
%add17 = add i32 %add15, %reass.mul
%cmp18.not.not = icmp sgt i32 %add17, %0
br i1 %cmp18.not.not, label %cleanup20, label %if.then
if.then: ; preds = %for.body8
%sub = add nsw i32 %add17, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [10000 x i64], ptr %ans, i64 0, i64 %idxprom
%3 = load i64, ptr %arrayidx, align 8, !tbaa !11
%inc = add nsw i64 %3, 1
store i64 %inc, ptr %arrayidx, align 8, !tbaa !11
%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 %cleanup20, label %for.body8, !llvm.loop !13
cleanup20: ; preds = %if.then, %for.body8
%inc22 = add nuw i32 %y.066, 1
%exitcond72.not = icmp eq i32 %y.066, %0
br i1 %exitcond72.not, label %for.cond1.for.cond.cleanup3_crit_edge.split, label %for.cond5.preheader, !llvm.loop !14
for.cond.cleanup31: ; preds = %for.body32, %entry, %for.cond29.preheader
call void @llvm.lifetime.end.p0(i64 80000, ptr nonnull %ans) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body32: ; preds = %for.cond29.preheader, %for.body32
%indvars.iv74 = phi i64 [ %indvars.iv.next75, %for.body32 ], [ 0, %for.cond29.preheader ]
%arrayidx34 = getelementptr inbounds [10000 x i64], ptr %ans, i64 0, i64 %indvars.iv74
%4 = load i64, ptr %arrayidx34, align 8, !tbaa !11
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %4)
%indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp30 = icmp slt i64 %indvars.iv.next75, %6
br i1 %cmp30, label %for.body32, label %for.cond.cleanup31, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, 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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
int main(void){
int a; int b;
int ab;
int i;
while((scanf("%d %d",&a,&b))!=EOF){
ab=a+b;
for(i=1;;i++){
ab/=10;
if(ab==0) break;
}
printf("%d\n",i);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250815/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250815/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not10 = icmp eq i32 %call9, -1
br i1 %cmp.not10, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%ab.0.off5 = add i32 %add, 9
%cmp16 = icmp ult i32 %ab.0.off5, 19
br i1 %cmp16, label %for.end, label %for.inc
for.inc: ; preds = %while.body, %for.inc
%i.08 = phi i32 [ %inc, %for.inc ], [ 1, %while.body ]
%ab.07 = phi i32 [ %div, %for.inc ], [ %add, %while.body ]
%div = sdiv i32 %ab.07, 10
%inc = add nuw nsw i32 %i.08, 1
%ab.0.off = add nsw i32 %div, 9
%cmp1 = icmp ult i32 %ab.0.off, 19
br i1 %cmp1, label %for.end, label %for.inc
for.end: ; preds = %for.inc, %while.body
%i.0.lcssa = phi i32 [ 1, %while.body ], [ %inc, %for.inc ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int a,b,sum;
while(scanf("%d %d", &a, &b) != -1){
sum = a+b;
int i = 1;
while(sum/10 != 0){
sum = sum/10;
i++;
}
printf("%d\n",i);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250859/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250859/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not14 = icmp eq i32 %call13, -1
br i1 %cmp.not14, label %while.end6, label %while.body
while.body: ; preds = %entry, %while.end
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%sum.0.off9 = add i32 %add, 9
%cmp2.not10 = icmp ult i32 %sum.0.off9, 19
br i1 %cmp2.not10, label %while.end, label %while.body3
while.body3: ; preds = %while.body, %while.body3
%i.012 = phi i32 [ %inc, %while.body3 ], [ 1, %while.body ]
%sum.011 = phi i32 [ %div, %while.body3 ], [ %add, %while.body ]
%div = sdiv i32 %sum.011, 10
%inc = add nuw nsw i32 %i.012, 1
%sum.0.off = add nsw i32 %div, 9
%cmp2.not = icmp ult i32 %sum.0.off, 19
br i1 %cmp2.not, label %while.end, label %while.body3, !llvm.loop !9
while.end: ; preds = %while.body3, %while.body
%i.0.lcssa = phi i32 [ 1, %while.body ], [ %inc, %while.body3 ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end6, label %while.body, !llvm.loop !11
while.end6: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_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>
#define DATA 200
int main(){
int a[DATA],b[DATA],c[DATA];
int i,j,keta=0;
j=0;
while(scanf("%d %d",&a[j],&b[j]) != EOF)
j++;
for(i=0;i<j;i++){
c[i]=a[i]+b[i];
while(c[i]>0){
c[i]/=10;
keta++;
}
printf("%d\n",keta);
keta=0;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250901/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250901/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [200 x i32], align 16
%b = alloca [200 x i32], align 16
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %b) #3
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvars.iv39 = phi i32 [ %indvars.iv.next40, %while.cond ], [ 0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200 x i32], ptr %a, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [200 x i32], ptr %b, i64 0, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%cmp.not = icmp eq i32 %call, -1
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%indvars.iv.next40 = add nuw i32 %indvars.iv39, 1
br i1 %cmp.not, label %for.cond.preheader, label %while.cond, !llvm.loop !5
for.cond.preheader: ; preds = %while.cond
%0 = and i64 %indvars.iv, 4294967295
%cmp333.not = icmp eq i64 %0, 0
br i1 %cmp333.not, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %indvars.iv39 to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %while.end18
%indvars.iv36 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next37, %while.end18 ]
%arrayidx5 = getelementptr inbounds [200 x i32], ptr %a, i64 0, i64 %indvars.iv36
%1 = load i32, ptr %arrayidx5, align 4, !tbaa !7
%arrayidx7 = getelementptr inbounds [200 x i32], ptr %b, i64 0, i64 %indvars.iv36
%2 = load i32, ptr %arrayidx7, align 4, !tbaa !7
%add = add nsw i32 %2, %1
%cmp1331 = icmp sgt i32 %add, 0
br i1 %cmp1331, label %while.body14, label %while.end18
while.body14: ; preds = %for.body, %while.body14
%keta.132 = phi i32 [ %inc17, %while.body14 ], [ 0, %for.body ]
%3 = phi i32 [ %div, %while.body14 ], [ %add, %for.body ]
%div = udiv i32 %3, 10
%inc17 = add nuw nsw i32 %keta.132, 1
%cmp13.not = icmp ult i32 %3, 10
br i1 %cmp13.not, label %while.end18, label %while.body14, !llvm.loop !11
while.end18: ; preds = %while.body14, %for.body
%keta.1.lcssa = phi i32 [ 0, %for.body ], [ %inc17, %while.body14 ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %keta.1.lcssa)
%indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
%exitcond.not = icmp eq i64 %indvars.iv.next37, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %while.end18, %for.cond.preheader
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 800, 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
|
#include <stdio.h>
int main(void) {
int a, b, mas, count = 0;
while(scanf("%d",&a) != EOF) {
count = 0;
scanf("%d",&b);
mas = a + b;
while(mas != 0) {
mas = mas / 10;
count++;
}
printf("%d\n",count);
}
return(0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250945/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250945/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%cmp.not13 = icmp eq i32 %call12, -1
br i1 %cmp.not13, label %while.end6, label %while.body
while.body: ; preds = %entry, %while.end
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%cmp3.not9 = icmp eq i32 %add, 0
br i1 %cmp3.not9, label %while.end, label %while.body4
while.body4: ; preds = %while.body, %while.body4
%count.011 = phi i32 [ %inc, %while.body4 ], [ 0, %while.body ]
%mas.010 = phi i32 [ %div, %while.body4 ], [ %add, %while.body ]
%div = sdiv i32 %mas.010, 10
%inc = add nuw nsw i32 %count.011, 1
%mas.010.off = add i32 %mas.010, 9
%cmp3.not = icmp ult i32 %mas.010.off, 19
br i1 %cmp3.not, label %while.end, label %while.body4, !llvm.loop !9
while.end: ; preds = %while.body4, %while.body
%count.0.lcssa = phi i32 [ 0, %while.body ], [ %inc, %while.body4 ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end6, label %while.body, !llvm.loop !11
while.end6: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(){
int a,b,sum,counter,i;
while(scanf("%d %d",&a,&b) != -1){
sum = a + b;
for (i=0; sum!=0; i++)
sum = sum / 10;
printf("%d\n",i);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_250989/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_250989/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not9 = icmp eq i32 %call8, -1
br i1 %cmp.not9, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%cmp1.not5 = icmp eq i32 %add, 0
br i1 %cmp1.not5, label %for.end, label %for.body
for.body: ; preds = %while.body, %for.body
%i.07 = phi i32 [ %inc, %for.body ], [ 0, %while.body ]
%sum.06 = phi i32 [ %div, %for.body ], [ %add, %while.body ]
%div = sdiv i32 %sum.06, 10
%inc = add nuw nsw i32 %i.07, 1
%sum.06.off = add i32 %sum.06, 9
%cmp1.not = icmp ult i32 %sum.06.off, 19
br i1 %cmp1.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %while.body
%i.0.lcssa = phi i32 [ 0, %while.body ], [ %inc, %for.body ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_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 a,b;
int r = 0;
while(scanf("%d %d",&a,&b) != EOF){
a += b;
while(a >0){
r++;
a /= 10;
}
printf("%d\n",r);
r = 0;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251038/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251038/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not12 = icmp eq i32 %call11, -1
br i1 %cmp.not12, label %while.end5, label %while.body
while.body: ; preds = %entry, %while.end
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%cmp27 = icmp sgt i32 %add, 0
br i1 %cmp27, label %while.body3, label %while.end
while.body3: ; preds = %while.body, %while.body3
%r.19 = phi i32 [ %inc, %while.body3 ], [ 0, %while.body ]
%storemerge8 = phi i32 [ %div, %while.body3 ], [ %add, %while.body ]
%inc = add nuw nsw i32 %r.19, 1
%div = udiv i32 %storemerge8, 10
%cmp2.not = icmp ult i32 %storemerge8, 10
br i1 %cmp2.not, label %while.end, label %while.body3, !llvm.loop !9
while.end: ; preds = %while.body3, %while.body
%storemerge.lcssa = phi i32 [ %add, %while.body ], [ %div, %while.body3 ]
%r.1.lcssa = phi i32 [ 0, %while.body ], [ %inc, %while.body3 ]
store i32 %storemerge.lcssa, ptr %a, align 4, !tbaa !5
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %r.1.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end5, label %while.body, !llvm.loop !11
while.end5: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_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 x,y,sum,num;
while(scanf("%d %d", &x, &y) != EOF){
num=x+y;
sum=0;
while(num!=0){
num/=10;
sum++;
}
printf("%d\n", sum);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251081/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251081/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%cmp.not12 = icmp eq i32 %call11, -1
br i1 %cmp.not12, label %while.end5, label %while.body
while.body: ; preds = %entry, %while.end
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%cmp2.not8 = icmp eq i32 %add, 0
br i1 %cmp2.not8, label %while.end, label %while.body3
while.body3: ; preds = %while.body, %while.body3
%num.010 = phi i32 [ %div, %while.body3 ], [ %add, %while.body ]
%sum.09 = phi i32 [ %inc, %while.body3 ], [ 0, %while.body ]
%div = sdiv i32 %num.010, 10
%inc = add nuw nsw i32 %sum.09, 1
%num.010.off = add i32 %num.010, 9
%cmp2.not = icmp ult i32 %num.010.off, 19
br i1 %cmp2.not, label %while.end, label %while.body3, !llvm.loop !9
while.end: ; preds = %while.body3, %while.body
%sum.0.lcssa = phi i32 [ 0, %while.body ], [ %inc, %while.body3 ]
%call4 = 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 %x, ptr noundef nonnull %y)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end5, label %while.body, !llvm.loop !11
while.end5: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main()
{
int a,b,n,count;
while(scanf("%d%d",&a,&b)!=EOF){
if(a>=0&&b>=0){
n=a+b;
count=0;
while(n!=0){
n=n/10;
count++;
}
printf("%d\n",count);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251124/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251124/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not15 = icmp eq i32 %call14, -1
br i1 %cmp.not15, label %while.end7, label %while.body
while.body: ; preds = %entry, %if.end
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %0, -1
%1 = load i32, ptr %b, align 4
%cmp2 = icmp sgt i32 %1, -1
%or.cond = select i1 %cmp1, i1 %cmp2, i1 false
br i1 %or.cond, label %if.then, label %if.end
if.then: ; preds = %while.body
%add = add nuw nsw i32 %1, %0
%cmp4.not11 = icmp eq i32 %add, 0
br i1 %cmp4.not11, label %while.end, label %while.body5
while.body5: ; preds = %if.then, %while.body5
%count.013 = phi i32 [ %inc, %while.body5 ], [ 0, %if.then ]
%n.012 = phi i32 [ %div, %while.body5 ], [ %add, %if.then ]
%div = sdiv i32 %n.012, 10
%inc = add nuw nsw i32 %count.013, 1
%n.012.off = add i32 %n.012, 9
%cmp4.not = icmp ult i32 %n.012.off, 19
br i1 %cmp4.not, label %while.end, label %while.body5, !llvm.loop !9
while.end: ; preds = %while.body5, %if.then
%count.0.lcssa = phi i32 [ 0, %if.then ], [ %inc, %while.body5 ]
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
br label %if.end
if.end: ; preds = %while.end, %while.body
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end7, label %while.body, !llvm.loop !11
while.end7: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(){
int a,b,sum;
int i;
while(scanf("%d %d",&a,&b)!=EOF){
sum=a+b;
for(i=0;sum!=0;i++){
sum/=10;
}
printf("%d\n",i);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251168/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251168/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not9 = icmp eq i32 %call8, -1
br i1 %cmp.not9, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%cmp1.not5 = icmp eq i32 %add, 0
br i1 %cmp1.not5, label %for.end, label %for.body
for.body: ; preds = %while.body, %for.body
%i.07 = phi i32 [ %inc, %for.body ], [ 0, %while.body ]
%sum.06 = phi i32 [ %div, %for.body ], [ %add, %while.body ]
%div = sdiv i32 %sum.06, 10
%inc = add nuw nsw i32 %i.07, 1
%sum.06.off = add i32 %sum.06, 9
%cmp1.not = icmp ult i32 %sum.06.off, 19
br i1 %cmp1.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %while.body
%i.0.lcssa = phi i32 [ 0, %while.body ], [ %inc, %for.body ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_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}
|
// Aizu Vol0 0002: Digit Number
// 2017.7.28
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#define MAX 8
int max[MAX] = {
0,
0,
10,
100,
1000,
10000,
100000,
1000000
};
int main()
{
int a, b, c;
int i;
while (scanf("%d%d", &a, &b) == 2) {
c = a + b;
for (i = MAX - 1; i >= 0; i--) {
if (c >= max[i]) break;
}
putchar('0' + i);
putchar('\n');
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251218/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251218/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@max = dso_local local_unnamed_addr global [8 x i32] [i32 0, i32 0, i32 10, i32 100, i32 1000, i32 10000, i32 100000, i32 1000000], align 16
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%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
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp12 = icmp eq i32 %call11, 2
br i1 %cmp12, label %while.body, label %while.end
while.body: ; preds = %entry, %for.end
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @max, i64 0, i64 7), align 4, !tbaa !5
%cmp2.not = icmp slt i32 %add, %2
br i1 %cmp2.not, label %for.inc, label %for.end
for.inc: ; preds = %while.body
%3 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @max, i64 0, i64 6), align 8, !tbaa !5
%cmp2.not.1 = icmp slt i32 %add, %3
br i1 %cmp2.not.1, label %for.inc.1, label %for.end
for.inc.1: ; preds = %for.inc
%4 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @max, i64 0, i64 5), align 4, !tbaa !5
%cmp2.not.2 = icmp slt i32 %add, %4
br i1 %cmp2.not.2, label %for.inc.2, label %for.end
for.inc.2: ; preds = %for.inc.1
%5 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @max, i64 0, i64 4), align 16, !tbaa !5
%cmp2.not.3 = icmp slt i32 %add, %5
br i1 %cmp2.not.3, label %for.inc.3, label %for.end
for.inc.3: ; preds = %for.inc.2
%6 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @max, i64 0, i64 3), align 4, !tbaa !5
%cmp2.not.4 = icmp slt i32 %add, %6
br i1 %cmp2.not.4, label %for.inc.4, label %for.end
for.inc.4: ; preds = %for.inc.3
%7 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @max, i64 0, i64 2), align 8, !tbaa !5
%cmp2.not.5 = icmp slt i32 %add, %7
br i1 %cmp2.not.5, label %for.inc.5, label %for.end
for.inc.5: ; preds = %for.inc.4
%8 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @max, i64 0, i64 1), align 4, !tbaa !5
%cmp2.not.6 = icmp slt i32 %add, %8
br i1 %cmp2.not.6, label %for.inc.6, label %for.end
for.inc.6: ; preds = %for.inc.5
%9 = load i32, ptr @max, align 16, !tbaa !5
%cmp2.not.7 = icmp slt i32 %add, %9
%spec.select = select i1 %cmp2.not.7, i32 47, i32 48
br label %for.end
for.end: ; preds = %for.inc.6, %for.inc.5, %for.inc.4, %for.inc.3, %for.inc.2, %for.inc.1, %for.inc, %while.body
%i.0.lcssa = phi i32 [ 55, %while.body ], [ 54, %for.inc ], [ 53, %for.inc.1 ], [ 52, %for.inc.2 ], [ 51, %for.inc.3 ], [ 50, %for.inc.4 ], [ 49, %for.inc.5 ], [ %spec.select, %for.inc.6 ]
%10 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i = call i32 @putc(i32 noundef %i.0.lcssa, ptr noundef %10)
%11 = load ptr, ptr @stdout, align 8, !tbaa !9
%call.i9 = call i32 @putc(i32 noundef 10, ptr noundef %11)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp = icmp eq i32 %call, 2
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !11
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int keta(int a,int b);
int main(void){
int a,b;
while(scanf("%d %d",&a,&b) != EOF){
printf("%d\n",keta(a,b));
}
return 0;
}
int keta(int a,int b){
int wa,sum,count=0;
sum=a+b;
for(wa=1;sum/wa!=0;wa*=10){
if(sum/wa!=0)
count++;
}
return count;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251269/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251269/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not4 = icmp eq i32 %call3, -1
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %keta.exit
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add.i = add nsw i32 %1, %0
%cmp.not7.i = icmp eq i32 %add.i, 0
br i1 %cmp.not7.i, label %keta.exit, label %for.inc.i
for.inc.i: ; preds = %while.body, %for.inc.i
%count.09.i = phi i32 [ %inc.i, %for.inc.i ], [ 0, %while.body ]
%wa.08.i = phi i32 [ %mul.i, %for.inc.i ], [ 1, %while.body ]
%inc.i = add nuw nsw i32 %count.09.i, 1
%mul.i = mul nuw nsw i32 %wa.08.i, 10
%div.i = sdiv i32 %add.i, %mul.i
%cmp.not.i = icmp eq i32 %div.i, 0
br i1 %cmp.not.i, label %keta.exit, label %for.inc.i, !llvm.loop !9
keta.exit: ; preds = %for.inc.i, %while.body
%count.0.lcssa.i = phi i32 [ 0, %while.body ], [ %inc.i, %for.inc.i ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa.i)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %keta.exit, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @keta(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%add = add nsw i32 %b, %a
%cmp.not7 = icmp eq i32 %add, 0
br i1 %cmp.not7, label %for.end, label %for.inc
for.inc: ; preds = %entry, %for.inc
%count.09 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%wa.08 = phi i32 [ %mul, %for.inc ], [ 1, %entry ]
%inc = add nuw nsw i32 %count.09, 1
%mul = mul nuw nsw i32 %wa.08, 10
%div = sdiv i32 %add, %mul
%cmp.not = icmp eq i32 %div, 0
br i1 %cmp.not, label %for.end, label %for.inc, !llvm.loop !9
for.end: ; preds = %for.inc, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
ret i32 %count.0.lcssa
}
; 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 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void){
int a,b,c;
int tem;
int i;
while( scanf("%d %d",&a,&b) !=EOF){
c = a+b;
tem=0;
i=1000000;
while(i>=10){
if(c>=i){
tem+=1;
}
i/=10;
}
printf("%d\n",tem+1);
tem=0;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251311/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251311/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not15 = icmp eq i32 %call14, -1
br i1 %cmp.not15, label %while.end8, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = insertelement <4 x i32> poison, i32 %add, i64 0
%3 = shufflevector <4 x i32> %2, <4 x i32> poison, <4 x i32> zeroinitializer
%4 = icmp sgt <4 x i32> %3, <i32 99999, i32 999999, i32 9999, i32 999>
%cmp4.not.4 = icmp sgt i32 %add, 99
%add5.4 = zext i1 %cmp4.not.4 to i32
%cmp4.not.5 = icmp sgt i32 %add, 9
%5 = bitcast <4 x i1> %4 to i4
%6 = call i4 @llvm.ctpop.i4(i4 %5), !range !9
%7 = zext i4 %6 to i32
%op.rdx = add nuw nsw i32 %7, %add5.4
%op.rdx16 = select i1 %cmp4.not.5, i32 2, i32 1
%op.rdx17 = add nuw nsw i32 %op.rdx, %op.rdx16
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %op.rdx17)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end8, label %while.body, !llvm.loop !10
while.end8: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i4 @llvm.ctpop.i4(i4) #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 = !{i4 0, i4 5}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
// AOJ Volume 0 Problem 0002
#include <stdio.h>
int main(void)
{
int i;
int num, num1, num2;
int digits;
while (scanf("%d%d", &num1, &num2) != EOF){
num = num1 + num2;
digits = 0;
while (num != 0){
num /= 10;
digits++;
}
printf("%d\n", digits);
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251405/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251405/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num1 = alloca i32, align 4
%num2 = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num2) #3
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num1, ptr noundef nonnull %num2)
%cmp.not12 = icmp eq i32 %call11, -1
br i1 %cmp.not12, label %while.end5, label %while.body
while.body: ; preds = %entry, %while.end
%0 = load i32, ptr %num1, align 4, !tbaa !5
%1 = load i32, ptr %num2, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%cmp2.not8 = icmp eq i32 %add, 0
br i1 %cmp2.not8, label %while.end, label %while.body3
while.body3: ; preds = %while.body, %while.body3
%digits.010 = phi i32 [ %inc, %while.body3 ], [ 0, %while.body ]
%num.09 = phi i32 [ %div, %while.body3 ], [ %add, %while.body ]
%div = sdiv i32 %num.09, 10
%inc = add nuw nsw i32 %digits.010, 1
%num.09.off = add i32 %num.09, 9
%cmp2.not = icmp ult i32 %num.09.off, 19
br i1 %cmp2.not, label %while.end, label %while.body3, !llvm.loop !9
while.end: ; preds = %while.body3, %while.body
%digits.0.lcssa = phi i32 [ 0, %while.body ], [ %inc, %while.body3 ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %digits.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num1, ptr noundef nonnull %num2)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end5, label %while.body, !llvm.loop !11
while.end5: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num1) #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 a,b,sum,keta = 0;
while (scanf("%d %d",&a,&b) == 2) {
sum = a + b;
while(sum>0){
keta++;
sum/=10;
}
printf("%d\n",keta);
sum = 0;
keta = 0;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251470/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251470/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp12 = icmp eq i32 %call11, 2
br i1 %cmp12, label %while.body, label %while.end5
while.body: ; preds = %entry, %while.end
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%cmp28 = icmp sgt i32 %add, 0
br i1 %cmp28, label %while.body3, label %while.end
while.body3: ; preds = %while.body, %while.body3
%keta.110 = phi i32 [ %inc, %while.body3 ], [ 0, %while.body ]
%sum.09 = phi i32 [ %div, %while.body3 ], [ %add, %while.body ]
%inc = add nuw nsw i32 %keta.110, 1
%div = udiv i32 %sum.09, 10
%cmp2.not = icmp ult i32 %sum.09, 10
br i1 %cmp2.not, label %while.end, label %while.body3, !llvm.loop !9
while.end: ; preds = %while.body3, %while.body
%keta.1.lcssa = phi i32 [ 0, %while.body ], [ %inc, %while.body3 ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %keta.1.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp = icmp eq i32 %call, 2
br i1 %cmp, label %while.body, label %while.end5, !llvm.loop !11
while.end5: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>;
int main(){
int a,b,c,count;
while(scanf("%d %d",&a,&b)!=EOF){
c=a+b;
count=1;
while(c>=10){
c/=10;
count++;
}
printf("%d\n",count);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251513/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251513/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not12 = icmp eq i32 %call11, -1
br i1 %cmp.not12, label %while.end5, label %while.body
while.body: ; preds = %entry, %while.end
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%cmp28 = icmp sgt i32 %add, 9
br i1 %cmp28, label %while.body3, label %while.end
while.body3: ; preds = %while.body, %while.body3
%count.010 = phi i32 [ %inc, %while.body3 ], [ 1, %while.body ]
%c.09 = phi i32 [ %div, %while.body3 ], [ %add, %while.body ]
%div = udiv i32 %c.09, 10
%inc = add nuw nsw i32 %count.010, 1
%cmp2 = icmp ugt i32 %c.09, 99
br i1 %cmp2, label %while.body3, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body3, %while.body
%count.0.lcssa = phi i32 [ 1, %while.body ], [ %inc, %while.body3 ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end5, label %while.body, !llvm.loop !11
while.end5: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_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 a,b,add,cnt=0;
while(scanf("%d%d",&a,&b)!=EOF){
add=a+b;
for(cnt=0; add!=0; add/=10)
cnt++;
printf("%d\n",cnt);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251564/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251564/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not10 = icmp eq i32 %call9, -1
br i1 %cmp.not10, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add1 = add nsw i32 %1, %0
%cmp2.not6 = icmp eq i32 %add1, 0
br i1 %cmp2.not6, label %for.end, label %for.body
for.body: ; preds = %while.body, %for.body
%cnt.08 = phi i32 [ %inc, %for.body ], [ 0, %while.body ]
%add.07 = phi i32 [ %div, %for.body ], [ %add1, %while.body ]
%inc = add nuw nsw i32 %cnt.08, 1
%div = sdiv i32 %add.07, 10
%add.07.off = add i32 %add.07, 9
%cmp2.not = icmp ult i32 %add.07.off, 19
br i1 %cmp2.not, label %for.end, label %for.body, !llvm.loop !9
for.end: ; preds = %for.body, %while.body
%cnt.0.lcssa = phi i32 [ 0, %while.body ], [ %inc, %for.body ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_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>
#include <string.h>
int main(){
int x,y,len;
char digit[100];
while(scanf("%d %d",&x,&y) != EOF){
sprintf(digit, "%d", x+y);
len = strlen(digit);
printf("%d\n",len);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251614/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251614/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
%y = alloca i32, align 4
%digit = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %digit) #4
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%cmp.not6 = icmp eq i32 %call5, -1
br i1 %cmp.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%call1 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %digit, ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add) #4
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %digit) #5
%conv = trunc i64 %call3 to i32
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %conv)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %digit) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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()
{
unsigned int a = 0;
unsigned int b = 0;
unsigned int len = 0;
char buff[8] = {0};
while ( scanf("%d %d", &a, &b) != EOF )
{
len = sprintf(buff,"%d", a+b);
printf("%d\n", len);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251658/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251658/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%a = alloca i32, align 4
%b = alloca i32, align 4
%buff = alloca [8 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
store i32 0, ptr %a, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
store i32 0, ptr %b, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %buff) #3
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not4 = icmp eq i32 %call3, -1
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add i32 %1, %0
%call1 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %buff, ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add) #3
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %call1)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %buff) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(int argc, const char * argv[])
{
int a, b;
int di;
int counter = 0;
int i;
while (scanf("%d %d",&a ,&b) != EOF) {
di = a + b;
for (i = 0; i < 8; i++) {
di /= 10;
if (di == 0 && counter == 0) {
printf("%d\n",i + 1);
counter++;
}
}
counter = 0;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251708/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251708/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not15 = icmp eq i32 %call14, -1
br i1 %cmp.not15, label %while.end, label %while.body
while.body: ; preds = %entry, %for.inc.7
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = add i32 %add, -10
%cmp2 = icmp ult i32 %2, -19
br i1 %cmp2, label %for.inc, label %for.inc.7.sink.split
for.inc: ; preds = %while.body
%div = sdiv i32 %add, 10
%di.0.off.1 = add nsw i32 %div, 9
%cmp2.1 = icmp ult i32 %di.0.off.1, 19
%or.cond.1 = and i1 %cmp2.1, %cmp2
br i1 %or.cond.1, label %for.inc.7.sink.split, label %for.inc.1
for.inc.1: ; preds = %for.inc
%div.1 = sdiv i32 %add, 100
%di.0.off.2 = add nsw i32 %div.1, 9
%cmp2.2 = icmp ult i32 %di.0.off.2, 19
br i1 %cmp2.2, label %for.inc.7.sink.split, label %for.inc.2
for.inc.2: ; preds = %for.inc.1
%div.2 = sdiv i32 %add, 1000
%di.0.off.3 = add nsw i32 %div.2, 9
%cmp2.3 = icmp ult i32 %di.0.off.3, 19
br i1 %cmp2.3, label %for.inc.7.sink.split, label %for.inc.3
for.inc.3: ; preds = %for.inc.2
%div.3 = sdiv i32 %add, 10000
%di.0.off.4 = add nsw i32 %div.3, 9
%cmp2.4 = icmp ult i32 %di.0.off.4, 19
br i1 %cmp2.4, label %for.inc.7.sink.split, label %for.inc.4
for.inc.4: ; preds = %for.inc.3
%div.4 = sdiv i32 %add, 100000
%di.0.off.5 = add nsw i32 %div.4, 9
%cmp2.5 = icmp ult i32 %di.0.off.5, 19
br i1 %cmp2.5, label %for.inc.7.sink.split, label %for.inc.5
for.inc.5: ; preds = %for.inc.4
%div.5 = sdiv i32 %add, 1000000
%di.0.off.6 = add nsw i32 %div.5, 9
%cmp2.6 = icmp ult i32 %di.0.off.6, 19
br i1 %cmp2.6, label %for.inc.7.sink.split, label %for.inc.6
for.inc.6: ; preds = %for.inc.5
%div.6 = sdiv i32 %add, 10000000
%di.0.off.7 = add nsw i32 %div.6, 9
%cmp2.7 = icmp ult i32 %di.0.off.7, 19
br i1 %cmp2.7, label %for.inc.7.sink.split, label %for.inc.7
for.inc.7.sink.split: ; preds = %for.inc.6, %for.inc.5, %for.inc.4, %for.inc.3, %for.inc.2, %for.inc.1, %for.inc, %while.body
%.sink = phi i32 [ 1, %while.body ], [ 2, %for.inc ], [ 3, %for.inc.1 ], [ 4, %for.inc.2 ], [ 5, %for.inc.3 ], [ 6, %for.inc.4 ], [ 7, %for.inc.5 ], [ 8, %for.inc.6 ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.sink)
br label %for.inc.7
for.inc.7: ; preds = %for.inc.7.sink.split, %for.inc.6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %for.inc.7, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void) {
int a, b, sum, d;
while (scanf("%d %d", &a, &b) > 0) {
sum = a + b;
d = 0;
do {
sum /= 10;
d++;
} while (sum > 0);
printf("%d\n", d);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251751/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251751/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp7 = icmp sgt i32 %call6, 0
br i1 %cmp7, label %while.body, label %while.end
while.body: ; preds = %entry, %do.end
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
br label %do.body
do.body: ; preds = %do.body, %while.body
%sum.0 = phi i32 [ %add, %while.body ], [ %div5, %do.body ]
%d.0 = phi i32 [ 0, %while.body ], [ %inc, %do.body ]
%div5 = udiv i32 %sum.0, 10
%inc = add nuw nsw i32 %d.0, 1
%cmp1 = icmp sgt i32 %sum.0, 9
br i1 %cmp1, label %do.body, label %do.end, !llvm.loop !9
do.end: ; preds = %do.body
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %inc)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp = icmp sgt i32 %call, 0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !11
while.end: ; preds = %do.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_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) {
while(1){
int a=0,b=0;
int sum=0;
int count=1;
scanf("%d %d", &a, &b);
sum = a+b;
if(a==0&&b==0) break;
while(sum/10 != 0){
sum/=10;
count++;
}
printf("%d\n" ,count);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251795/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251795/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
store i32 0, ptr %a, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
store i32 0, ptr %b, align 4, !tbaa !5
%call19 = 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
%cmp21 = icmp eq i32 %0, 0
%cmp122 = icmp eq i32 %1, 0
%or.cond23 = select i1 %cmp21, i1 %cmp122, i1 false
br i1 %or.cond23, label %while.end10, label %while.cond2.preheader.preheader
while.cond2.preheader.preheader: ; preds = %entry
%add20 = add nsw i32 %1, %0
br label %while.cond2.preheader
while.cond2.preheader: ; preds = %while.cond2.preheader.preheader, %cleanup
%add24 = phi i32 [ %add, %cleanup ], [ %add20, %while.cond2.preheader.preheader ]
%sum.0.off15 = add i32 %add24, 9
%cmp3.not16 = icmp ult i32 %sum.0.off15, 19
br i1 %cmp3.not16, label %cleanup, label %while.body4
while.body4: ; preds = %while.cond2.preheader, %while.body4
%count.018 = phi i32 [ %inc, %while.body4 ], [ 1, %while.cond2.preheader ]
%sum.017 = phi i32 [ %div, %while.body4 ], [ %add24, %while.cond2.preheader ]
%div = sdiv i32 %sum.017, 10
%inc = add nuw nsw i32 %count.018, 1
%sum.0.off = add nsw i32 %div, 9
%cmp3.not = icmp ult i32 %sum.0.off, 19
br i1 %cmp3.not, label %cleanup, label %while.body4, !llvm.loop !9
cleanup: ; preds = %while.body4, %while.cond2.preheader
%count.0.lcssa = phi i32 [ 1, %while.cond2.preheader ], [ %inc, %while.body4 ]
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
store i32 0, ptr %a, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
store i32 0, ptr %b, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%2 = load i32, ptr %a, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4
%add = add nsw i32 %3, %2
%cmp = icmp eq i32 %2, 0
%cmp1 = icmp eq i32 %3, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end10, label %while.cond2.preheader
while.end10: ; preds = %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
int main() {
int a, b, c;
int digit;
for (int i = 0;i < 200; i++) {
if (scanf("%d %d", &a, &b) != 2) {
break;
}
c = a + b;
digit = 0;
for (;;){
if (c % 10 != 0) {
digit++;
c = c / 10;
} else if (c / 10 != 0) {
digit++;
c = c / 10;
} else {
break;
}
}
printf("%d\n", digit);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251845/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251845/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
br label %for.body
for.body: ; preds = %entry, %for.end
%i.033 = phi i32 [ 0, %entry ], [ %inc14, %for.end ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp1.not = icmp eq i32 %call, 2
br i1 %cmp1.not, label %if.end, label %cleanup
if.end: ; preds = %for.body
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%rem26 = srem i32 %add, 10
%cmp3.not27 = icmp eq i32 %rem26, 0
%c.0.off28 = add i32 %add, 9
%cmp6.not29 = icmp ult i32 %c.0.off28, 19
%or.cond30 = and i1 %cmp3.not27, %cmp6.not29
br i1 %or.cond30, label %for.end, label %if.end12
if.end12: ; preds = %if.end, %if.end12
%digit.032 = phi i32 [ %digit.1, %if.end12 ], [ 0, %if.end ]
%c.031 = phi i32 [ %c.1, %if.end12 ], [ %add, %if.end ]
%digit.1 = add nuw nsw i32 %digit.032, 1
%c.1 = sdiv i32 %c.031, 10
%rem = srem i32 %c.1, 10
%cmp3.not = icmp eq i32 %rem, 0
%c.0.off = add nsw i32 %c.1, 9
%cmp6.not = icmp ult i32 %c.0.off, 19
%or.cond = and i1 %cmp3.not, %cmp6.not
br i1 %or.cond, label %for.end, label %if.end12
for.end: ; preds = %if.end12, %if.end
%digit.0.lcssa = phi i32 [ 0, %if.end ], [ %digit.1, %if.end12 ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %digit.0.lcssa)
%inc14 = add nuw nsw i32 %i.033, 1
%exitcond.not = icmp eq i32 %inc14, 200
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !9
cleanup: ; preds = %for.body, %for.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
struct Process
{
char name[11];
int tim;
};
struct Process dequeue(struct Process *Q,int *head)
{
*head = *head + 1;
return Q[*head - 1];
}
void enqueue(struct Process x,struct Process *Q,int *tail)
{
Q[*tail] = x;
*tail +=1;
}
int main()
{
int n,c,cnt=0,box=0,ksn=0;
scanf("%d %d",&n,&c);
int tail=n,head=0;
char nmtmp[11],tmp;
struct Process p[n+1];
for(int i=0;i<n;i++)
{
scanf("%s", p[i].name);
scanf("%d", &p[i].tim);
/* while((tmp=getchar())!=' ')
{
if(!(tmp=='\n'||tmp=='\r'))
{
nmtmp[cnt] = tmp;
cnt++;
}
}
strcpy(p[i].name,nmtmp);
scanf("%d",&box);
p[i].tim = box;
cnt=0;
box=0;*/
}
while(head!=tail)
{
if(tail > n) tail = 0;
struct Process x = dequeue(p,&head);
if(head > n) head =0;
if(x.tim < c)
{
ksn += x.tim;
x.tim = 0;
}
else
{
ksn += c;
box = x.tim;
box -= c;
x.tim = box;
}
if(x.tim == 0)
{
printf("%s %d\n", x.name,ksn);
}
else
{
enqueue(x,p,&tail);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251889/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251889/source.c"
target datalayout = "e-m:e-p270: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.Process = type { [11 x i8], i32 }
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local { i64, i64 } @dequeue(ptr nocapture noundef readonly %Q, ptr nocapture noundef %head) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %head, align 4, !tbaa !5
%add = add nsw i32 %0, 1
store i32 %add, ptr %head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds %struct.Process, ptr %Q, i64 %idxprom
%retval.sroa.0.0.copyload = load i64, ptr %arrayidx, align 4, !tbaa.struct !9
%retval.sroa.2.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 8
%retval.sroa.2.0.copyload = load i64, ptr %retval.sroa.2.0.arrayidx.sroa_idx, align 4, !tbaa.struct !11
%.fca.0.insert = insertvalue { i64, i64 } poison, i64 %retval.sroa.0.0.copyload, 0
%.fca.1.insert = insertvalue { i64, i64 } %.fca.0.insert, i64 %retval.sroa.2.0.copyload, 1
ret { i64, i64 } %.fca.1.insert
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @enqueue(i64 %x.coerce0, i64 %x.coerce1, ptr nocapture noundef writeonly %Q, ptr nocapture noundef %tail) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds %struct.Process, ptr %Q, i64 %idxprom
store i64 %x.coerce0, ptr %arrayidx, align 4, !tbaa.struct !9
%x.sroa.2.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 8
store i64 %x.coerce1, ptr %x.sroa.2.0.arrayidx.sroa_idx, align 4, !tbaa.struct !11
%1 = load i32, ptr %tail, align 4, !tbaa !5
%add = add nsw i32 %1, 1
store i32 %add, ptr %tail, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%c = alloca i32, align 4
%x = alloca %struct.Process, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %c)
%0 = load i32, ptr %n, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%1 = zext i32 %add to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca %struct.Process, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp44 = icmp sgt i32 %3, 0
br i1 %cmp44, label %for.body, label %while.cond.preheader
while.cond.preheader: ; preds = %for.body, %entry
%cmp5.not46 = icmp eq i32 %0, 0
br i1 %cmp5.not46, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %while.cond.preheader
%4 = getelementptr inbounds { i64, i64 }, ptr %x, i64 0, i32 1
%tim11 = getelementptr inbounds %struct.Process, ptr %x, i64 0, i32 1
br label %while.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.Process, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%tim = getelementptr inbounds %struct.Process, ptr %vla, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %tim)
%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 %while.cond.preheader, !llvm.loop !12
while.body: ; preds = %while.body.lr.ph, %if.end28
%ksn.049 = phi i32 [ 0, %while.body.lr.ph ], [ %ksn.1, %if.end28 ]
%head.048 = phi i32 [ 0, %while.body.lr.ph ], [ %head.1, %if.end28 ]
%tail.047 = phi i32 [ %0, %while.body.lr.ph ], [ %tail.2, %if.end28 ]
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %tail.047, %7
%spec.select = select i1 %cmp6, i32 0, i32 %tail.047
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %x) #6
%add.i = add nsw i32 %head.048, 1
%idxprom.i = sext i32 %head.048 to i64
%arrayidx.i = getelementptr inbounds %struct.Process, ptr %vla, i64 %idxprom.i
%retval.sroa.0.0.copyload.i = load i64, ptr %arrayidx.i, align 16, !tbaa.struct !9
%retval.sroa.2.0.arrayidx.sroa_idx.i = getelementptr inbounds i8, ptr %arrayidx.i, i64 8
%retval.sroa.2.0.copyload.i = load i64, ptr %retval.sroa.2.0.arrayidx.sroa_idx.i, align 8, !tbaa.struct !11
store i64 %retval.sroa.0.0.copyload.i, ptr %x, align 8
store i64 %retval.sroa.2.0.copyload.i, ptr %4, align 8
%cmp8.not = icmp slt i32 %head.048, %7
%head.1 = select i1 %cmp8.not, i32 %add.i, i32 0
%8 = lshr i64 %retval.sroa.2.0.copyload.i, 32
%9 = trunc i64 %8 to i32
%10 = load i32, ptr %c, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %10, %9
%sub = sub nsw i32 %9, %10
%storemerge = select i1 %cmp12, i32 0, i32 %sub
%.pn = call i32 @llvm.smin.i32(i32 %9, i32 %10)
%ksn.1 = add nsw i32 %.pn, %ksn.049
store i32 %storemerge, ptr %tim11, align 4, !tbaa !14
%cmp22 = icmp eq i32 %storemerge, 0
br i1 %cmp22, label %if.then23, label %if.else27
if.then23: ; preds = %while.body
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %x, i32 noundef %ksn.1)
br label %if.end28
if.else27: ; preds = %while.body
%11 = load i64, ptr %4, align 8
%idxprom.i37 = sext i32 %spec.select to i64
%arrayidx.i38 = getelementptr inbounds %struct.Process, ptr %vla, i64 %idxprom.i37
store i64 %retval.sroa.0.0.copyload.i, ptr %arrayidx.i38, align 16, !tbaa.struct !9
%x.sroa.2.0.arrayidx.sroa_idx.i = getelementptr inbounds i8, ptr %arrayidx.i38, i64 8
store i64 %11, ptr %x.sroa.2.0.arrayidx.sroa_idx.i, align 8, !tbaa.struct !11
%add.i39 = add nsw i32 %spec.select, 1
br label %if.end28
if.end28: ; preds = %if.else27, %if.then23
%tail.2 = phi i32 [ %spec.select, %if.then23 ], [ %add.i39, %if.else27 ]
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %x) #6
%cmp5.not = icmp eq i32 %head.1, %tail.2
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %if.end28, %while.cond.preheader
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress 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 nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { 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 = !{i64 0, i64 11, !10, i64 12, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = !{i64 0, i64 3, !10, i64 4, i64 4, !5}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !6, i64 12}
!15 = !{!"Process", !7, i64 0, !6, i64 12}
!16 = distinct !{!16, !13}
|
#include <stdio.h>
typedef struct{
char name[10];
int time;
} P;
int main(void){
int n,q,head,tail,i,t,x;
P pro[100000];
scanf("%d %d",&n,&q);
for(i=0;i<n;i++){
scanf("%s %d",pro[i].name,&pro[i].time);
}
head = 0;
tail = n;
t = 0;
while(head != tail){
x = pro[head].time - q;
if(x <= 0){
t += pro[head].time;
printf("%s %d\n",pro[head].name,t);
if(head == 99999){
head = 0;
}
else{
head++;
}
}
else{
pro[head].time = x;
pro[tail] = pro[head];
t += q;
if(tail == 99999){
tail = 0;
}
else{
tail++;
}
if(head == 99999){
head = 0;
}
else{
head++;
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251939/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251939/source.c"
target datalayout = "e-m:e-p270: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.P = type { [10 x i8], i32 }
@.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 [7 x i8] c"%s %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
%pro = alloca [100000 x %struct.P], 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 1600000, ptr nonnull %pro) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %q)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp59 = icmp sgt i32 %0, 0
br i1 %cmp59, label %for.body, label %while.cond.preheader
while.cond.preheader: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%cmp4.not61 = icmp eq i32 %.lcssa, 0
br i1 %cmp4.not61, label %while.end, label %while.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x %struct.P], ptr %pro, i64 0, i64 %indvars.iv
%time = getelementptr inbounds [100000 x %struct.P], ptr %pro, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %time)
%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 %while.cond.preheader, !llvm.loop !9
while.body: ; preds = %while.cond.preheader, %if.end39
%head.064 = phi i32 [ %spec.select58, %if.end39 ], [ 0, %while.cond.preheader ]
%t.063 = phi i32 [ %t.1, %if.end39 ], [ 0, %while.cond.preheader ]
%tail.062 = phi i32 [ %tail.2, %if.end39 ], [ %.lcssa, %while.cond.preheader ]
%idxprom5 = sext i32 %head.064 to i64
%arrayidx6 = getelementptr inbounds [100000 x %struct.P], ptr %pro, i64 0, i64 %idxprom5
%time7 = getelementptr inbounds [100000 x %struct.P], ptr %pro, i64 0, i64 %idxprom5, i32 1
%3 = load i32, ptr %time7, align 4, !tbaa !11
%4 = load i32, ptr %q, align 4, !tbaa !5
%sub = sub nsw i32 %3, %4
%cmp8 = icmp slt i32 %sub, 1
br i1 %cmp8, label %if.then, label %if.else20
if.then: ; preds = %while.body
%add = add nsw i32 %3, %t.063
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %arrayidx6, i32 noundef %add)
br label %if.end39
if.else20: ; preds = %while.body
store i32 %sub, ptr %time7, align 4, !tbaa !11
%idxprom24 = sext i32 %tail.062 to i64
%arrayidx25 = getelementptr inbounds [100000 x %struct.P], ptr %pro, i64 0, i64 %idxprom24
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %arrayidx25, ptr noundef nonnull align 16 dereferenceable(16) %arrayidx6, i64 16, i1 false), !tbaa.struct !13
%add28 = add nsw i32 %4, %t.063
%cmp29 = icmp eq i32 %tail.062, 99999
%inc32 = add nsw i32 %tail.062, 1
%tail.1 = select i1 %cmp29, i32 0, i32 %inc32
br label %if.end39
if.end39: ; preds = %if.else20, %if.then
%tail.2 = phi i32 [ %tail.062, %if.then ], [ %tail.1, %if.else20 ]
%t.1 = phi i32 [ %add, %if.then ], [ %add28, %if.else20 ]
%cmp34 = icmp eq i32 %head.064, 99999
%inc37 = add nsw i32 %head.064, 1
%spec.select58 = select i1 %cmp34, i32 0, i32 %inc37
%cmp4.not = icmp eq i32 %spec.select58, %tail.2
br i1 %cmp4.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %if.end39, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 1600000, ptr nonnull %pro) #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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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: readwrite) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 12}
!12 = !{!"", !7, i64 0, !6, i64 12}
!13 = !{i64 0, i64 10, !14, i64 12, i64 4, !5}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#define NAME_LEN 20
#define MAX 100000
typedef struct {
char name[NAME_LEN];
int time;
} Process;
Process a[MAX];
int top, first;
void push(Process p)
{
top = (top + 1) % MAX;
a[top] = p;
}
Process pop(void)
{
Process tmp = a[first];
first = (first + 1) % MAX;
return tmp;
}
int main(void)
{
int n, q, i;
int timer = 0;
scanf("%d %d", &n, &q);
for (i = 0; i < n; i++) {
scanf("%s %d", a[i].name, &(a[i].time));
}
first = 0;
top = n - 1;
while (((top + 1) % MAX) != (first % MAX)) {
Process pro;
pro = pop();
if (pro.time <= q) {
timer += pro.time;
printf("%s %d\n", pro.name, timer);
}
else {
timer += q;
pro.time -= q;
push(pro);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_251997/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_251997/source.c"
target datalayout = "e-m:e-p270: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.Process = type { [20 x i8], i32 }
@top = dso_local local_unnamed_addr global i32 0, align 4
@a = dso_local global [100000 x %struct.Process] zeroinitializer, align 16
@first = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @push(ptr nocapture noundef readonly byval(%struct.Process) align 8 %p) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @top, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100000
store i32 %rem, ptr @top, align 4, !tbaa !5
%idxprom = sext i32 %rem to i64
%arrayidx = getelementptr inbounds [100000 x %struct.Process], ptr @a, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %arrayidx, ptr noundef nonnull align 8 dereferenceable(24) %p, i64 24, i1 false), !tbaa.struct !9
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @pop(ptr noalias nocapture writeonly sret(%struct.Process) align 4 %agg.result) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @first, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100000 x %struct.Process], ptr @a, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(24) %agg.result, ptr noundef nonnull align 8 dereferenceable(24) %arrayidx, i64 24, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100000
store i32 %rem, ptr @first, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%pro = alloca %struct.Process, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %q)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %0, 0
br i1 %cmp27, 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 [100000 x %struct.Process], ptr @a, i64 0, i64 %indvars.iv
%time = getelementptr inbounds [100000 x %struct.Process], ptr @a, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %time)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 0, ptr @first, align 4, !tbaa !5
%sub = add nsw i32 %.lcssa, -1
store i32 %sub, ptr @top, align 4, !tbaa !5
%rem30 = srem i32 %.lcssa, 100000
%cmp5.not32 = icmp eq i32 %rem30, 0
br i1 %cmp5.not32, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%time6 = getelementptr inbounds %struct.Process, ptr %pro, i64 0, i32 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%3 = phi i32 [ 0, %while.body.lr.ph ], [ %6, %if.end ]
%rem34 = phi i32 [ %rem30, %while.body.lr.ph ], [ %rem, %if.end ]
%timer.033 = phi i32 [ 0, %while.body.lr.ph ], [ %timer.1, %if.end ]
call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %pro) #5
%idxprom.i = sext i32 %3 to i64
%arrayidx.i = getelementptr inbounds [100000 x %struct.Process], ptr @a, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %pro, ptr noundef nonnull align 8 dereferenceable(24) %arrayidx.i, i64 24, i1 false)
%add.i = add nsw i32 %3, 1
%rem.i = srem i32 %add.i, 100000
store i32 %rem.i, ptr @first, align 4, !tbaa !5, !noalias !13
%4 = load i32, ptr %time6, align 4, !tbaa !16
%5 = load i32, ptr %q, align 4, !tbaa !5
%cmp7.not = icmp sgt i32 %4, %5
br i1 %cmp7.not, label %if.else, label %if.then
if.then: ; preds = %while.body
%add9 = add nsw i32 %4, %timer.033
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %pro, i32 noundef %add9)
%.pre = load i32, ptr @top, align 4, !tbaa !5
%.pre37 = load i32, ptr @first, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%add13 = add nsw i32 %5, %timer.033
%sub15 = sub nsw i32 %4, %5
store i32 %sub15, ptr %time6, align 4, !tbaa !16
store i32 %rem34, ptr @top, align 4, !tbaa !5
%idxprom.i25 = sext i32 %rem34 to i64
%arrayidx.i26 = getelementptr inbounds [100000 x %struct.Process], ptr @a, i64 0, i64 %idxprom.i25
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %arrayidx.i26, ptr noundef nonnull align 8 dereferenceable(24) %pro, i64 24, i1 false)
br label %if.end
if.end: ; preds = %if.else, %if.then
%6 = phi i32 [ %.pre37, %if.then ], [ %rem.i, %if.else ]
%7 = phi i32 [ %.pre, %if.then ], [ %rem34, %if.else ]
%timer.1 = phi i32 [ %add9, %if.then ], [ %add13, %if.else ]
call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %pro) #5
%add = add nsw i32 %7, 1
%rem = srem i32 %add, 100000
%rem4 = srem i32 %6, 100000
%cmp5.not = icmp eq i32 %rem, %rem4
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %if.end, %for.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{i64 0, i64 20, !10, i64 20, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14}
!14 = distinct !{!14, !15, !"pop: %agg.result"}
!15 = distinct !{!15, !"pop"}
!16 = !{!17, !6, i64 20}
!17 = !{!"", !7, i64 0, !6, i64 20}
!18 = distinct !{!18, !12}
|
#include <stdio.h>
#include <string.h>
#define LEN 100000
typedef struct pp{
char name[100];
int t;
}P;
P Q[LEN+1];
void enqueue(P x);
P dequeue();
int head, tail, n;
int min(int a, int b) {return a < b ? a : b;}
int main(){
int c, i, q;
int col = 0;
P u;
scanf("%d %d", &n, &q);
for (i = 1; i <= n; i++){
scanf("%s %d", Q[i].name, &Q[i].t);
}
head = 1;
tail = n+1;
while(head != tail){
u = dequeue();
c = min(q, u.t);
u.t -= c;
col += c;
if(u.t > 0){
enqueue(u);
}
else{
printf("%s %d\n", u.name, col);
}
}
return 0;
}
void enqueue(P x){
Q[tail] = x;
if ( tail == LEN ) tail = 1;
else tail++;
}
P dequeue(){
P x = Q[head];
if (head == LEN){
head = 1;
}
else head++;
return x;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252046/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252046/source.c"
target datalayout = "e-m:e-p270: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.pp = type { [100 x i8], i32 }
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %d\00", align 1
@Q = dso_local global [100001 x %struct.pp] zeroinitializer, align 16
@head = dso_local local_unnamed_addr global i32 0, align 4
@tail = dso_local local_unnamed_addr global i32 0, align 4
@.str.2 = private unnamed_addr constant [7 x i8] c"%s %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:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%q = alloca i32, align 4
%u = alloca %struct.pp, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %u) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not25 = icmp slt i32 %0, 1
br i1 %cmp.not25, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100001 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv
%t = getelementptr inbounds [100001 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %t)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 1, ptr @head, align 4, !tbaa !5
%add = add nsw i32 %.lcssa, 1
store i32 %add, ptr @tail, align 4, !tbaa !5
%cmp4.not27 = icmp eq i32 %.lcssa, 0
br i1 %cmp4.not27, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%t5 = getelementptr inbounds %struct.pp, ptr %u, i64 0, i32 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%3 = phi i32 [ %add, %while.body.lr.ph ], [ %7, %if.end ]
%4 = phi i32 [ 1, %while.body.lr.ph ], [ %8, %if.end ]
%col.028 = phi i32 [ 0, %while.body.lr.ph ], [ %add8, %if.end ]
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100001 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %u, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, i64 104, i1 false)
%cmp.i = icmp eq i32 %4, 100000
%inc.i = add nsw i32 %4, 1
%storemerge.i = select i1 %cmp.i, i32 1, i32 %inc.i
store i32 %storemerge.i, ptr @head, align 4, !tbaa !5, !noalias !11
%5 = load i32, ptr %q, align 4, !tbaa !5
%6 = load i32, ptr %t5, align 4, !tbaa !14
%cond.i = call i32 @llvm.smin.i32(i32 %5, i32 %6)
%sub = sub nsw i32 %6, %cond.i
store i32 %sub, ptr %t5, align 4, !tbaa !14
%add8 = add nsw i32 %cond.i, %col.028
%cmp10 = icmp sgt i32 %sub, 0
br i1 %cmp10, label %if.then, label %if.else
if.then: ; preds = %while.body
%idxprom.i20 = sext i32 %3 to i64
%arrayidx.i21 = getelementptr inbounds [100001 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i20
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i21, ptr noundef nonnull align 8 dereferenceable(104) %u, i64 104, i1 false)
%cmp.i22 = icmp eq i32 %3, 100000
%inc.i23 = add nsw i32 %3, 1
%storemerge.i24 = select i1 %cmp.i22, i32 1, i32 %inc.i23
store i32 %storemerge.i24, ptr @tail, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %u, i32 noundef %add8)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre31 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%7 = phi i32 [ %.pre31, %if.else ], [ %storemerge.i24, %if.then ]
%8 = phi i32 [ %.pre, %if.else ], [ %storemerge.i, %if.then ]
%cmp4.not = icmp eq i32 %8, %7
br i1 %cmp4.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %if.end, %for.end
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %u) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqueue(ptr nocapture noundef readonly byval(%struct.pp) align 8 %x) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100001 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false), !tbaa.struct !17
%cmp = icmp eq i32 %0, 100000
%inc = add nsw i32 %0, 1
%storemerge = select i1 %cmp, i32 1, i32 %inc
store i32 %storemerge, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dequeue(ptr noalias nocapture writeonly sret(%struct.pp) align 4 %agg.result) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100001 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, i64 104, i1 false), !tbaa.struct !17
%cmp = icmp eq i32 %0, 100000
%inc = add nsw i32 %0, 1
%storemerge = select i1 %cmp, i32 1, i32 %inc
store i32 %storemerge, ptr @head, align 4, !tbaa !5
ret void
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
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 nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12}
!12 = distinct !{!12, !13, !"dequeue: %agg.result"}
!13 = distinct !{!13, !"dequeue"}
!14 = !{!15, !6, i64 100}
!15 = !{!"pp", !7, i64 0, !6, i64 100}
!16 = distinct !{!16, !10}
!17 = !{i64 0, i64 100, !18, i64 100, i64 4, !5}
!18 = !{!7, !7, i64 0}
|
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int t,x,i,j,k,p,f,a,b;
char n[1000];
scanf("%d",&t);
while(t--)
{
scanf("%s",n);
x=strlen(n);
f=0; k=0; a=0; b=0;
for(i=0;i<x;i++)
{
if(n[i]=='?')
{
k++;
}
else if(n[i]=='(') a++;
else
{
b++;
}
}
if(n[0]==')'||n[x-1]=='(') printf("NO\n");
else if( (a+b)%2==0&&k%2==1) printf("NO\n");
else if( (a+b)%2==1&&k%2==0 ) printf("NO\n");
else
{
printf("YES\n");
}
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25209/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25209/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@str.6 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca [1000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec75 = add nsw i32 %0, -1
store i32 %dec75, ptr %t, align 4, !tbaa !5
%tobool.not76 = icmp eq i32 %0, 0
br i1 %tobool.not76, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end53
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %n) #6
%conv = trunc i64 %call3 to i32
%cmp68 = icmp sgt i32 %conv, 0
br i1 %cmp68, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %while.body
%wide.trip.count = and i64 %call3, 4294967295
%xtraiter = and i64 %call3, 1
%1 = icmp eq i64 %wide.trip.count, 1
br i1 %1, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = sub nsw i64 %wide.trip.count, %xtraiter
br label %for.body
for.body: ; preds = %for.inc.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.inc.1 ]
%b.072 = phi i32 [ 0, %for.body.preheader.new ], [ %b.1.1, %for.inc.1 ]
%a.071 = phi i32 [ 0, %for.body.preheader.new ], [ %a.1.1, %for.inc.1 ]
%k.069 = phi i32 [ 0, %for.body.preheader.new ], [ %k.1.1, %for.inc.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.inc.1 ]
%arrayidx = getelementptr inbounds [1000 x i8], ptr %n, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 2, !tbaa !9
switch i8 %2, label %if.else15 [
i8 63, label %if.then
i8 40, label %if.then13
]
if.then: ; preds = %for.body
%inc = add nsw i32 %k.069, 1
br label %for.inc
if.then13: ; preds = %for.body
%inc14 = add nsw i32 %a.071, 1
br label %for.inc
if.else15: ; preds = %for.body
%inc16 = add nsw i32 %b.072, 1
br label %for.inc
for.inc: ; preds = %if.then, %if.else15, %if.then13
%k.1 = phi i32 [ %inc, %if.then ], [ %k.069, %if.then13 ], [ %k.069, %if.else15 ]
%a.1 = phi i32 [ %a.071, %if.then ], [ %inc14, %if.then13 ], [ %a.071, %if.else15 ]
%b.1 = phi i32 [ %b.072, %if.then ], [ %b.072, %if.then13 ], [ %inc16, %if.else15 ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1000 x i8], ptr %n, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx.1, align 1, !tbaa !9
switch i8 %3, label %if.else15.1 [
i8 63, label %if.then.1
i8 40, label %if.then13.1
]
if.then13.1: ; preds = %for.inc
%inc14.1 = add nsw i32 %a.1, 1
br label %for.inc.1
if.then.1: ; preds = %for.inc
%inc.1 = add nsw i32 %k.1, 1
br label %for.inc.1
if.else15.1: ; preds = %for.inc
%inc16.1 = add nsw i32 %b.1, 1
br label %for.inc.1
for.inc.1: ; preds = %if.else15.1, %if.then.1, %if.then13.1
%k.1.1 = phi i32 [ %inc.1, %if.then.1 ], [ %k.1, %if.then13.1 ], [ %k.1, %if.else15.1 ]
%a.1.1 = phi i32 [ %a.1, %if.then.1 ], [ %inc14.1, %if.then13.1 ], [ %a.1, %if.else15.1 ]
%b.1.1 = phi i32 [ %b.1, %if.then.1 ], [ %b.1, %if.then13.1 ], [ %inc16.1, %if.else15.1 ]
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !10
for.end.loopexit.unr-lcssa: ; preds = %for.inc.1, %for.body.preheader
%k.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %k.1.1, %for.inc.1 ]
%a.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %a.1.1, %for.inc.1 ]
%b.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %b.1.1, %for.inc.1 ]
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.inc.1 ]
%b.072.unr = phi i32 [ 0, %for.body.preheader ], [ %b.1.1, %for.inc.1 ]
%a.071.unr = phi i32 [ 0, %for.body.preheader ], [ %a.1.1, %for.inc.1 ]
%k.069.unr = phi i32 [ 0, %for.body.preheader ], [ %k.1.1, %for.inc.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds [1000 x i8], ptr %n, i64 0, i64 %indvars.iv.unr
%4 = load i8, ptr %arrayidx.epil, align 1, !tbaa !9
switch i8 %4, label %if.else15.epil [
i8 63, label %if.then.epil
i8 40, label %if.then13.epil
]
if.then13.epil: ; preds = %for.body.epil
%inc14.epil = add nsw i32 %a.071.unr, 1
br label %for.end
if.then.epil: ; preds = %for.body.epil
%inc.epil = add nsw i32 %k.069.unr, 1
br label %for.end
if.else15.epil: ; preds = %for.body.epil
%inc16.epil = add nsw i32 %b.072.unr, 1
br label %for.end
for.end: ; preds = %for.end.loopexit.unr-lcssa, %if.else15.epil, %if.then.epil, %if.then13.epil, %while.body
%k.0.lcssa = phi i32 [ 0, %while.body ], [ %k.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %inc.epil, %if.then.epil ], [ %k.069.unr, %if.then13.epil ], [ %k.069.unr, %if.else15.epil ]
%a.0.lcssa = phi i32 [ 0, %while.body ], [ %a.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %a.071.unr, %if.then.epil ], [ %inc14.epil, %if.then13.epil ], [ %a.071.unr, %if.else15.epil ]
%b.0.lcssa = phi i32 [ 0, %while.body ], [ %b.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %b.072.unr, %if.then.epil ], [ %b.072.unr, %if.then13.epil ], [ %inc16.epil, %if.else15.epil ]
%5 = load i8, ptr %n, align 16, !tbaa !9
%cmp21 = icmp eq i8 %5, 41
br i1 %cmp21, label %if.end53, label %lor.lhs.false
lor.lhs.false: ; preds = %for.end
%sub = shl i64 %call3, 32
%sext = add i64 %sub, -4294967296
%idxprom23 = ashr exact i64 %sext, 32
%arrayidx24 = getelementptr inbounds [1000 x i8], ptr %n, i64 0, i64 %idxprom23
%6 = load i8, ptr %arrayidx24, align 1, !tbaa !9
%cmp26 = icmp eq i8 %6, 40
br i1 %cmp26, label %if.end53, label %if.else30
if.else30: ; preds = %lor.lhs.false
%add = add nsw i32 %b.0.lcssa, %a.0.lcssa
%rem = srem i32 %add, 2
%cmp31 = icmp eq i32 %rem, 0
%7 = and i32 %k.0.lcssa, -2147483647
%cmp34 = icmp eq i32 %7, 1
%or.cond = select i1 %cmp31, i1 %cmp34, i1 false
br i1 %or.cond, label %if.end53, label %if.else38
if.else38: ; preds = %if.else30
%cmp41 = icmp eq i32 %rem, 1
%8 = and i32 %k.0.lcssa, 1
%cmp45 = icmp eq i32 %8, 0
%or.cond67 = select i1 %cmp41, i1 %cmp45, i1 false
%str.4.str = select i1 %or.cond67, ptr @str.6, ptr @str
br label %if.end53
if.end53: ; preds = %if.else38, %if.else30, %for.end, %lor.lhs.false
%str.5.sink = phi ptr [ @str.6, %lor.lhs.false ], [ @str.6, %for.end ], [ @str.6, %if.else30 ], [ %str.4.str, %if.else38 ]
%puts65 = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.sink)
%9 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %9, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %9, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %if.end53, %entry
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include<stdio.h>
#define N 100000
typedef struct pp{
char name[100];
int t;
}Trump;
int h, sh, n, c=0, q;
Trump Q[N];
void mes(){
Q[h].t = Q[h].t -q;
Q[sh] = Q[h];
if(sh > n+1) sh = 0;
else sh++;
}
int main(){
int i;
scanf("%d %d", &n, &q);
for ( i = 1; i <= n; i++){
scanf("%s", Q[i].name);
scanf("%d", &Q[i].t);
}
h = 1;
sh = n+1;
i = 1;
while(h != sh){
if(Q[h].t > q){
mes();
c = c + q;
}
else{
printf("%s %d\n",Q[h].name, Q[h].t+c);
c = c + Q[h].t;
}
if(h > n+1) h = 0;
else h++;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252132/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252132/source.c"
target datalayout = "e-m:e-p270: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.pp = type { [100 x i8], i32 }
@c = dso_local local_unnamed_addr global i32 0, align 4
@Q = dso_local global [100000 x %struct.pp] zeroinitializer, align 16
@h = dso_local local_unnamed_addr global i32 0, align 4
@q = dso_local global i32 0, align 4
@sh = dso_local local_unnamed_addr global i32 0, align 4
@n = dso_local global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @mes() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @h, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%t = getelementptr inbounds [100000 x %struct.pp], ptr @Q, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %t, align 4, !tbaa !9
%2 = load i32, ptr @q, align 4, !tbaa !5
%sub = sub nsw i32 %1, %2
store i32 %sub, ptr %t, align 4, !tbaa !9
%3 = load i32, ptr @sh, align 4, !tbaa !5
%idxprom4 = sext i32 %3 to i64
%arrayidx5 = getelementptr inbounds [100000 x %struct.pp], ptr @Q, i64 0, i64 %idxprom4
%arrayidx7 = getelementptr inbounds [100000 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx5, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx7, i64 104, i1 false), !tbaa.struct !11
%4 = load i32, ptr @n, align 4, !tbaa !5
%add = add nsw i32 %4, 1
%cmp = icmp sgt i32 %3, %add
%inc = add nsw i32 %3, 1
%storemerge = select i1 %cmp, i32 0, i32 %inc
store i32 %storemerge, ptr @sh, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not36 = icmp slt i32 %0, 1
br i1 %cmp.not36, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100000 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%t = getelementptr inbounds [100000 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 1, ptr @h, align 4, !tbaa !5
%add = add nsw i32 %.lcssa, 1
store i32 %add, ptr @sh, align 4, !tbaa !5
%cmp5.not38 = icmp eq i32 %.lcssa, 0
br i1 %cmp5.not38, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %for.end
%.pre41 = load i32, ptr @q, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.preheader, %if.end
%3 = phi i32 [ %14, %if.end ], [ %.lcssa, %while.body.preheader ]
%4 = phi i32 [ %16, %if.end ], [ %.pre41, %while.body.preheader ]
%5 = phi i32 [ %13, %if.end ], [ %add, %while.body.preheader ]
%6 = phi i32 [ %storemerge35, %if.end ], [ 1, %while.body.preheader ]
%idxprom6 = sext i32 %6 to i64
%t8 = getelementptr inbounds [100000 x %struct.pp], ptr @Q, i64 0, i64 %idxprom6, i32 1
%7 = load i32, ptr %t8, align 4, !tbaa !9
%cmp9 = icmp sgt i32 %7, %4
br i1 %cmp9, label %if.then, label %if.else
if.then: ; preds = %while.body
%sub.i = sub nsw i32 %7, %4
store i32 %sub.i, ptr %t8, align 4, !tbaa !9
%idxprom4.i = sext i32 %5 to i64
%arrayidx5.i = getelementptr inbounds [100000 x %struct.pp], ptr @Q, i64 0, i64 %idxprom4.i
%arrayidx7.i = getelementptr inbounds [100000 x %struct.pp], ptr @Q, i64 0, i64 %idxprom6
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx5.i, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx7.i, i64 104, i1 false), !tbaa.struct !11
%add.i = add nsw i32 %3, 1
%cmp.i = icmp sgt i32 %5, %add.i
%inc.i = add nsw i32 %5, 1
%storemerge.i = select i1 %cmp.i, i32 0, i32 %inc.i
store i32 %storemerge.i, ptr @sh, align 4, !tbaa !5
%8 = load i32, ptr @c, align 4, !tbaa !5
%add10 = add nsw i32 %8, %4
br label %if.end
if.else: ; preds = %while.body
%arrayidx7 = getelementptr inbounds [100000 x %struct.pp], ptr @Q, i64 0, i64 %idxprom6
%9 = load i32, ptr @c, align 4, !tbaa !5
%add18 = add nsw i32 %9, %7
%call19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %arrayidx7, i32 noundef %add18)
%10 = load i32, ptr @c, align 4, !tbaa !5
%11 = load i32, ptr @h, align 4, !tbaa !5
%idxprom20 = sext i32 %11 to i64
%t22 = getelementptr inbounds [100000 x %struct.pp], ptr @Q, i64 0, i64 %idxprom20, i32 1
%12 = load i32, ptr %t22, align 4, !tbaa !9
%add23 = add nsw i32 %12, %10
%.pre = load i32, ptr @q, align 4, !tbaa !5
%.pre42 = load i32, ptr @n, align 4, !tbaa !5
%.pre43 = load i32, ptr @sh, align 4, !tbaa !5
%.pre44 = add nsw i32 %.pre42, 1
br label %if.end
if.end: ; preds = %if.else, %if.then
%add24.pre-phi = phi i32 [ %.pre44, %if.else ], [ %add.i, %if.then ]
%13 = phi i32 [ %.pre43, %if.else ], [ %storemerge.i, %if.then ]
%14 = phi i32 [ %.pre42, %if.else ], [ %3, %if.then ]
%15 = phi i32 [ %11, %if.else ], [ %6, %if.then ]
%16 = phi i32 [ %.pre, %if.else ], [ %4, %if.then ]
%storemerge = phi i32 [ %add23, %if.else ], [ %add10, %if.then ]
store i32 %storemerge, ptr @c, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %15, %add24.pre-phi
%inc28 = add nsw i32 %15, 1
%storemerge35 = select i1 %cmp25, i32 0, i32 %inc28
store i32 %storemerge35, ptr @h, align 4, !tbaa !5
%cmp5.not = icmp eq i32 %storemerge35, %13
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %if.end, %for.end
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree 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" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 100}
!10 = !{!"pp", !7, i64 0, !6, i64 100}
!11 = !{i64 0, i64 100, !12, i64 100, i64 4, !5}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
|
#include <stdio.h>
#include <string.h>
#define LEN 100005
typedef struct pp {
char name[100];
int t;
} P;
P Q[LEN];
int head, tail;
void enqueue(P x) {
Q[tail] = x;
tail = (tail + 1) % LEN;
}
P dequeue() {
P x = Q[head];
head = (head + 1) % LEN;
return x;
}
int main() {
int i, q, n, LANtime = 0;
P u;
scanf("%d %d", &n, &q);
for (i = 0; i < n; i++) {
scanf("%s", Q[i].name);
scanf("%d", &Q[i].t);
}
head = 0; tail = n;
while (head != tail) {
u = dequeue();
if (u.t > q) {
LANtime += q;
u.t -= q;
enqueue(u);
}
else {
LANtime += u.t;
printf("%s %d\n", u.name, LANtime);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252176/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252176/source.c"
target datalayout = "e-m:e-p270: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.pp = type { [100 x i8], i32 }
@Q = dso_local global [100005 x %struct.pp] zeroinitializer, align 16
@tail = dso_local local_unnamed_addr global i32 0, align 4
@head = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqueue(ptr nocapture noundef readonly byval(%struct.pp) align 8 %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dequeue(ptr noalias nocapture writeonly sret(%struct.pp) align 4 %agg.result) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @head, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%q = alloca i32, align 4
%n = alloca i32, align 4
%u = alloca %struct.pp, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %u) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %q)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %0, 0
br i1 %cmp25, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%t = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 0, ptr @head, align 4, !tbaa !5
store i32 %.lcssa, ptr @tail, align 4, !tbaa !5
%cmp5.not27 = icmp eq i32 %.lcssa, 0
br i1 %cmp5.not27, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%t6 = getelementptr inbounds %struct.pp, ptr %u, i64 0, i32 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%3 = phi i32 [ %.lcssa, %while.body.lr.ph ], [ %7, %if.end ]
%4 = phi i32 [ 0, %while.body.lr.ph ], [ %8, %if.end ]
%LANtime.028 = phi i32 [ 0, %while.body.lr.ph ], [ %LANtime.1, %if.end ]
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %u, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, i64 104, i1 false)
%add.i = add nsw i32 %4, 1
%rem.i = srem i32 %add.i, 100005
store i32 %rem.i, ptr @head, align 4, !tbaa !5, !noalias !13
%5 = load i32, ptr %t6, align 4, !tbaa !16
%6 = load i32, ptr %q, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %5, %6
br i1 %cmp7, label %if.then, label %if.else
if.then: ; preds = %while.body
%add = add nsw i32 %6, %LANtime.028
%sub = sub nsw i32 %5, %6
store i32 %sub, ptr %t6, align 4, !tbaa !16
%idxprom.i21 = sext i32 %3 to i64
%arrayidx.i22 = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i21
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i22, ptr noundef nonnull align 8 dereferenceable(104) %u, i64 104, i1 false)
%add.i23 = add nsw i32 %3, 1
%rem.i24 = srem i32 %add.i23, 100005
store i32 %rem.i24, ptr @tail, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%add10 = add nsw i32 %5, %LANtime.028
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %u, i32 noundef %add10)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre31 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%7 = phi i32 [ %rem.i24, %if.then ], [ %.pre31, %if.else ]
%8 = phi i32 [ %rem.i, %if.then ], [ %.pre, %if.else ]
%LANtime.1 = phi i32 [ %add, %if.then ], [ %add10, %if.else ]
%cmp5.not = icmp eq i32 %8, %7
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %if.end, %for.end
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %u) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{i64 0, i64 100, !10, i64 100, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14}
!14 = distinct !{!14, !15, !"dequeue: %agg.result"}
!15 = distinct !{!15, !"dequeue"}
!16 = !{!17, !6, i64 100}
!17 = !{!"pp", !7, i64 0, !6, i64 100}
!18 = distinct !{!18, !12}
|
#include<stdio.h>
#include<string.h>
#define LONG 100005
typedef struct po
{
char name[100];
int time;
}P;
P Que[LONG];
int head,tail,n;
P deque()
{
P x =Que[head];
head=(head+1)%LONG;
return x;
}
void enqu(P x)
{
Que[tail]=x;
tail = (tail + 1)%LONG;
}
int min(int a,int b)
{
return a<b ?a:b;
}
int main()
{
int lap=0,c;
int i,q;
P u;
scanf("%d %d",&n,&q);
for(i=1;i<=n;i++)
{
scanf("%s",Que[i].name);
scanf("%d",&Que[i].time);
}
head=1;tail = n+1;
while(head!=tail)
{
u = deque();
c = min(q,u.time);
u.time-=c;
lap +=c;
if(u.time>0)enqu(u);
else
{
printf("%s %d\n",u.name,lap);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252219/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252219/source.c"
target datalayout = "e-m:e-p270: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.po = type { [100 x i8], i32 }
@Que = dso_local global [100005 x %struct.po] zeroinitializer, align 16
@head = dso_local local_unnamed_addr global i32 0, align 4
@tail = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @deque(ptr noalias nocapture writeonly sret(%struct.po) align 4 %agg.result) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.po], ptr @Que, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @head, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqu(ptr nocapture noundef readonly byval(%struct.po) align 8 %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.po], ptr @Que, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%q = alloca i32, align 4
%u = alloca %struct.po, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %u) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not25 = icmp slt i32 %0, 1
br i1 %cmp.not25, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100005 x %struct.po], ptr @Que, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%time = getelementptr inbounds [100005 x %struct.po], ptr @Que, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %time)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 1, ptr @head, align 4, !tbaa !5
%add = add nsw i32 %.lcssa, 1
store i32 %add, ptr @tail, align 4, !tbaa !5
%cmp5.not27 = icmp eq i32 %.lcssa, 0
br i1 %cmp5.not27, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%time6 = getelementptr inbounds %struct.po, ptr %u, i64 0, i32 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%3 = phi i32 [ %add, %while.body.lr.ph ], [ %7, %if.end ]
%4 = phi i32 [ 1, %while.body.lr.ph ], [ %8, %if.end ]
%lap.028 = phi i32 [ 0, %while.body.lr.ph ], [ %add9, %if.end ]
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100005 x %struct.po], ptr @Que, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %u, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, i64 104, i1 false)
%add.i = add nsw i32 %4, 1
%rem.i = srem i32 %add.i, 100005
store i32 %rem.i, ptr @head, align 4, !tbaa !5, !noalias !13
%5 = load i32, ptr %q, align 4, !tbaa !5
%6 = load i32, ptr %time6, align 4, !tbaa !16
%cond.i = call i32 @llvm.smin.i32(i32 %5, i32 %6)
%sub = sub nsw i32 %6, %cond.i
store i32 %sub, ptr %time6, align 4, !tbaa !16
%add9 = add nsw i32 %cond.i, %lap.028
%cmp11 = icmp sgt i32 %sub, 0
br i1 %cmp11, label %if.then, label %if.else
if.then: ; preds = %while.body
%idxprom.i21 = sext i32 %3 to i64
%arrayidx.i22 = getelementptr inbounds [100005 x %struct.po], ptr @Que, i64 0, i64 %idxprom.i21
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i22, ptr noundef nonnull align 8 dereferenceable(104) %u, i64 104, i1 false)
%add.i23 = add nsw i32 %3, 1
%rem.i24 = srem i32 %add.i23, 100005
store i32 %rem.i24, ptr @tail, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %u, i32 noundef %add9)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre31 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%7 = phi i32 [ %.pre31, %if.else ], [ %rem.i24, %if.then ]
%8 = phi i32 [ %.pre, %if.else ], [ %rem.i, %if.then ]
%cmp5.not = icmp eq i32 %8, %7
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %if.end, %for.end
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %u) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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) #4
; 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 0, i64 100, !10, i64 100, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14}
!14 = distinct !{!14, !15, !"deque: %agg.result"}
!15 = distinct !{!15, !"deque"}
!16 = !{!17, !6, i64 100}
!17 = !{!"po", !7, i64 0, !6, i64 100}
!18 = distinct !{!18, !12}
|
/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <stdio.h>
#define max(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; })
int main()
{
int t;
scanf("%d" , &t);
for(int i = 0; i < t; i++)
{
int n;
scanf("%d" , &n);
int arr1[n];
int sum1 = 0;
int max1 = 0;
for(int j = 0; j < n; j++)
{
scanf("%d" , &arr1[j]);
sum1 = sum1 + arr1[j];
max1 = max(sum1 , max1);
}
int m;
int sum2 = 0;
int max2 = 0;
scanf("%d" , &m);
int arr2[m];
for(int j = 0; j < m; j++)
{
scanf("%d" , &arr2[j]);
sum2 = sum2 + arr2[j];
max2 = max(sum2 , max2);
}
printf("%d\n" , max1+max2);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25227/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25227/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%t = alloca i32, align 4
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp63 = icmp sgt i32 %0, 0
br i1 %cmp63, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup15, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
for.body: ; preds = %entry, %for.cond.cleanup15
%i.064 = phi i32 [ %inc37, %for.cond.cleanup15 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%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 !5
%cmp354 = icmp sgt i32 %4, 0
br i1 %cmp354, label %for.body5, label %for.cond.cleanup4
for.cond.cleanup4: ; preds = %for.body5, %for.body
%max1.0.lcssa = phi i32 [ 0, %for.body ], [ %cond, %for.body5 ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%5 = load i32, ptr %m, align 4, !tbaa !5
%6 = zext i32 %5 to i64
%vla11 = alloca i32, i64 %6, align 16
%cmp1458 = icmp sgt i32 %5, 0
br i1 %cmp1458, label %for.body16, label %for.cond.cleanup15
for.body5: ; preds = %for.body, %for.body5
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body5 ], [ 0, %for.body ]
%sum1.057 = phi i32 [ %add, %for.body5 ], [ 0, %for.body ]
%max1.056 = phi i32 [ %cond, %for.body5 ], [ 0, %for.body ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%7 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %7, %sum1.057
%cond = call i32 @llvm.smax.i32(i32 %add, i32 %max1.056)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp3 = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp3, label %for.body5, label %for.cond.cleanup4, !llvm.loop !9
for.cond.cleanup15: ; preds = %for.body16, %for.cond.cleanup4
%max2.0.lcssa = phi i32 [ 0, %for.cond.cleanup4 ], [ %cond30, %for.body16 ]
%add34 = add nuw nsw i32 %max2.0.lcssa, %max1.0.lcssa
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add34)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.stackrestore.p0(ptr %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
%inc37 = add nuw nsw i32 %i.064, 1
%10 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc37, %10
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
for.body16: ; preds = %for.cond.cleanup4, %for.body16
%indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.body16 ], [ 0, %for.cond.cleanup4 ]
%max2.060 = phi i32 [ %cond30, %for.body16 ], [ 0, %for.cond.cleanup4 ]
%sum2.059 = phi i32 [ %add22, %for.body16 ], [ 0, %for.cond.cleanup4 ]
%arrayidx18 = getelementptr inbounds i32, ptr %vla11, i64 %indvars.iv66
%call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx18)
%11 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%add22 = add nsw i32 %11, %sum2.059
%cond30 = call i32 @llvm.smax.i32(i32 %add22, i32 %max2.060)
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%12 = load i32, ptr %m, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp14 = icmp slt i64 %indvars.iv.next67, %13
br i1 %cmp14, label %for.body16, label %for.cond.cleanup15, !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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<string.h>
#define LEN 100005
typedef struct pp{
char name[100];
int t;
}P;
P Q[LEN+1];
int head, tail, n;
void enqueue(P );
P dequeue(void);
int calc(int,int);
int main(){
int e=0,c;
int i,q;
P u;
scanf("%d %d\n", &n, &q);
for ( i = 1; i <= n; i++){
scanf("%s", Q[i].name);
scanf("%d",&Q[i].t);
}
head = 1;
tail = n+1;
while(head != tail){
u = dequeue();
c = calc(q,u.t);
u.t -= c;;
e += c;
if(u.t > 0){
enqueue(u);
}
else{
printf("%s %d\n", u.name ,e);
}
}
return 0;
}
P dequeue(){
P x;
x = Q[head];
head = (head+1)%LEN;
return x;
}
void enqueue(P x){
Q[tail] = x;
tail = (tail + 1)%LEN;
}
int calc(int x, int y){
return x < y ? x:y;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252312/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252312/source.c"
target datalayout = "e-m:e-p270: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.pp = type { [100 x i8], i32 }
@.str = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@Q = dso_local global [100006 x %struct.pp] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@head = dso_local local_unnamed_addr global i32 0, align 4
@tail = dso_local local_unnamed_addr global i32 0, align 4
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%q = alloca i32, align 4
%u = alloca %struct.pp, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %u) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not25 = icmp slt i32 %0, 1
br i1 %cmp.not25, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%t = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 1, ptr @head, align 4, !tbaa !5
%add = add nsw i32 %.lcssa, 1
store i32 %add, ptr @tail, align 4, !tbaa !5
%cmp5.not27 = icmp eq i32 %.lcssa, 0
br i1 %cmp5.not27, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%t6 = getelementptr inbounds %struct.pp, ptr %u, i64 0, i32 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%3 = phi i32 [ %add, %while.body.lr.ph ], [ %7, %if.end ]
%4 = phi i32 [ 1, %while.body.lr.ph ], [ %8, %if.end ]
%e.028 = phi i32 [ 0, %while.body.lr.ph ], [ %add9, %if.end ]
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %u, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, i64 104, i1 false)
%add.i = add nsw i32 %4, 1
%rem.i = srem i32 %add.i, 100005
store i32 %rem.i, ptr @head, align 4, !tbaa !5, !noalias !11
%5 = load i32, ptr %q, align 4, !tbaa !5
%6 = load i32, ptr %t6, align 4, !tbaa !14
%cond.i = call i32 @llvm.smin.i32(i32 %5, i32 %6)
%sub = sub nsw i32 %6, %cond.i
store i32 %sub, ptr %t6, align 4, !tbaa !14
%add9 = add nsw i32 %cond.i, %e.028
%cmp11 = icmp sgt i32 %sub, 0
br i1 %cmp11, label %if.then, label %if.else
if.then: ; preds = %while.body
%idxprom.i21 = sext i32 %3 to i64
%arrayidx.i22 = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i21
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i22, ptr noundef nonnull align 8 dereferenceable(104) %u, i64 104, i1 false)
%add.i23 = add nsw i32 %3, 1
%rem.i24 = srem i32 %add.i23, 100005
store i32 %rem.i24, ptr @tail, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %u, i32 noundef %add9)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre31 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%7 = phi i32 [ %.pre31, %if.else ], [ %rem.i24, %if.then ]
%8 = phi i32 [ %.pre, %if.else ], [ %rem.i, %if.then ]
%cmp5.not = icmp eq i32 %8, %7
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %if.end, %for.end
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %u) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dequeue(ptr noalias nocapture writeonly sret(%struct.pp) align 4 %agg.result) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, i64 104, i1 false), !tbaa.struct !17
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @head, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @calc(i32 noundef %x, i32 noundef %y) local_unnamed_addr #5 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %x, i32 %y)
ret i32 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqueue(ptr nocapture noundef readonly byval(%struct.pp) align 8 %x) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false), !tbaa.struct !17
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @tail, align 4, !tbaa !5
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.smin.i32(i32, i32) #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12}
!12 = distinct !{!12, !13, !"dequeue: %agg.result"}
!13 = distinct !{!13, !"dequeue"}
!14 = !{!15, !6, i64 100}
!15 = !{!"pp", !7, i64 0, !6, i64 100}
!16 = distinct !{!16, !10}
!17 = !{i64 0, i64 100, !18, i64 100, i64 4, !5}
!18 = !{!7, !7, i64 0}
|
#include<stdio.h>
#include<string.h>
#define LEN 100000
typedef struct p{
char name[100];
int time;
} P;
P Q[LEN];
int head, tail, n;
void enqueue(P x){
Q[tail] = x;
tail = (tail+1) % LEN;
}
P dequeue(){
P x = Q[head];
head = (head+1) % LEN;
return x;
}
int min(int a, int b){
return a < b ? a : b;
}
int main(){
int elaps = 0, c;
int i, q;
P u;
scanf("%d %d", &n, &q);
for(int i=1; i<=n; i++){
scanf("%s", Q[i].name);
scanf("%d", &Q[i].time);
}
head = 1;
tail = n+1;
while(head!=tail){
u = dequeue();
c = min(q, u.time);
u.time -= c;
elaps += c;
if(u.time > 0) enqueue(u);
else{
printf("%s %d\n", u.name, elaps);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252363/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252363/source.c"
target datalayout = "e-m:e-p270: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.p = type { [100 x i8], i32 }
@Q = dso_local global [100000 x %struct.p] zeroinitializer, align 16
@tail = dso_local local_unnamed_addr global i32 0, align 4
@head = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqueue(ptr nocapture noundef readonly byval(%struct.p) align 8 %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100000 x %struct.p], ptr @Q, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100000
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dequeue(ptr noalias nocapture writeonly sret(%struct.p) align 4 %agg.result) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100000 x %struct.p], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100000
store i32 %rem, ptr @head, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%q = alloca i32, align 4
%u = alloca %struct.p, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %u) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not26 = icmp slt i32 %0, 1
br i1 %cmp.not26, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 1, ptr @head, align 4, !tbaa !5
%add = add nsw i32 %.lcssa, 1
store i32 %add, ptr @tail, align 4, !tbaa !5
%cmp6.not28 = icmp eq i32 %.lcssa, 0
br i1 %cmp6.not28, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.cond.cleanup
%time7 = getelementptr inbounds %struct.p, ptr %u, i64 0, i32 1
br label %while.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100000 x %struct.p], ptr @Q, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%time = getelementptr inbounds [100000 x %struct.p], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %time)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.cond.cleanup, !llvm.loop !11
while.body: ; preds = %while.body.lr.ph, %if.end
%3 = phi i32 [ %add, %while.body.lr.ph ], [ %7, %if.end ]
%4 = phi i32 [ 1, %while.body.lr.ph ], [ %8, %if.end ]
%elaps.029 = phi i32 [ 0, %while.body.lr.ph ], [ %add10, %if.end ]
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100000 x %struct.p], ptr @Q, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %u, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, i64 104, i1 false)
%add.i = add nsw i32 %4, 1
%rem.i = srem i32 %add.i, 100000
store i32 %rem.i, ptr @head, align 4, !tbaa !5, !noalias !13
%5 = load i32, ptr %q, align 4, !tbaa !5
%6 = load i32, ptr %time7, align 4, !tbaa !16
%cond.i = call i32 @llvm.smin.i32(i32 %5, i32 %6)
%sub = sub nsw i32 %6, %cond.i
store i32 %sub, ptr %time7, align 4, !tbaa !16
%add10 = add nsw i32 %cond.i, %elaps.029
%cmp12 = icmp sgt i32 %sub, 0
br i1 %cmp12, label %if.then, label %if.else
if.then: ; preds = %while.body
%idxprom.i22 = sext i32 %3 to i64
%arrayidx.i23 = getelementptr inbounds [100000 x %struct.p], ptr @Q, i64 0, i64 %idxprom.i22
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i23, ptr noundef nonnull align 8 dereferenceable(104) %u, i64 104, i1 false)
%add.i24 = add nsw i32 %3, 1
%rem.i25 = srem i32 %add.i24, 100000
store i32 %rem.i25, ptr @tail, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %u, i32 noundef %add10)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre32 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%7 = phi i32 [ %.pre32, %if.else ], [ %rem.i25, %if.then ]
%8 = phi i32 [ %.pre, %if.else ], [ %rem.i, %if.then ]
%cmp6.not = icmp eq i32 %8, %7
br i1 %cmp6.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %if.end, %for.cond.cleanup
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %u) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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) #4
; 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 0, i64 100, !10, i64 100, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14}
!14 = distinct !{!14, !15, !"dequeue: %agg.result"}
!15 = distinct !{!15, !"dequeue"}
!16 = !{!17, !6, i64 100}
!17 = !{!"p", !7, i64 0, !6, i64 100}
!18 = distinct !{!18, !12}
|
#include <stdio.h>
#include <stdlib.h>
#define MAX_PROCESSES 100000
typedef struct {
char name[16];
int time;
} Process;
Process *queue[MAX_PROCESSES];
int p = 0, q = 0;
void push(Process *proc) {
queue[p++] = proc;
if (p >= MAX_PROCESSES) p = 0;
}
Process *unshift() {
Process *proc = queue[q++];
if (q >= MAX_PROCESSES) q = 0;
return proc;
}
int main(int argc, char *argv[]) {
int n, qu;
int time = 0;
scanf("%d %d", &n, &qu);
for (int i = 0; i < n; i++) {
Process *proc = malloc(sizeof(Process));
scanf("%s %d", proc->name, &proc->time);
push(proc);
}
while (p != q) {
Process *proc = unshift();
if (proc->time <= qu) {
time += proc->time;
printf("%s %d\n", proc->name, time);
free(proc);
continue;
}
proc->time -= qu;
time += qu;
push(proc);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252406/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252406/source.c"
target datalayout = "e-m:e-p270: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.Process = type { [16 x i8], i32 }
@p = dso_local local_unnamed_addr global i32 0, align 4
@q = dso_local local_unnamed_addr global i32 0, align 4
@queue = dso_local local_unnamed_addr global [100000 x ptr] 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 [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(ptr noundef %proc) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @p, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @p, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100000 x ptr], ptr @queue, i64 0, i64 %idxprom
store ptr %proc, ptr %arrayidx, align 8, !tbaa !9
%cmp = icmp sgt i32 %0, 99998
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i32 0, ptr @p, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local ptr @unshift() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @q, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100000 x ptr], ptr @queue, i64 0, i64 %idxprom
%1 = load ptr, ptr %arrayidx, align 8, !tbaa !9
%cmp = icmp sgt i32 %0, 99998
%spec.store.select = select i1 %cmp, i32 0, i32 %inc
store i32 %spec.store.select, ptr @q, align 4
ret ptr %1
}
; 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 i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%qu = 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 %qu) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %qu)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp36 = icmp sgt i32 %0, 0
br i1 %cmp36, label %for.body, label %entry.while.cond.preheader_crit_edge
entry.while.cond.preheader_crit_edge: ; preds = %entry
%.pre = load i32, ptr @p, align 4, !tbaa !5
br label %while.cond.preheader
while.cond.preheader: ; preds = %push.exit, %entry.while.cond.preheader_crit_edge
%1 = phi i32 [ %.pre, %entry.while.cond.preheader_crit_edge ], [ %4, %push.exit ]
%2 = load i32, ptr @q, align 4, !tbaa !5
%cmp4.not38 = icmp eq i32 %1, %2
br i1 %cmp4.not38, label %while.end, label %while.body
for.body: ; preds = %entry, %push.exit
%i.037 = phi i32 [ %inc, %push.exit ], [ 0, %entry ]
%call1 = call noalias dereferenceable_or_null(20) ptr @malloc(i64 noundef 20) #7
%time2 = getelementptr inbounds %struct.Process, ptr %call1, i64 0, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %call1, ptr noundef nonnull %time2)
%3 = load i32, ptr @p, align 4, !tbaa !5
%inc.i = add nsw i32 %3, 1
store i32 %inc.i, ptr @p, align 4, !tbaa !5
%idxprom.i = sext i32 %3 to i64
%arrayidx.i = getelementptr inbounds [100000 x ptr], ptr @queue, i64 0, i64 %idxprom.i
store ptr %call1, ptr %arrayidx.i, align 8, !tbaa !9
%cmp.i = icmp sgt i32 %3, 99998
br i1 %cmp.i, label %if.then.i, label %push.exit
if.then.i: ; preds = %for.body
store i32 0, ptr @p, align 4, !tbaa !5
br label %push.exit
push.exit: ; preds = %for.body, %if.then.i
%4 = phi i32 [ %inc.i, %for.body ], [ 0, %if.then.i ]
%inc = add nuw nsw i32 %i.037, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %5
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11
while.body: ; preds = %while.cond.preheader, %cleanup
%6 = phi i32 [ %11, %cleanup ], [ %2, %while.cond.preheader ]
%7 = phi i32 [ %12, %cleanup ], [ %1, %while.cond.preheader ]
%time.039 = phi i32 [ %time.1, %cleanup ], [ 0, %while.cond.preheader ]
%inc.i26 = add nsw i32 %6, 1
%idxprom.i27 = sext i32 %6 to i64
%arrayidx.i28 = getelementptr inbounds [100000 x ptr], ptr @queue, i64 0, i64 %idxprom.i27
%8 = load ptr, ptr %arrayidx.i28, align 8, !tbaa !9
%cmp.i29 = icmp sgt i32 %6, 99998
%spec.store.select.i = select i1 %cmp.i29, i32 0, i32 %inc.i26
store i32 %spec.store.select.i, ptr @q, align 4
%time7 = getelementptr inbounds %struct.Process, ptr %8, i64 0, i32 1
%9 = load i32, ptr %time7, align 4, !tbaa !13
%10 = load i32, ptr %qu, align 4, !tbaa !5
%cmp8.not = icmp sgt i32 %9, %10
br i1 %cmp8.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%add = add nsw i32 %9, %time.039
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %8, i32 noundef %add)
call void @free(ptr noundef nonnull %8) #6
%.pre40 = load i32, ptr @p, align 4, !tbaa !5
%.pre41 = load i32, ptr @q, align 4, !tbaa !5
br label %cleanup, !llvm.loop !15
if.end: ; preds = %while.body
%sub = sub nsw i32 %9, %10
store i32 %sub, ptr %time7, align 4, !tbaa !13
%add14 = add nsw i32 %10, %time.039
%inc.i30 = add nsw i32 %7, 1
store i32 %inc.i30, ptr @p, align 4, !tbaa !5
%idxprom.i31 = sext i32 %7 to i64
%arrayidx.i32 = getelementptr inbounds [100000 x ptr], ptr @queue, i64 0, i64 %idxprom.i31
store ptr %8, ptr %arrayidx.i32, align 8, !tbaa !9
%cmp.i33 = icmp sgt i32 %7, 99998
br i1 %cmp.i33, label %if.then.i34, label %cleanup
if.then.i34: ; preds = %if.end
store i32 0, ptr @p, align 4, !tbaa !5
br label %cleanup
cleanup: ; preds = %if.then.i34, %if.end, %if.then
%11 = phi i32 [ %.pre41, %if.then ], [ %spec.store.select.i, %if.end ], [ %spec.store.select.i, %if.then.i34 ]
%12 = phi i32 [ %.pre40, %if.then ], [ %inc.i30, %if.end ], [ 0, %if.then.i34 ]
%time.1 = phi i32 [ %add, %if.then ], [ %add14, %if.end ], [ %add14, %if.then.i34 ]
%cmp4.not = icmp eq i32 %12, %11
br i1 %cmp4.not, label %while.end, label %while.body
while.end: ; preds = %cleanup, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %qu) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !6, i64 16}
!14 = !{!"", !7, i64 0, !6, i64 16}
!15 = distinct !{!15, !12}
|
#include<stdio.h>
#include<string.h>
#define LEN 1000000
typedef struct pp{
char name[100];
int t;
}P;
P Q[LEN+1];
int main(){
int n, i, q, sum =0, last, cnt=0;
scanf("%d %d", &n, &q);
for ( i = 1; i <= n; i++){
scanf("%s", Q[i].name);
scanf("%d", &Q[i].t);
}
i = 1;
last = n;
while(1){
if(Q[i].t > q){
sum += q;
strcpy(Q[last+1].name, Q[i].name);
Q[last+1].t = Q[i].t - q;
last++;
} else {
sum += Q[i].t;
printf("%s %d\n", Q[i].name, sum);
cnt++;
}
i++;
if(cnt == n) break;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252493/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252493/source.c"
target datalayout = "e-m:e-p270: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.pp = type { [100 x i8], i32 }
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@Q = dso_local global [1000001 x %struct.pp] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %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
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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %q)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not57 = icmp slt i32 %0, 1
br i1 %cmp.not57, label %while.cond.preheader, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [1000001 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%t = getelementptr inbounds [1000001 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %while.cond.preheader, !llvm.loop !9
while.cond.preheader: ; preds = %for.body, %entry
%last.0.ph = phi i32 [ %0, %entry ], [ %1, %for.body ]
br label %while.cond
while.cond: ; preds = %while.cond.preheader, %if.end
%3 = phi i32 [ %7, %if.end ], [ %last.0.ph, %while.cond.preheader ]
%indvars.iv61 = phi i64 [ %indvars.iv.next62, %if.end ], [ 1, %while.cond.preheader ]
%sum.0 = phi i32 [ %sum.1, %if.end ], [ 0, %while.cond.preheader ]
%last.0 = phi i32 [ %last.1, %if.end ], [ %last.0.ph, %while.cond.preheader ]
%cnt.0 = phi i32 [ %cnt.1, %if.end ], [ 0, %while.cond.preheader ]
%arrayidx6 = getelementptr inbounds [1000001 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv61
%t7 = getelementptr inbounds [1000001 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv61, i32 1
%4 = load i32, ptr %t7, align 4, !tbaa !11
%5 = load i32, ptr %q, align 4, !tbaa !5
%cmp8 = icmp sgt i32 %4, %5
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %while.cond
%add = add nsw i32 %5, %sum.0
%add9 = add nsw i32 %last.0, 1
%idxprom10 = sext i32 %add9 to i64
%arrayidx11 = getelementptr inbounds [1000001 x %struct.pp], ptr @Q, i64 0, i64 %idxprom10
%call18 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %arrayidx11, ptr noundef nonnull dereferenceable(1) %arrayidx6) #4
%6 = load i32, ptr %t7, align 4, !tbaa !11
%sub = sub nsw i32 %6, %5
%t25 = getelementptr inbounds [1000001 x %struct.pp], ptr @Q, i64 0, i64 %idxprom10, i32 1
store i32 %sub, ptr %t25, align 4, !tbaa !11
br label %if.end
if.else: ; preds = %while.cond
%add30 = add nsw i32 %4, %sum.0
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %arrayidx6, i32 noundef %add30)
%inc36 = add nsw i32 %cnt.0, 1
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%7 = phi i32 [ %3, %if.then ], [ %.pre, %if.else ]
%sum.1 = phi i32 [ %add, %if.then ], [ %add30, %if.else ]
%last.1 = phi i32 [ %add9, %if.then ], [ %last.0, %if.else ]
%cnt.1 = phi i32 [ %cnt.0, %if.then ], [ %inc36, %if.else ]
%indvars.iv.next62 = add nuw i64 %indvars.iv61, 1
%cmp38 = icmp eq i32 %cnt.1, %7
br i1 %cmp38, label %while.end, label %while.cond
while.end: ; preds = %if.end
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: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: 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 #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 100}
!12 = !{!"pp", !7, i64 0, !6, i64 100}
|
#include <stdio.h>
#include <string.h>
//#include <stdlib.h>
#define N 100005
typedef struct pp{
char name[100];
int t;
} P;
P Q[N];
int head,tail,n;
void enqueue(P x){
Q[tail] = x;
tail = (tail + 1) % N;
}
P dequeue(){
P x = Q[head];
head = (head +1) % N;
return x;
}
int min(int a,int b){
return a < b ? a : b;
}
int main(){
int elaps = 0,c;
int i,q;
P u;
scanf("%d %d",&n,&q);
for(i=1; i<=n; i++){
scanf("%s %d",Q[i].name,&Q[i].t);
}
/*i=0;
while(count!=n){
if(t[i]<=q){
total += t[i];
t[i] = t[i]-t[i];
}
else {
total += q;
t[i] = t[i]-q;
ntmp=name[i];
ttmp=t[i];
j=0;
while(t[j+1]!='\0'){
t[j]=t[j+1];
name[j]=name[j+1];
j++;
}
name[j]=ntmp;
t[j]=ttmp;
}
if(t[i]==0){
printf("%s %d\n",name,total);
count++;
}
i++;
}
*/
head = 1;
tail = n+1;
while(head != tail){
u=dequeue();
c = min(q,u.t);
u.t -= c;
elaps += c;
if(u.t > 0) enqueue(u);
else {
printf("%s %d\n",u.name,elaps);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252543/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252543/source.c"
target datalayout = "e-m:e-p270: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.pp = type { [100 x i8], i32 }
@Q = dso_local global [100005 x %struct.pp] zeroinitializer, align 16
@tail = dso_local local_unnamed_addr global i32 0, align 4
@head = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqueue(ptr nocapture noundef readonly byval(%struct.pp) align 8 %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dequeue(ptr noalias nocapture writeonly sret(%struct.pp) align 4 %agg.result) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @head, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%q = alloca i32, align 4
%u = alloca %struct.pp, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %u) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not24 = icmp slt i32 %0, 1
br i1 %cmp.not24, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv
%t = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %t)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 1, ptr @head, align 4, !tbaa !5
%add = add nsw i32 %.lcssa, 1
store i32 %add, ptr @tail, align 4, !tbaa !5
%cmp4.not26 = icmp eq i32 %.lcssa, 0
br i1 %cmp4.not26, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%t5 = getelementptr inbounds %struct.pp, ptr %u, i64 0, i32 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%3 = phi i32 [ %add, %while.body.lr.ph ], [ %7, %if.end ]
%4 = phi i32 [ 1, %while.body.lr.ph ], [ %8, %if.end ]
%elaps.027 = phi i32 [ 0, %while.body.lr.ph ], [ %add8, %if.end ]
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %u, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, i64 104, i1 false)
%add.i = add nsw i32 %4, 1
%rem.i = srem i32 %add.i, 100005
store i32 %rem.i, ptr @head, align 4, !tbaa !5, !noalias !13
%5 = load i32, ptr %q, align 4, !tbaa !5
%6 = load i32, ptr %t5, align 4, !tbaa !16
%cond.i = call i32 @llvm.smin.i32(i32 %5, i32 %6)
%sub = sub nsw i32 %6, %cond.i
store i32 %sub, ptr %t5, align 4, !tbaa !16
%add8 = add nsw i32 %cond.i, %elaps.027
%cmp10 = icmp sgt i32 %sub, 0
br i1 %cmp10, label %if.then, label %if.else
if.then: ; preds = %while.body
%idxprom.i20 = sext i32 %3 to i64
%arrayidx.i21 = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i20
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i21, ptr noundef nonnull align 8 dereferenceable(104) %u, i64 104, i1 false)
%add.i22 = add nsw i32 %3, 1
%rem.i23 = srem i32 %add.i22, 100005
store i32 %rem.i23, ptr @tail, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %u, i32 noundef %add8)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre30 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%7 = phi i32 [ %.pre30, %if.else ], [ %rem.i23, %if.then ]
%8 = phi i32 [ %.pre, %if.else ], [ %rem.i, %if.then ]
%cmp4.not = icmp eq i32 %8, %7
br i1 %cmp4.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %if.end, %for.end
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %u) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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) #4
; 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 0, i64 100, !10, i64 100, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14}
!14 = distinct !{!14, !15, !"dequeue: %agg.result"}
!15 = distinct !{!15, !"dequeue"}
!16 = !{!17, !6, i64 100}
!17 = !{!"pp", !7, i64 0, !6, i64 100}
!18 = distinct !{!18, !12}
|
#include<stdio.h>
#include<string.h>
#define N_MAX 100005
#define len 10
typedef struct task{
char name[len];
int time;
}T;
int main(void){
int i,n,q,take=0,head,tail;
T Q[N_MAX];
scanf("%d %d",&n,&q);//入力
for(i=1;i<=n;i++){
scanf("%s",Q[i].name);
scanf("%d",&Q[i].time);
}
head=1;
tail=n+1;
while(head!=tail){
if(Q[head].time<=q && Q[head].time!=0){
take+=Q[head].time;
printf("%s %d\n",Q[head].name,take);
if(head==N_MAX-1) head=0;
}
else {
take+=q;
Q[head].time-=q;
Q[tail]=Q[head];//引いた値を最後尾へ
if(head==N_MAX-1) head=0;
if(tail==N_MAX-1) tail=0;
tail++;
}
head++;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252587/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252587/source.c"
target datalayout = "e-m:e-p270: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.task = type { [10 x i8], i32 }
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %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
%Q = alloca [100005 x %struct.task], 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 1600080, ptr nonnull %Q) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %q)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not62 = icmp slt i32 %0, 1
br i1 %cmp.not62, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100005 x %struct.task], ptr %Q, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%time = getelementptr inbounds [100005 x %struct.task], ptr %Q, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %time)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%cmp5.not64 = icmp eq i32 %.lcssa, 0
br i1 %cmp5.not64, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %for.end
%add = add nsw i32 %.lcssa, 1
br label %while.body
while.body: ; preds = %while.body.preheader, %if.end40
%tail.067 = phi i32 [ %tail.1, %if.end40 ], [ %add, %while.body.preheader ]
%head.066 = phi i32 [ %inc41, %if.end40 ], [ 1, %while.body.preheader ]
%take.065 = phi i32 [ %take.1, %if.end40 ], [ 0, %while.body.preheader ]
%idxprom6 = sext i32 %head.066 to i64
%arrayidx7 = getelementptr inbounds [100005 x %struct.task], ptr %Q, i64 0, i64 %idxprom6
%time8 = getelementptr inbounds [100005 x %struct.task], ptr %Q, i64 0, i64 %idxprom6, i32 1
%3 = load i32, ptr %time8, align 4, !tbaa !11
%4 = load i32, ptr %q, align 4, !tbaa !5
%cmp9.not = icmp sgt i32 %3, %4
%cmp13.not = icmp eq i32 %3, 0
%or.cond = or i1 %cmp13.not, %cmp9.not
br i1 %or.cond, label %if.else, label %if.then
if.then: ; preds = %while.body
%add17 = add nsw i32 %3, %take.065
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %arrayidx7, i32 noundef %add17)
%cmp23 = icmp eq i32 %head.066, 100004
%spec.store.select = select i1 %cmp23, i32 0, i32 %head.066
br label %if.end40
if.else: ; preds = %while.body
%add25 = add nsw i32 %4, %take.065
%sub = sub nsw i32 %3, %4
store i32 %sub, ptr %time8, align 4, !tbaa !11
%idxprom29 = sext i32 %tail.067 to i64
%arrayidx30 = getelementptr inbounds [100005 x %struct.task], ptr %Q, i64 0, i64 %idxprom29
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %arrayidx30, ptr noundef nonnull align 16 dereferenceable(16) %arrayidx7, i64 16, i1 false), !tbaa.struct !13
%cmp33 = icmp eq i32 %head.066, 100004
%spec.store.select42 = select i1 %cmp33, i32 0, i32 %head.066
%cmp36 = icmp eq i32 %tail.067, 100004
%5 = add nsw i32 %tail.067, 1
%inc39 = select i1 %cmp36, i32 1, i32 %5
br label %if.end40
if.end40: ; preds = %if.else, %if.then
%take.1 = phi i32 [ %add17, %if.then ], [ %add25, %if.else ]
%head.1 = phi i32 [ %spec.store.select, %if.then ], [ %spec.store.select42, %if.else ]
%tail.1 = phi i32 [ %tail.067, %if.then ], [ %inc39, %if.else ]
%inc41 = add nsw i32 %head.1, 1
%cmp5.not = icmp eq i32 %inc41, %tail.1
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %if.end40, %for.end
call void @llvm.lifetime.end.p0(i64 1600080, ptr nonnull %Q) #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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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: readwrite) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 12}
!12 = !{!"task", !7, i64 0, !6, i64 12}
!13 = !{i64 0, i64 10, !14, i64 12, i64 4, !5}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
#include<stdlib.h>
#define ll long long int
int cmpfnc(const void * a, const void * b)
{
return ( *(int*)b - *(int*)a );
}
int min(int a,int b)
{
if(a<b)
return a;
return b;
}
int main()
{
int n,f ;
scanf("%d %d",&n,&f);
int i;
int arr[100005];
ll total = 0 ;
for(i=0;i<n;i++)
{
int a,b;
scanf("%d %d",&a,&b);
total += (ll)min(a,b) ;
arr[i] = min(2*a,b)-min(a,b) ;
}
qsort(arr,n,sizeof(int),cmpfnc);
/*
for(i=0;i<n;i++)
printf("%d ",arr[i]);
printf("\n");
*/
for(i=0;i<f;i++)
total+=(ll)arr[i];
printf("%lld\n",total);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25263/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25263/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [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 @cmpfnc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%f = alloca i32, align 4
%arr = alloca [100005 x i32], align 16
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %f)
call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %arr) #7
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %0, 0
br i1 %cmp27, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%total.029 = phi i64 [ %add, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #7
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%a.b.i = call i32 @llvm.smin.i32(i32 %1, i32 %2)
%conv = sext i32 %a.b.i to i64
%add = add nsw i64 %total.029, %conv
%mul = shl nsw i32 %1, 1
%a.b.i25 = call i32 @llvm.smin.i32(i32 %mul, i32 %2)
%sub = sub nsw i32 %a.b.i25, %a.b.i
%arrayidx = getelementptr inbounds [100005 x i32], ptr %arr, i64 0, i64 %indvars.iv
store i32 %sub, ptr %arrayidx, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #7
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv5.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %4, %for.body ]
%total.0.lcssa = phi i64 [ 0, %entry.for.end_crit_edge ], [ %add, %for.body ]
call void @qsort(ptr noundef nonnull %arr, i64 noundef %conv5.pre-phi, i64 noundef 4, ptr noundef nonnull @cmpfnc) #7
%5 = load i32, ptr %f, align 4, !tbaa !5
%cmp731 = icmp sgt i32 %5, 0
br i1 %cmp731, label %for.body9.preheader, label %for.end16
for.body9.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %5 to i64
%min.iters.check = icmp ult i32 %5, 4
br i1 %min.iters.check, label %for.body9.preheader42, label %vector.ph
vector.ph: ; preds = %for.body9.preheader
%n.vec = and i64 %wide.trip.count, 4294967292
%6 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %total.0.lcssa, i64 0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ %6, %vector.ph ], [ %11, %vector.body ]
%vec.phi40 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%7 = getelementptr inbounds [100005 x i32], ptr %arr, i64 0, i64 %index
%wide.load = load <2 x i32>, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 2
%wide.load41 = load <2 x i32>, ptr %8, align 8, !tbaa !5
%9 = sext <2 x i32> %wide.load to <2 x i64>
%10 = sext <2 x i32> %wide.load41 to <2 x i64>
%11 = add <2 x i64> %vec.phi, %9
%12 = add <2 x i64> %vec.phi40, %10
%index.next = add nuw i64 %index, 4
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %12, %11
%14 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end16, label %for.body9.preheader42
for.body9.preheader42: ; preds = %for.body9.preheader, %middle.block
%indvars.iv37.ph = phi i64 [ 0, %for.body9.preheader ], [ %n.vec, %middle.block ]
%total.133.ph = phi i64 [ %total.0.lcssa, %for.body9.preheader ], [ %14, %middle.block ]
br label %for.body9
for.body9: ; preds = %for.body9.preheader42, %for.body9
%indvars.iv37 = phi i64 [ %indvars.iv.next38, %for.body9 ], [ %indvars.iv37.ph, %for.body9.preheader42 ]
%total.133 = phi i64 [ %add13, %for.body9 ], [ %total.133.ph, %for.body9.preheader42 ]
%arrayidx11 = getelementptr inbounds [100005 x i32], ptr %arr, i64 0, i64 %indvars.iv37
%15 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%conv12 = sext i32 %15 to i64
%add13 = add nsw i64 %total.133, %conv12
%indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
%exitcond.not = icmp eq i64 %indvars.iv.next38, %wide.trip.count
br i1 %exitcond.not, label %for.end16, label %for.body9, !llvm.loop !14
for.end16: ; preds = %for.body9, %middle.block, %for.end
%total.1.lcssa = phi i64 [ %total.0.lcssa, %for.end ], [ %14, %middle.block ], [ %add13, %for.body9 ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %total.1.lcssa)
call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %arr) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare 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 = { 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 #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
|
#include <stdio.h>
#include <string.h>
struct Process{
char name[100];
int t;
};
struct Process Q[1001];
int n;
void enqueue(struct Process x){
struct Process S;
int i;
S = x;
for(i = 0 ; i < n ; i++){
if(i == n-1){
Q[i] = S;
}
else {
Q[i] = Q[i+1];
}
}
}
struct Process dequeue(void){
struct Process R;
int i;
R = Q[0];
for(i = 0 ; i < n ; i++){
if(i == n-1){
n = n-1;
}
else {
Q[i] = Q[i+1];
}
}
return R;
}
int main(){
struct Process A;
int i,q,time1=0,time2=0;
scanf("%d %d",&n,&q);
for(i = 0 ; i < n ; i++){
scanf("%s",Q[i].name);
scanf("%d",&Q[i].t);
}
while(1){
time1 = Q[0].t - q;
if(time1 <= 0){
time2 += Q[0].t;
Q[0].t = time2;
A = dequeue();
printf("%s %d\n",A.name,A.t);
if(n == 0) break;
}
else {
Q[0].t = time1;
enqueue(Q[0]);
time2 += q;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252688/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252688/source.c"
target datalayout = "e-m:e-p270: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.Process = type { [100 x i8], i32 }
@n = dso_local global i32 0, align 4
@Q = dso_local global [1001 x %struct.Process] zeroinitializer, align 16
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqueue(ptr nocapture noundef readonly byval(%struct.Process) align 8 %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%sub = add nsw i32 %0, -1
%1 = zext i32 %sub to i64
%wide.trip.count = zext i32 %0 to i64
%arrayidx = getelementptr inbounds [1001 x %struct.Process], ptr @Q, i64 0, i64 %1
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %.pre, %for.inc ]
%cmp1 = icmp eq i64 %indvars.iv, %1
%.pre = add nuw nsw i64 %indvars.iv, 1
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %for.body
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false)
br label %for.inc
if.else: ; preds = %for.body
%arrayidx3 = getelementptr inbounds [1001 x %struct.Process], ptr @Q, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [1001 x %struct.Process], ptr @Q, i64 0, i64 %.pre
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx3, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx5, i64 104, i1 false), !tbaa.struct !9
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%exitcond.not = icmp eq i64 %.pre, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.inc, %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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dequeue(ptr noalias nocapture writeonly sret(%struct.Process) align 4 %agg.result) local_unnamed_addr #0 {
entry:
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 16 dereferenceable(104) @Q, i64 104, i1 false), !tbaa.struct !9
%n.promoted = load i32, ptr @n, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %n.promoted, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %.pre, %for.inc ], [ 0, %entry ]
%sub1012 = phi i32 [ %sub9, %for.inc ], [ %n.promoted, %entry ]
%sub = add nsw i32 %sub1012, -1
%0 = zext i32 %sub to i64
%cmp1 = icmp eq i64 %indvars.iv, %0
%.pre = add nuw nsw i64 %indvars.iv, 1
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %for.body
store i32 %sub, ptr @n, align 4, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%arrayidx = getelementptr inbounds [1001 x %struct.Process], ptr @Q, i64 0, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds [1001 x %struct.Process], ptr @Q, i64 0, i64 %.pre
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx4, i64 104, i1 false), !tbaa.struct !9
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%sub9 = phi i32 [ %sub, %if.then ], [ %sub1012, %if.else ]
%1 = sext i32 %sub9 to i64
%cmp = icmp slt i64 %.pre, %1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.inc, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%Q = alloca %struct.Process, align 8
%A = alloca %struct.Process, align 4
%q = alloca i32, align 4
%tmp = alloca %struct.Process, align 4
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp30 = icmp sgt i32 %0, 0
br i1 %cmp30, label %for.body, label %while.cond.preheader
while.cond.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %2, %for.body ]
%t8 = getelementptr inbounds %struct.Process, ptr %A, i64 0, i32 1
br label %while.cond.outer
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1001 x %struct.Process], ptr @Q, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%t = getelementptr inbounds [1001 x %struct.Process], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr @n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !14
while.cond: ; preds = %while.cond.outer, %enqueue.exit
%time2.0 = phi i32 [ %add12, %enqueue.exit ], [ %time2.0.ph, %while.cond.outer ]
%4 = load i32, ptr getelementptr inbounds ([1001 x %struct.Process], ptr @Q, i64 0, i64 0, i32 1), align 4, !tbaa !15
%sub = sub nsw i32 %4, %9
%cmp5 = icmp slt i32 %sub, 1
br i1 %cmp5, label %if.then, label %if.else
if.then: ; preds = %while.cond
%add = add nsw i32 %4, %time2.0
store i32 %add, ptr getelementptr inbounds ([1001 x %struct.Process], ptr @Q, i64 0, i64 0, i32 1), align 4, !tbaa !15
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %tmp)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %tmp, ptr noundef nonnull align 16 dereferenceable(104) @Q, i64 104, i1 false), !tbaa.struct !9
%cmp11.i = icmp sgt i32 %n.promoted.i.ph, 0
br i1 %cmp11.i, label %for.body.i, label %dequeue.exit
for.body.i: ; preds = %if.then, %for.inc.i
%indvars.iv.i = phi i64 [ %.pre.i, %for.inc.i ], [ 0, %if.then ]
%sub1012.i = phi i32 [ %sub9.i, %for.inc.i ], [ %n.promoted.i.ph, %if.then ]
%sub.i = add nsw i32 %sub1012.i, -1
%5 = zext i32 %sub.i to i64
%cmp1.i = icmp eq i64 %indvars.iv.i, %5
%.pre.i = add nuw nsw i64 %indvars.iv.i, 1
br i1 %cmp1.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %for.body.i
store i32 %sub.i, ptr @n, align 4, !tbaa !5, !noalias !17
br label %for.inc.i
if.else.i: ; preds = %for.body.i
%arrayidx.i = getelementptr inbounds [1001 x %struct.Process], ptr @Q, i64 0, i64 %indvars.iv.i
%arrayidx4.i = getelementptr inbounds [1001 x %struct.Process], ptr @Q, i64 0, i64 %.pre.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx4.i, i64 104, i1 false), !tbaa.struct !9, !noalias !17
br label %for.inc.i
for.inc.i: ; preds = %if.else.i, %if.then.i
%sub9.i = phi i32 [ %sub.i, %if.then.i ], [ %sub1012.i, %if.else.i ]
%6 = sext i32 %sub9.i to i64
%cmp.i = icmp slt i64 %.pre.i, %6
br i1 %cmp.i, label %for.body.i, label %dequeue.exit, !llvm.loop !13
dequeue.exit: ; preds = %for.inc.i, %if.then
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %A, ptr noundef nonnull align 4 dereferenceable(104) %tmp, i64 104, i1 false), !tbaa.struct !9
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %tmp)
%7 = load i32, ptr %t8, align 4, !tbaa !15
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %A, i32 noundef %7)
%8 = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp eq i32 %8, 0
br i1 %cmp10, label %while.end, label %while.cond.outer
while.cond.outer: ; preds = %dequeue.exit, %while.cond.preheader
%n.promoted.i.ph = phi i32 [ %8, %dequeue.exit ], [ %1, %while.cond.preheader ]
%time2.0.ph = phi i32 [ %add, %dequeue.exit ], [ 0, %while.cond.preheader ]
%9 = load i32, ptr %q, align 4, !tbaa !5
%cmp11.i20 = icmp sgt i32 %n.promoted.i.ph, 0
%sub.i21 = add nsw i32 %n.promoted.i.ph, -1
%10 = zext i32 %sub.i21 to i64
%wide.trip.count.i = zext i32 %n.promoted.i.ph to i64
%arrayidx.i22 = getelementptr inbounds [1001 x %struct.Process], ptr @Q, i64 0, i64 %10
br label %while.cond
if.else: ; preds = %while.cond
store i32 %sub, ptr getelementptr inbounds ([1001 x %struct.Process], ptr @Q, i64 0, i64 0, i32 1), align 4, !tbaa !15
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %Q)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %Q, ptr noundef nonnull align 16 dereferenceable(104) @Q, i64 104, i1 false)
br i1 %cmp11.i20, label %for.body.i23, label %enqueue.exit
for.body.i23: ; preds = %if.else, %for.inc.i28
%indvars.iv.i24 = phi i64 [ %.pre.i26, %for.inc.i28 ], [ 0, %if.else ]
%cmp1.i25 = icmp eq i64 %indvars.iv.i24, %10
%.pre.i26 = add nuw nsw i64 %indvars.iv.i24, 1
br i1 %cmp1.i25, label %if.then.i29, label %if.else.i27
if.then.i29: ; preds = %for.body.i23
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i22, ptr noundef nonnull align 8 dereferenceable(104) %Q, i64 104, i1 false)
br label %for.inc.i28
if.else.i27: ; preds = %for.body.i23
%arrayidx3.i = getelementptr inbounds [1001 x %struct.Process], ptr @Q, i64 0, i64 %indvars.iv.i24
%arrayidx5.i = getelementptr inbounds [1001 x %struct.Process], ptr @Q, i64 0, i64 %.pre.i26
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx3.i, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx5.i, i64 104, i1 false), !tbaa.struct !9
br label %for.inc.i28
for.inc.i28: ; preds = %if.else.i27, %if.then.i29
%exitcond.not.i = icmp eq i64 %.pre.i26, %wide.trip.count.i
br i1 %exitcond.not.i, label %enqueue.exit, label %for.body.i23, !llvm.loop !11
enqueue.exit: ; preds = %for.inc.i28, %if.else
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %Q)
%add12 = add nsw i32 %9, %time2.0
br label %while.cond
while.end: ; preds = %dequeue.exit
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #5
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %A) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 0, i64 100, !10, i64 100, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!16, !6, i64 100}
!16 = !{!"Process", !7, i64 0, !6, i64 100}
!17 = !{!18}
!18 = distinct !{!18, !19, !"dequeue: %agg.result"}
!19 = distinct !{!19, !"dequeue"}
|
#include<stdio.h>
#include<string.h>
#define LEN 100005
typedef struct pp{
char name[100];
int t;
}P;
P Q[LEN+1];
int head=0, tail=0, n=0;
void enqueue(P x){
Q[tail]=x;
tail=tail+1;
tail=tail%(LEN+1);
}
P dequeue(){
int l;
l=head;
head=head+1;
head=head%(LEN+1);
return Q[l];
}
int main(){
int elaps=0, c=0;
int i, q;
P u;
head=1;
scanf("%d %d", &n, &q);
tail=1+n;
for ( i = 1; i <= n; i++){
scanf("%s", Q[i].name);
scanf("%d", &Q[i].t);
}
while(1){
//printf("%d %d\n", head, tail);
if(head==tail) break;
u=dequeue();
if(u.t>q){
c=c+q;
u.t=u.t-q;
enqueue(u);
} else{
c=c+u.t;
printf("%s %d\n",u.name,c);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252730/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252730/source.c"
target datalayout = "e-m:e-p270: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.pp = type { [100 x i8], i32 }
@head = dso_local local_unnamed_addr global i32 0, align 4
@tail = dso_local local_unnamed_addr global i32 0, align 4
@n = dso_local global i32 0, align 4
@Q = dso_local global [100006 x %struct.pp] zeroinitializer, align 16
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqueue(ptr nocapture noundef readonly byval(%struct.pp) align 8 %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100006
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dequeue(ptr noalias nocapture writeonly sret(%struct.pp) align 4 %agg.result) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100006
store i32 %rem, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, i64 104, i1 false), !tbaa.struct !9
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%q = alloca i32, align 4
%u = alloca %struct.pp, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %u) #5
store i32 1, ptr @head, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%add = add nsw i32 %0, 1
store i32 %add, ptr @tail, align 4, !tbaa !5
%cmp.not29 = icmp slt i32 %0, 1
br i1 %cmp.not29, label %while.cond.preheader, label %for.body
while.cond.preheader.loopexit: ; preds = %for.body
%.pre = load i32, ptr @tail, align 4, !tbaa !5
br label %while.cond.preheader
while.cond.preheader: ; preds = %while.cond.preheader.loopexit, %entry
%1 = phi i32 [ %.pre, %while.cond.preheader.loopexit ], [ %add, %entry ]
%2 = load i32, ptr @head, align 4, !tbaa !5
%cmp531 = icmp eq i32 %2, %1
br i1 %cmp531, label %while.end, label %if.end.lr.ph
if.end.lr.ph: ; preds = %while.cond.preheader
%t6 = getelementptr inbounds %struct.pp, ptr %u, i64 0, i32 1
br label %if.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%t = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t)
%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.not.not = icmp slt i64 %indvars.iv, %4
br i1 %cmp.not.not, label %for.body, label %while.cond.preheader.loopexit, !llvm.loop !11
if.end: ; preds = %if.end.lr.ph, %if.end17
%5 = phi i32 [ %1, %if.end.lr.ph ], [ %9, %if.end17 ]
%6 = phi i32 [ %2, %if.end.lr.ph ], [ %10, %if.end17 ]
%c.032 = phi i32 [ 0, %if.end.lr.ph ], [ %c.1, %if.end17 ]
%add.i = add nsw i32 %6, 1
%rem.i = srem i32 %add.i, 100006
store i32 %rem.i, ptr @head, align 4, !tbaa !5, !noalias !13
%idxprom.i = sext i32 %6 to i64
%arrayidx.i = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %u, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, i64 104, i1 false)
%7 = load i32, ptr %t6, align 4, !tbaa !16
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %7, %8
br i1 %cmp7, label %if.then8, label %if.else
if.then8: ; preds = %if.end
%add9 = add nsw i32 %8, %c.032
%sub = sub nsw i32 %7, %8
store i32 %sub, ptr %t6, align 4, !tbaa !16
%idxprom.i25 = sext i32 %5 to i64
%arrayidx.i26 = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i25
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i26, ptr noundef nonnull align 8 dereferenceable(104) %u, i64 104, i1 false)
%add.i27 = add nsw i32 %5, 1
%rem.i28 = srem i32 %add.i27, 100006
store i32 %rem.i28, ptr @tail, align 4, !tbaa !5
br label %if.end17
if.else: ; preds = %if.end
%add13 = add nsw i32 %7, %c.032
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %u, i32 noundef %add13)
%.pre34 = load i32, ptr @head, align 4, !tbaa !5
%.pre35 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end17
if.end17: ; preds = %if.else, %if.then8
%9 = phi i32 [ %rem.i28, %if.then8 ], [ %.pre35, %if.else ]
%10 = phi i32 [ %rem.i, %if.then8 ], [ %.pre34, %if.else ]
%c.1 = phi i32 [ %add9, %if.then8 ], [ %add13, %if.else ]
%cmp5 = icmp eq i32 %10, %9
br i1 %cmp5, label %while.end, label %if.end
while.end: ; preds = %if.end17, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %u) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 0, i64 100, !10, i64 100, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14}
!14 = distinct !{!14, !15, !"dequeue: %agg.result"}
!15 = distinct !{!15, !"dequeue"}
!16 = !{!17, !6, i64 100}
!17 = !{!"pp", !7, i64 0, !6, i64 100}
|
#include <stdio.h>
#include <string.h>
#define LEN 100005
typedef struct pp {
char name[100];
int t;
} P;
P Q[LEN];
int head, tail, n;
void enqueue(P x) {
Q[tail] = x;
tail = (tail + 1) % LEN;
}
P dequeue() {
P x = Q[head];
head = (head + 1) % LEN;
return x;
}
int min(int a,int b) {
return a < b ? a : b;
}
int main() {
int elaps = 0, c;
int i, q;
P u;
scanf("%d %d",&n ,&q);
for(i=1; i<=n; i++) {
scanf("%s", Q[i].name);
scanf("%d", &Q[i].t);
}
head = 1; tail = n + 1;
while(head != tail) {
u = dequeue();
c = min(q, u.t);
u.t -= c;
elaps += c;
if(u.t > 0) enqueue(u);
else {
printf("%s %d\n",u.name,elaps);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252774/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252774/source.c"
target datalayout = "e-m:e-p270: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.pp = type { [100 x i8], i32 }
@Q = dso_local global [100005 x %struct.pp] zeroinitializer, align 16
@tail = dso_local local_unnamed_addr global i32 0, align 4
@head = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqueue(ptr nocapture noundef readonly byval(%struct.pp) align 8 %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dequeue(ptr noalias nocapture writeonly sret(%struct.pp) align 4 %agg.result) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @head, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%q = alloca i32, align 4
%u = alloca %struct.pp, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %u) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not25 = icmp slt i32 %0, 1
br i1 %cmp.not25, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%t = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 1, ptr @head, align 4, !tbaa !5
%add = add nsw i32 %.lcssa, 1
store i32 %add, ptr @tail, align 4, !tbaa !5
%cmp5.not27 = icmp eq i32 %.lcssa, 0
br i1 %cmp5.not27, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%t6 = getelementptr inbounds %struct.pp, ptr %u, i64 0, i32 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%3 = phi i32 [ %add, %while.body.lr.ph ], [ %7, %if.end ]
%4 = phi i32 [ 1, %while.body.lr.ph ], [ %8, %if.end ]
%elaps.028 = phi i32 [ 0, %while.body.lr.ph ], [ %add9, %if.end ]
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %u, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, i64 104, i1 false)
%add.i = add nsw i32 %4, 1
%rem.i = srem i32 %add.i, 100005
store i32 %rem.i, ptr @head, align 4, !tbaa !5, !noalias !13
%5 = load i32, ptr %q, align 4, !tbaa !5
%6 = load i32, ptr %t6, align 4, !tbaa !16
%cond.i = call i32 @llvm.smin.i32(i32 %5, i32 %6)
%sub = sub nsw i32 %6, %cond.i
store i32 %sub, ptr %t6, align 4, !tbaa !16
%add9 = add nsw i32 %cond.i, %elaps.028
%cmp11 = icmp sgt i32 %sub, 0
br i1 %cmp11, label %if.then, label %if.else
if.then: ; preds = %while.body
%idxprom.i21 = sext i32 %3 to i64
%arrayidx.i22 = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i21
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i22, ptr noundef nonnull align 8 dereferenceable(104) %u, i64 104, i1 false)
%add.i23 = add nsw i32 %3, 1
%rem.i24 = srem i32 %add.i23, 100005
store i32 %rem.i24, ptr @tail, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %u, i32 noundef %add9)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre31 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%7 = phi i32 [ %.pre31, %if.else ], [ %rem.i24, %if.then ]
%8 = phi i32 [ %.pre, %if.else ], [ %rem.i, %if.then ]
%cmp5.not = icmp eq i32 %8, %7
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %if.end, %for.end
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %u) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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) #4
; 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 0, i64 100, !10, i64 100, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14}
!14 = distinct !{!14, !15, !"dequeue: %agg.result"}
!15 = distinct !{!15, !"dequeue"}
!16 = !{!17, !6, i64 100}
!17 = !{!"pp", !7, i64 0, !6, i64 100}
!18 = distinct !{!18, !12}
|
#include <stdio.h>
#include <string.h>
#define LEN 100005
typedef struct pp{
char name[100];
int t;
}
P;
P Q[LEN];
int head, tail, n;
void enqueue(P x){
Q[tail] = x;
tail = (tail + 1) % LEN;
}
P dequeue(void){
P x = Q[head];
head = (head + 1) % LEN;
return x;
}
int min(int a,int b){
return a < b ? a : b;
}
int main(){
int elaps = 0, c;
int i, q;
P u;
char str[64];
scanf("%d %d",&n ,&q);
for(i=1; i<=n; i++){
scanf("%s", Q[i].name);
scanf("%d", &Q[i].t);
}
head = 1; tail = n + 1;
while(head != tail){
u = dequeue();
c = min(q, u.t);
u.t -= c;
elaps += c;
if(u.t > 0) enqueue(u);
else{
printf("%s %d\n",u.name,elaps);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252817/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252817/source.c"
target datalayout = "e-m:e-p270: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.pp = type { [100 x i8], i32 }
@Q = dso_local global [100005 x %struct.pp] zeroinitializer, align 16
@tail = dso_local local_unnamed_addr global i32 0, align 4
@head = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqueue(ptr nocapture noundef readonly byval(%struct.pp) align 8 %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dequeue(ptr noalias nocapture writeonly sret(%struct.pp) align 4 %agg.result) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @head, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%q = alloca i32, align 4
%u = alloca %struct.pp, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %u) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not25 = icmp slt i32 %0, 1
br i1 %cmp.not25, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%t = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 1, ptr @head, align 4, !tbaa !5
%add = add nsw i32 %.lcssa, 1
store i32 %add, ptr @tail, align 4, !tbaa !5
%cmp5.not27 = icmp eq i32 %.lcssa, 0
br i1 %cmp5.not27, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%t6 = getelementptr inbounds %struct.pp, ptr %u, i64 0, i32 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%3 = phi i32 [ %add, %while.body.lr.ph ], [ %7, %if.end ]
%4 = phi i32 [ 1, %while.body.lr.ph ], [ %8, %if.end ]
%elaps.028 = phi i32 [ 0, %while.body.lr.ph ], [ %add9, %if.end ]
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %u, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, i64 104, i1 false)
%add.i = add nsw i32 %4, 1
%rem.i = srem i32 %add.i, 100005
store i32 %rem.i, ptr @head, align 4, !tbaa !5, !noalias !13
%5 = load i32, ptr %q, align 4, !tbaa !5
%6 = load i32, ptr %t6, align 4, !tbaa !16
%cond.i = call i32 @llvm.smin.i32(i32 %5, i32 %6)
%sub = sub nsw i32 %6, %cond.i
store i32 %sub, ptr %t6, align 4, !tbaa !16
%add9 = add nsw i32 %cond.i, %elaps.028
%cmp11 = icmp sgt i32 %sub, 0
br i1 %cmp11, label %if.then, label %if.else
if.then: ; preds = %while.body
%idxprom.i21 = sext i32 %3 to i64
%arrayidx.i22 = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i21
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i22, ptr noundef nonnull align 8 dereferenceable(104) %u, i64 104, i1 false)
%add.i23 = add nsw i32 %3, 1
%rem.i24 = srem i32 %add.i23, 100005
store i32 %rem.i24, ptr @tail, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %u, i32 noundef %add9)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre31 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%7 = phi i32 [ %.pre31, %if.else ], [ %rem.i24, %if.then ]
%8 = phi i32 [ %.pre, %if.else ], [ %rem.i, %if.then ]
%cmp5.not = icmp eq i32 %8, %7
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %if.end, %for.end
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %u) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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) #4
; 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 0, i64 100, !10, i64 100, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14}
!14 = distinct !{!14, !15, !"dequeue: %agg.result"}
!15 = distinct !{!15, !"dequeue"}
!16 = !{!17, !6, i64 100}
!17 = !{!"pp", !7, i64 0, !6, i64 100}
!18 = distinct !{!18, !12}
|
#include <stdio.h>
typedef struct pp{
char name[100];
int t;
}P;
P Q[100001+1];
int head, tail, n;
void enqueue(P x){
Q[tail] = x;
tail++;
tail = tail % 100001;
}
P dequeue(){
P ret;
ret = Q[head];
head++;
head = head % 100001;
return ret;
}
int main(){
int elaps = 0, c , zan;
int i, q;
P u;
scanf("%d %d", &n, &q);
for ( i = 0; i < n; i++){
scanf("%s", Q[i].name);
scanf("%d", &Q[i].t);
}
head =0;
tail = n;
zan = n;
while ( head != tail)
{
u = dequeue();
if (u.t <= q){
elaps+= u.t;
printf("%s %d\n",u.name , elaps);
}
else if ( u.t > q){ elaps += q;u.t -= q;enqueue(u);}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252860/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252860/source.c"
target datalayout = "e-m:e-p270: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.pp = type { [100 x i8], i32 }
@Q = dso_local global [100002 x %struct.pp] zeroinitializer, align 16
@tail = dso_local local_unnamed_addr global i32 0, align 4
@head = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqueue(ptr nocapture noundef readonly byval(%struct.pp) align 8 %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100002 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false), !tbaa.struct !9
%inc = add nsw i32 %0, 1
%rem = srem i32 %inc, 100001
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dequeue(ptr noalias nocapture writeonly sret(%struct.pp) align 4 %agg.result) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100002 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, i64 104, i1 false), !tbaa.struct !9
%inc = add nsw i32 %0, 1
%rem = srem i32 %inc, 100001
store i32 %rem, ptr @head, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%q = alloca i32, align 4
%u = alloca %struct.pp, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %u) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %0, 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 ]
%arrayidx = getelementptr inbounds [100002 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%t = getelementptr inbounds [100002 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 0, ptr @head, align 4, !tbaa !5
store i32 %.lcssa, ptr @tail, align 4, !tbaa !5
%cmp5.not31 = icmp eq i32 %.lcssa, 0
br i1 %cmp5.not31, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%t6 = getelementptr inbounds %struct.pp, ptr %u, i64 0, i32 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end17
%3 = phi i32 [ %.lcssa, %while.body.lr.ph ], [ %7, %if.end17 ]
%4 = phi i32 [ 0, %while.body.lr.ph ], [ %8, %if.end17 ]
%elaps.032 = phi i32 [ 0, %while.body.lr.ph ], [ %elaps.1, %if.end17 ]
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100002 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %u, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, i64 104, i1 false)
%inc.i = add nsw i32 %4, 1
%rem.i = srem i32 %inc.i, 100001
store i32 %rem.i, ptr @head, align 4, !tbaa !5, !noalias !13
%5 = load i32, ptr %t6, align 4, !tbaa !16
%6 = load i32, ptr %q, align 4, !tbaa !5
%cmp7.not = icmp sgt i32 %5, %6
br i1 %cmp7.not, label %if.then14, label %if.then
if.then: ; preds = %while.body
%add = add nsw i32 %5, %elaps.032
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %u, i32 noundef %add)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre35 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end17
if.then14: ; preds = %while.body
%add15 = add nsw i32 %6, %elaps.032
%sub = sub nsw i32 %5, %6
store i32 %sub, ptr %t6, align 4, !tbaa !16
%idxprom.i25 = sext i32 %3 to i64
%arrayidx.i26 = getelementptr inbounds [100002 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i25
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i26, ptr noundef nonnull align 8 dereferenceable(104) %u, i64 104, i1 false)
%inc.i27 = add nsw i32 %3, 1
%rem.i28 = srem i32 %inc.i27, 100001
store i32 %rem.i28, ptr @tail, align 4, !tbaa !5
br label %if.end17
if.end17: ; preds = %if.then14, %if.then
%7 = phi i32 [ %.pre35, %if.then ], [ %rem.i28, %if.then14 ]
%8 = phi i32 [ %.pre, %if.then ], [ %rem.i, %if.then14 ]
%elaps.1 = phi i32 [ %add, %if.then ], [ %add15, %if.then14 ]
%cmp5.not = icmp eq i32 %8, %7
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %if.end17, %for.end
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %u) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{i64 0, i64 100, !10, i64 100, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14}
!14 = distinct !{!14, !15, !"dequeue: %agg.result"}
!15 = distinct !{!15, !"dequeue"}
!16 = !{!17, !6, i64 100}
!17 = !{!"pp", !7, i64 0, !6, i64 100}
!18 = distinct !{!18, !12}
|
#include<stdio.h>
#define LEN 100005
typedef struct pp{
char name[100];
int t;
}P;
int head, tail, n;
P Q[LEN];
void enqueue(P x){
Q[tail]=x;
tail=(tail+1)%LEN;
}
P dequeue(){
P x=Q[head];
head=(head+1)%LEN;
return x;
}
int min(int a, int b){
if(a<b)return a;
else return b;
}
int main(){
int l = 0;
int c;
int i;
int q;
P a;
scanf("%d%d", &n, &q);
for ( i = 1; i <= n; i++){
scanf("%s", Q[i].name);
scanf("%d", &Q[i].t);
}
head=1;
tail=n+1;
while(head != tail){
a=dequeue();
c=min(q,a.t);
a.t-=c;
l+=c;
if(a.t>0){
enqueue(a);
}
else{
printf("%s %d\n",a.name,l);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252903/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252903/source.c"
target datalayout = "e-m:e-p270: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.pp = type { [100 x i8], i32 }
@Q = dso_local global [100005 x %struct.pp] zeroinitializer, align 16
@tail = dso_local local_unnamed_addr global i32 0, align 4
@head = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqueue(ptr nocapture noundef readonly byval(%struct.pp) align 8 %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dequeue(ptr noalias nocapture writeonly sret(%struct.pp) align 4 %agg.result) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @head, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%q = alloca i32, align 4
%a = alloca %struct.pp, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %a) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not25 = icmp slt i32 %0, 1
br i1 %cmp.not25, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%t = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 1, ptr @head, align 4, !tbaa !5
%add = add nsw i32 %.lcssa, 1
store i32 %add, ptr @tail, align 4, !tbaa !5
%cmp5.not27 = icmp eq i32 %.lcssa, 0
br i1 %cmp5.not27, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%t6 = getelementptr inbounds %struct.pp, ptr %a, i64 0, i32 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%3 = phi i32 [ %add, %while.body.lr.ph ], [ %7, %if.end ]
%4 = phi i32 [ 1, %while.body.lr.ph ], [ %8, %if.end ]
%l.028 = phi i32 [ 0, %while.body.lr.ph ], [ %add9, %if.end ]
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %a, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, i64 104, i1 false)
%add.i = add nsw i32 %4, 1
%rem.i = srem i32 %add.i, 100005
store i32 %rem.i, ptr @head, align 4, !tbaa !5, !noalias !13
%5 = load i32, ptr %q, align 4, !tbaa !5
%6 = load i32, ptr %t6, align 4, !tbaa !16
%a.b.i = call i32 @llvm.smin.i32(i32 %5, i32 %6)
%sub = sub nsw i32 %6, %a.b.i
store i32 %sub, ptr %t6, align 4, !tbaa !16
%add9 = add nsw i32 %a.b.i, %l.028
%cmp11 = icmp sgt i32 %sub, 0
br i1 %cmp11, label %if.then, label %if.else
if.then: ; preds = %while.body
%idxprom.i21 = sext i32 %3 to i64
%arrayidx.i22 = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i21
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i22, ptr noundef nonnull align 8 dereferenceable(104) %a, i64 104, i1 false)
%add.i23 = add nsw i32 %3, 1
%rem.i24 = srem i32 %add.i23, 100005
store i32 %rem.i24, ptr @tail, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %a, i32 noundef %add9)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre31 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%7 = phi i32 [ %.pre31, %if.else ], [ %rem.i24, %if.then ]
%8 = phi i32 [ %.pre, %if.else ], [ %rem.i, %if.then ]
%cmp5.not = icmp eq i32 %8, %7
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %if.end, %for.end
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %a) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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) #4
; 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 0, i64 100, !10, i64 100, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14}
!14 = distinct !{!14, !15, !"dequeue: %agg.result"}
!15 = distinct !{!15, !"dequeue"}
!16 = !{!17, !6, i64 100}
!17 = !{!"pp", !7, i64 0, !6, i64 100}
!18 = distinct !{!18, !12}
|
#include <stdio.h>
#include <stdlib.h>
#define MAX 100000
typedef struct{
char name[10];
int time;
} PROCESS;
int isEmpty(PROCESS *);
int isFull(PROCESS *);
void enqueue(PROCESS *, PROCESS);
PROCESS dequeue(PROCESS *);
void rrs(PROCESS *, int);
int head=0, tail=0;
int main(){
int n, q, a, total_time=0, count=0;
PROCESS p[MAX], process;
scanf("%d%d",&n,&q);
for(a = 0; a < n; a++){
scanf("%s%d",process.name,&process.time);
if(process.time > q){
total_time += q;
process.time -= q;
enqueue(p,process);
count++;
}
else{
total_time += process.time;
printf("%s %d\n",process.name,total_time);
}
}
while(1){
process = dequeue(p);
if(process.time == -1) break;
else if(process.time > q){
total_time += q;
process.time -= q;
enqueue(p,process);
}
else{
total_time += process.time;
printf("%s %d\n",process.name,total_time);
}
}
return 0;
}
int isEmpty(PROCESS *p){
if(head == tail) return 1;
else return 0;
}
int isFull(PROCESS *p){
if(head == (tail+1) % MAX) return 1;
else return 0;
}
void enqueue(PROCESS *p, PROCESS x){
if(isFull(p) == 1) exit(1);
p[tail] = x;
if((tail+1) == MAX) tail = 0;
else tail++;
}
PROCESS dequeue(PROCESS *p){
PROCESS x;
if(isEmpty(p) == 1){
x.time = -1;
return x;
}
x = p[head];
if((head+1) == MAX) head = 0;
else head++;
return x;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252947/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252947/source.c"
target datalayout = "e-m:e-p270: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.PROCESS = type { [10 x i8], i32 }
@head = dso_local local_unnamed_addr global i32 0, align 4
@tail = dso_local local_unnamed_addr 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 [5 x i8] c"%s%d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
%p = alloca [100000 x %struct.PROCESS], align 16
%process = alloca %struct.PROCESS, align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #6
call void @llvm.lifetime.start.p0(i64 1600000, ptr nonnull %p) #6
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %process) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %q)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp59 = icmp sgt i32 %0, 0
br i1 %cmp59, label %for.body.lr.ph, label %while.cond.preheader
for.body.lr.ph: ; preds = %entry
%time = getelementptr inbounds %struct.PROCESS, ptr %process, i64 0, i32 1
br label %for.body
while.cond.preheader: ; preds = %for.inc, %entry
%total_time.0.lcssa = phi i32 [ 0, %entry ], [ %total_time.1, %for.inc ]
%tmp.sroa.4.0.process.sroa_idx = getelementptr inbounds i8, ptr %process, i64 8
%time14 = getelementptr inbounds %struct.PROCESS, ptr %process, i64 0, i32 1
%.pre63 = load i32, ptr @head, align 4, !tbaa !5
%.pre65 = load i32, ptr @tail, align 4, !tbaa !5
%cmp.i.not.i4269 = icmp eq i32 %.pre63, %.pre65
br i1 %cmp.i.not.i4269, label %while.end, label %dequeue.exit
for.body: ; preds = %for.body.lr.ph, %for.inc
%a.062 = phi i32 [ 0, %for.body.lr.ph ], [ %inc11, %for.inc ]
%total_time.061 = phi i32 [ 0, %for.body.lr.ph ], [ %total_time.1, %for.inc ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %process, ptr noundef nonnull %time)
%1 = load i32, ptr %time, align 4, !tbaa !9
%2 = load i32, ptr %q, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %1, %2
br i1 %cmp3, label %if.then, label %if.else
if.then: ; preds = %for.body
%sub = sub nsw i32 %1, %2
store i32 %sub, ptr %time, align 4, !tbaa !9
%3 = load i32, ptr @head, align 4, !tbaa !5
%4 = load i32, ptr @tail, align 4, !tbaa !5
%add.i.i = add nsw i32 %4, 1
%rem.i.i = srem i32 %add.i.i, 100000
%cmp.i.not.i = icmp eq i32 %3, %rem.i.i
br i1 %cmp.i.not.i, label %if.then.i, label %enqueue.exit
if.then.i: ; preds = %if.then
call void @exit(i32 noundef 1) #7
unreachable
enqueue.exit: ; preds = %if.then
%add = add nsw i32 %2, %total_time.061
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds %struct.PROCESS, ptr %p, i64 %idxprom.i
%5 = load <2 x i64>, ptr %process, align 16
store <2 x i64> %5, ptr %arrayidx.i, align 16
%cmp1.i = icmp eq i32 %add.i.i, 100000
%.add.i = select i1 %cmp1.i, i32 0, i32 %add.i.i
store i32 %.add.i, ptr @tail, align 4, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%add7 = add nsw i32 %1, %total_time.061
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %process, i32 noundef %add7)
br label %for.inc
for.inc: ; preds = %enqueue.exit, %if.else
%total_time.1 = phi i32 [ %add, %enqueue.exit ], [ %add7, %if.else ]
%inc11 = add nuw nsw i32 %a.062, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc11, %6
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11
dequeue.exit: ; preds = %while.cond.preheader, %if.end32
%total_time.270 = phi i32 [ %total_time.3, %if.end32 ], [ %total_time.0.lcssa, %while.cond.preheader ]
%7 = phi i32 [ %14, %if.end32 ], [ %.pre65, %while.cond.preheader ]
%8 = phi i32 [ %13, %if.end32 ], [ %.pre63, %while.cond.preheader ]
%idxprom.i43 = sext i32 %8 to i64
%arrayidx.i44 = getelementptr inbounds %struct.PROCESS, ptr %p, i64 %idxprom.i43
%retval.sroa.0.0.copyload.i = load i64, ptr %arrayidx.i44, align 16, !tbaa.struct !13
%retval.sroa.2.0.arrayidx.sroa_idx.i = getelementptr inbounds i8, ptr %arrayidx.i44, i64 8
%retval.sroa.2.0.copyload.i = load i64, ptr %retval.sroa.2.0.arrayidx.sroa_idx.i, align 8, !tbaa.struct !15
%add.i = add nsw i32 %8, 1
%cmp1.i45 = icmp eq i32 %add.i, 100000
%.add.i46 = select i1 %cmp1.i45, i32 0, i32 %add.i
store i32 %.add.i46, ptr @head, align 4, !tbaa !5
store i64 %retval.sroa.0.0.copyload.i, ptr %process, align 16, !tbaa.struct !13
store i64 %retval.sroa.2.0.copyload.i, ptr %tmp.sroa.4.0.process.sroa_idx, align 8, !tbaa.struct !15
%9 = lshr i64 %retval.sroa.2.0.copyload.i, 32
%10 = trunc i64 %9 to i32
%cmp15 = icmp eq i32 %10, -1
br i1 %cmp15, label %while.end, label %if.else17
if.else17: ; preds = %dequeue.exit
%11 = load i32, ptr %q, align 4, !tbaa !5
%cmp19 = icmp slt i32 %11, %10
br i1 %cmp19, label %if.then20, label %if.else25
if.then20: ; preds = %if.else17
%sub23 = sub nsw i32 %10, %11
store i32 %sub23, ptr %time14, align 4, !tbaa !9
%add.i.i47 = add nsw i32 %7, 1
%rem.i.i48 = srem i32 %add.i.i47, 100000
%cmp.i.not.i49 = icmp eq i32 %.add.i46, %rem.i.i48
br i1 %cmp.i.not.i49, label %if.then.i56, label %enqueue.exit57
if.then.i56: ; preds = %if.then20
call void @exit(i32 noundef 1) #7
unreachable
enqueue.exit57: ; preds = %if.then20
%12 = load i64, ptr %tmp.sroa.4.0.process.sroa_idx, align 8
%add21 = add nsw i32 %11, %total_time.270
%idxprom.i51 = sext i32 %7 to i64
%arrayidx.i52 = getelementptr inbounds %struct.PROCESS, ptr %p, i64 %idxprom.i51
store i64 %retval.sroa.0.0.copyload.i, ptr %arrayidx.i52, align 16, !tbaa.struct !13
%x.sroa.2.0.arrayidx.sroa_idx.i53 = getelementptr inbounds i8, ptr %arrayidx.i52, i64 8
store i64 %12, ptr %x.sroa.2.0.arrayidx.sroa_idx.i53, align 8, !tbaa.struct !15
%cmp1.i54 = icmp eq i32 %add.i.i47, 100000
%.add.i55 = select i1 %cmp1.i54, i32 0, i32 %add.i.i47
store i32 %.add.i55, ptr @tail, align 4, !tbaa !5
br label %if.end32
if.else25: ; preds = %if.else17
%add27 = add nsw i32 %total_time.270, %10
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %process, i32 noundef %add27)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre64 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end32
if.end32: ; preds = %enqueue.exit57, %if.else25
%13 = phi i32 [ %.add.i46, %enqueue.exit57 ], [ %.pre, %if.else25 ]
%14 = phi i32 [ %.add.i55, %enqueue.exit57 ], [ %.pre64, %if.else25 ]
%total_time.3 = phi i32 [ %add21, %enqueue.exit57 ], [ %add27, %if.else25 ]
%cmp.i.not.i42 = icmp eq i32 %13, %14
br i1 %cmp.i.not.i42, label %while.end, label %dequeue.exit
while.end: ; preds = %if.end32, %dequeue.exit, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %process) #6
call void @llvm.lifetime.end.p0(i64 1600000, ptr nonnull %p) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nounwind uwtable
define dso_local void @enqueue(ptr nocapture noundef writeonly %p, i64 %x.coerce0, i64 %x.coerce1) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%1 = load i32, ptr @tail, align 4, !tbaa !5
%add.i = add nsw i32 %1, 1
%rem.i = srem i32 %add.i, 100000
%cmp.i.not = icmp eq i32 %0, %rem.i
br i1 %cmp.i.not, label %if.then, label %if.end
if.then: ; preds = %entry
tail call void @exit(i32 noundef 1) #7
unreachable
if.end: ; preds = %entry
%idxprom = sext i32 %1 to i64
%arrayidx = getelementptr inbounds %struct.PROCESS, ptr %p, i64 %idxprom
store i64 %x.coerce0, ptr %arrayidx, align 4, !tbaa.struct !13
%x.sroa.2.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 8
store i64 %x.coerce1, ptr %x.sroa.2.0.arrayidx.sroa_idx, align 4, !tbaa.struct !15
%cmp1 = icmp eq i32 %add.i, 100000
%.add = select i1 %cmp1, i32 0, i32 %add.i
store i32 %.add, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local { i64, i64 } @dequeue(ptr nocapture noundef readonly %p) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%1 = load i32, ptr @tail, align 4, !tbaa !5
%cmp.i.not = icmp eq i32 %0, %1
br i1 %cmp.i.not, label %return, label %if.end
if.end: ; preds = %entry
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds %struct.PROCESS, ptr %p, i64 %idxprom
%retval.sroa.0.0.copyload = load i64, ptr %arrayidx, align 4, !tbaa.struct !13
%retval.sroa.2.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 8
%retval.sroa.2.0.copyload = load i64, ptr %retval.sroa.2.0.arrayidx.sroa_idx, align 4, !tbaa.struct !15
%add = add nsw i32 %0, 1
%cmp1 = icmp eq i32 %add, 100000
%.add = select i1 %cmp1, i32 0, i32 %add
store i32 %.add, ptr @head, align 4, !tbaa !5
br label %return
return: ; preds = %if.end, %entry
%retval.sroa.0.0 = phi i64 [ undef, %entry ], [ %retval.sroa.0.0.copyload, %if.end ]
%retval.sroa.2.0 = phi i64 [ -4294967296, %entry ], [ %retval.sroa.2.0.copyload, %if.end ]
%.fca.0.insert = insertvalue { i64, i64 } poison, i64 %retval.sroa.0.0, 0
%.fca.1.insert = insertvalue { i64, i64 } %.fca.0.insert, i64 %retval.sroa.2.0, 1
ret { i64, i64 } %.fca.1.insert
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @isEmpty(ptr nocapture noundef readnone %p) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%1 = load i32, ptr @tail, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
%. = zext i1 %cmp to i32
ret i32 %.
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @isFull(ptr nocapture noundef readnone %p) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%1 = load i32, ptr @tail, align 4, !tbaa !5
%add = add nsw i32 %1, 1
%rem = srem i32 %add, 100000
%cmp = icmp eq i32 %0, %rem
%. = zext i1 %cmp to i32
ret i32 %.
}
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { nounwind }
attributes #7 = { 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 = !{!10, !6, i64 12}
!10 = !{!"", !7, i64 0, !6, i64 12}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{i64 0, i64 10, !14, i64 12, i64 4, !5}
!14 = !{!7, !7, i64 0}
!15 = !{i64 0, i64 2, !14, i64 4, i64 4, !5}
|
#include<stdio.h>
#include<string.h>
#define LEN 100005
typedef struct pp{
char name[100];
int t;
}P;
P Q[LEN+1];
int head, tail, n;
int compare( int a, int tai){
return a < tai ? a : tai;
}
void enqueue(P x){
Q[tail] = x;
tail = ( tail + 1 ) % LEN;
}
P dequeue(){
P y = Q[head];
head = ( head + 1) % LEN;
return y;
}
int main(){
int elaps = 0, c;
int i, q;
P z;
scanf("%d %d", &n, &q);
for ( i = 1; i <= n; i++){
scanf("%s", Q[i].name);
scanf("%d", &Q[i].t);
}
head = 1;
tail = n + 1;
while( head != tail){
z = dequeue();
c = compare( q, z.t);
z.t -= c;
elaps += c;
if ( z.t > 0 ) enqueue(z);
else{
printf("%s %d\n",z.name,elaps);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_252990/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_252990/source.c"
target datalayout = "e-m:e-p270: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.pp = type { [100 x i8], i32 }
@Q = dso_local global [100006 x %struct.pp] zeroinitializer, align 16
@tail = dso_local local_unnamed_addr global i32 0, align 4
@head = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @compare(i32 noundef %a, i32 noundef %tai) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %tai)
ret i32 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqueue(ptr nocapture noundef readonly byval(%struct.pp) align 8 %x) local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dequeue(ptr noalias nocapture writeonly sret(%struct.pp) align 4 %agg.result) local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @head, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%q = alloca i32, align 4
%z = alloca %struct.pp, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %z) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not25 = icmp slt i32 %0, 1
br i1 %cmp.not25, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%t = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 1, ptr @head, align 4, !tbaa !5
%add = add nsw i32 %.lcssa, 1
store i32 %add, ptr @tail, align 4, !tbaa !5
%cmp5.not27 = icmp eq i32 %.lcssa, 0
br i1 %cmp5.not27, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%t6 = getelementptr inbounds %struct.pp, ptr %z, i64 0, i32 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%3 = phi i32 [ %add, %while.body.lr.ph ], [ %7, %if.end ]
%4 = phi i32 [ 1, %while.body.lr.ph ], [ %8, %if.end ]
%elaps.028 = phi i32 [ 0, %while.body.lr.ph ], [ %add9, %if.end ]
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %z, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, i64 104, i1 false)
%add.i = add nsw i32 %4, 1
%rem.i = srem i32 %add.i, 100005
store i32 %rem.i, ptr @head, align 4, !tbaa !5, !noalias !13
%5 = load i32, ptr %q, align 4, !tbaa !5
%6 = load i32, ptr %t6, align 4, !tbaa !16
%cond.i = call i32 @llvm.smin.i32(i32 %5, i32 %6)
%sub = sub nsw i32 %6, %cond.i
store i32 %sub, ptr %t6, align 4, !tbaa !16
%add9 = add nsw i32 %cond.i, %elaps.028
%cmp11 = icmp sgt i32 %sub, 0
br i1 %cmp11, label %if.then, label %if.else
if.then: ; preds = %while.body
%idxprom.i21 = sext i32 %3 to i64
%arrayidx.i22 = getelementptr inbounds [100006 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i21
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i22, ptr noundef nonnull align 8 dereferenceable(104) %z, i64 104, i1 false)
%add.i23 = add nsw i32 %3, 1
%rem.i24 = srem i32 %add.i23, 100005
store i32 %rem.i24, ptr @tail, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %z, i32 noundef %add9)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre31 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%7 = phi i32 [ %.pre31, %if.else ], [ %rem.i24, %if.then ]
%8 = phi i32 [ %.pre, %if.else ], [ %rem.i, %if.then ]
%cmp5.not = icmp eq i32 %8, %7
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %if.end, %for.end
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %z) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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) #4
; 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 0, i64 100, !10, i64 100, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14}
!14 = distinct !{!14, !15, !"dequeue: %agg.result"}
!15 = distinct !{!15, !"dequeue"}
!16 = !{!17, !6, i64 100}
!17 = !{!"pp", !7, i64 0, !6, i64 100}
!18 = distinct !{!18, !12}
|
#include<stdio.h>
#include<stdlib.h>
#define N 100000
//node pointer
typedef struct DATA{
char name[11];
int time;
}DATA;
//prototype
void enqueue(DATA);
DATA *dequeue(void);
//Queue set
DATA Queue[N];
//head & tail & data number set
int head=0, tail=0, num;
int main(){
int Q, i;
DATA *data;
//create *data
data=(DATA *)malloc(sizeof(DATA));
//input data number & Quantime
scanf("%d %d",&num,&Q);
//input data
for(i=0;i<num;i++){
scanf("%s %d",data->name,&data->time);
enqueue(*data);
}
//count doing process time
data=dequeue();
i=0;
while(data!=NULL){
if(data->time<=Q){//finish process
i+=data->time;
printf("%s %d\n",data->name,i);
data=dequeue();
}
else{//Quantime
i+=Q;
data->time-=Q;
enqueue(*data);
data=dequeue();
}
}
return 0;
}
//input data to tail
void enqueue(DATA data){
if(tail+1==head){//full
printf("ERROR:full\n");
exit(4);
}
Queue[tail]=data;
tail++;
if(tail==(num+1)) tail=0;
}
//output data from head
DATA *dequeue(void){
DATA *dp;
if(head==tail){//empty
//printf("ERROR:empty\n");
return NULL;
}
dp=&Queue[head];
head++;
if(head==(num+1)) head=0;
return dp;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253032/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253032/source.c"
target datalayout = "e-m:e-p270: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 { [11 x i8], i32 }
@head = dso_local local_unnamed_addr global i32 0, align 4
@tail = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@num = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [6 x i8] c"%s %d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
@Queue = dso_local global [100000 x %struct.DATA] zeroinitializer, align 16
@str = private unnamed_addr constant [11 x i8] c"ERROR:full\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%Q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Q) #7
%call = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #8
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @num, ptr noundef nonnull %Q)
%0 = load i32, ptr @num, align 4, !tbaa !5
%cmp62 = icmp sgt i32 %0, 0
br i1 %cmp62, label %for.body.lr.ph, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre68 = load i32, ptr @tail, align 4, !tbaa !5
br label %for.end
for.body.lr.ph: ; preds = %entry
%time = getelementptr inbounds %struct.DATA, ptr %call, i64 0, i32 1
br label %for.body
for.body: ; preds = %for.body.lr.ph, %enqueue.exit
%i.063 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %enqueue.exit ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %call, ptr noundef nonnull %time)
%1 = load i32, ptr @tail, align 4, !tbaa !5
%add.i = add nsw i32 %1, 1
%2 = load i32, ptr @head, align 4, !tbaa !5
%cmp.i = icmp eq i32 %add.i, %2
br i1 %cmp.i, label %if.then.i, label %enqueue.exit
if.then.i: ; preds = %for.body
%puts.i = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 4) #9
unreachable
enqueue.exit: ; preds = %for.body
%idxprom.i = sext i32 %1 to i64
%arrayidx.i = getelementptr inbounds [100000 x %struct.DATA], ptr @Queue, i64 0, i64 %idxprom.i
%3 = load <2 x i64>, ptr %call, align 4
store <2 x i64> %3, ptr %arrayidx.i, align 16
%4 = load i32, ptr @num, align 4, !tbaa !5
%cmp2.i = icmp eq i32 %1, %4
%spec.store.select.i = select i1 %cmp2.i, i32 0, i32 %add.i
store i32 %spec.store.select.i, ptr @tail, align 4
%inc = add nuw nsw i32 %i.063, 1
%cmp = icmp slt i32 %inc, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %enqueue.exit, %entry.for.end_crit_edge
%5 = phi i32 [ %.pre68, %entry.for.end_crit_edge ], [ %spec.store.select.i, %enqueue.exit ]
%6 = phi i32 [ %.pre, %entry.for.end_crit_edge ], [ %2, %enqueue.exit ]
%.lcssa = phi i32 [ %0, %entry.for.end_crit_edge ], [ %4, %enqueue.exit ]
%cmp.i28 = icmp eq i32 %6, %5
br i1 %cmp.i28, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %for.end
%inc.i = add nsw i32 %6, 1
%cmp1.i = icmp eq i32 %6, %.lcssa
%spec.store.select.i31 = select i1 %cmp1.i, i32 0, i32 %inc.i
br label %while.body
while.body: ; preds = %while.body.backedge, %while.body.preheader
%spec.store.select.i58.sink.sink = phi i32 [ %spec.store.select.i31, %while.body.preheader ], [ %spec.store.select.i58.sink.sink.be, %while.body.backedge ]
%7 = phi i32 [ %5, %while.body.preheader ], [ %.be, %while.body.backedge ]
%idxprom.i34.pn.pn.in = phi i32 [ %6, %while.body.preheader ], [ %idxprom.i34.pn.pn.in.be, %while.body.backedge ]
%i.165 = phi i32 [ 0, %while.body.preheader ], [ %i.165.be, %while.body.backedge ]
%idxprom.i34.pn.pn = sext i32 %idxprom.i34.pn.pn.in to i64
%data.066 = getelementptr inbounds [100000 x %struct.DATA], ptr @Queue, i64 0, i64 %idxprom.i34.pn.pn
store i32 %spec.store.select.i58.sink.sink, ptr @head, align 4
%time5 = getelementptr inbounds [100000 x %struct.DATA], ptr @Queue, i64 0, i64 %idxprom.i34.pn.pn, i32 1
%8 = load i32, ptr %time5, align 4, !tbaa !11
%9 = load i32, ptr %Q, align 4, !tbaa !5
%cmp6.not = icmp sgt i32 %8, %9
br i1 %cmp6.not, label %if.else, label %if.then
if.then: ; preds = %while.body
%add = add nsw i32 %8, %i.165
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %data.066, i32 noundef %add)
%10 = load i32, ptr @head, align 4, !tbaa !5
%11 = load i32, ptr @tail, align 4, !tbaa !5
%cmp.i32 = icmp eq i32 %10, %11
br i1 %cmp.i32, label %while.end, label %if.end.i33
if.end.i33: ; preds = %if.then
%inc.i36 = add nsw i32 %10, 1
%12 = load i32, ptr @num, align 4, !tbaa !5
%cmp1.i37 = icmp eq i32 %10, %12
%spec.store.select.i38 = select i1 %cmp1.i37, i32 0, i32 %inc.i36
br label %while.body.backedge
if.else: ; preds = %while.body
%add12 = add nsw i32 %9, %i.165
%sub = sub nsw i32 %8, %9
store i32 %sub, ptr %time5, align 4, !tbaa !11
%add.i41 = add nsw i32 %7, 1
%cmp.i42 = icmp eq i32 %add.i41, %spec.store.select.i58.sink.sink
br i1 %cmp.i42, label %if.then.i49, label %enqueue.exit51
if.then.i49: ; preds = %if.else
%puts.i50 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 4) #9
unreachable
enqueue.exit51: ; preds = %if.else
%idxprom.i44 = sext i32 %7 to i64
%arrayidx.i45 = getelementptr inbounds [100000 x %struct.DATA], ptr @Queue, i64 0, i64 %idxprom.i44
%13 = load <2 x i64>, ptr %data.066, align 16
store <2 x i64> %13, ptr %arrayidx.i45, align 16
%14 = load i32, ptr @num, align 4, !tbaa !5
%cmp2.i47 = icmp eq i32 %7, %14
%spec.store.select.i48 = select i1 %cmp2.i47, i32 0, i32 %add.i41
store i32 %spec.store.select.i48, ptr @tail, align 4
%cmp.i52 = icmp eq i32 %spec.store.select.i58.sink.sink, %spec.store.select.i48
br i1 %cmp.i52, label %while.end, label %if.end.i53
if.end.i53: ; preds = %enqueue.exit51
%inc.i56 = add nsw i32 %spec.store.select.i58.sink.sink, 1
%cmp1.i57 = icmp eq i32 %spec.store.select.i58.sink.sink, %14
%spec.store.select.i58 = select i1 %cmp1.i57, i32 0, i32 %inc.i56
br label %while.body.backedge
while.body.backedge: ; preds = %if.end.i53, %if.end.i33
%spec.store.select.i58.sink.sink.be = phi i32 [ %spec.store.select.i58, %if.end.i53 ], [ %spec.store.select.i38, %if.end.i33 ]
%.be = phi i32 [ %spec.store.select.i48, %if.end.i53 ], [ %11, %if.end.i33 ]
%idxprom.i34.pn.pn.in.be = phi i32 [ %spec.store.select.i58.sink.sink, %if.end.i53 ], [ %10, %if.end.i33 ]
%i.165.be = phi i32 [ %add12, %if.end.i53 ], [ %add, %if.end.i33 ]
br label %while.body, !llvm.loop !13
while.end: ; preds = %enqueue.exit51, %if.then, %for.end
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Q) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nounwind uwtable
define dso_local void @enqueue(i64 %data.coerce0, i64 %data.coerce1) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%add = add nsw i32 %0, 1
%1 = load i32, ptr @head, align 4, !tbaa !5
%cmp = icmp eq i32 %add, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
tail call void @exit(i32 noundef 4) #9
unreachable
if.end: ; preds = %entry
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100000 x %struct.DATA], ptr @Queue, i64 0, i64 %idxprom
store i64 %data.coerce0, ptr %arrayidx, align 16, !tbaa.struct !14
%data.sroa.2.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 8
store i64 %data.coerce1, ptr %data.sroa.2.0.arrayidx.sroa_idx, align 8, !tbaa.struct !16
%2 = load i32, ptr @num, align 4, !tbaa !5
%cmp2 = icmp eq i32 %0, %2
%spec.store.select = select i1 %cmp2, i32 0, i32 %add
store i32 %spec.store.select, ptr @tail, align 4
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local ptr @dequeue() local_unnamed_addr #4 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%1 = load i32, ptr @tail, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100000 x %struct.DATA], ptr @Queue, i64 0, i64 %idxprom
%inc = add nsw i32 %0, 1
%2 = load i32, ptr @num, align 4, !tbaa !5
%cmp1 = icmp eq i32 %0, %2
%spec.store.select = select i1 %cmp1, i32 0, i32 %inc
store i32 %spec.store.select, ptr @head, align 4
br label %cleanup
cleanup: ; preds = %entry, %if.end
%retval.0 = phi ptr [ %arrayidx, %if.end ], [ null, %entry ]
ret ptr %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: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-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(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 = { 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 #6 = { nofree nounwind }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { 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 = !{!12, !6, i64 12}
!12 = !{!"DATA", !7, i64 0, !6, i64 12}
!13 = distinct !{!13, !10}
!14 = !{i64 0, i64 11, !15, i64 12, i64 4, !5}
!15 = !{!7, !7, i64 0}
!16 = !{i64 0, i64 3, !15, i64 4, i64 4, !5}
|
#include <stdio.h>
#include <string.h>
#define LEN 100005
typedef struct pp{
char name[100];
int t;
}P;
P Q[LEN];
int head, tail, n;
void enqueue(P x)
{
Q[tail] = x;
tail = (tail + 1) % LEN;
}
P dequeue()
{
P x = Q[head];
head = (head + 1) % LEN;
return x;
}
int min(int a, int b) {return a<b ? a : b;}
int main(void)
{
int elaps = 0, c;
int i, q;
P u;
scanf("%d %d", &n, &q);
for(i=1; i<=n; i++){
scanf("%s", Q[i].name);
scanf("%d", &Q[i].t);
}
head = 1; tail = n+1;
while(head != tail){
u = dequeue();
c = min(q, u.t);
u.t -= c;
elaps += c;
if(u.t > 0) enqueue(u);
else
{
printf("%s %d\n", u.name, elaps);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253083/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253083/source.c"
target datalayout = "e-m:e-p270: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.pp = type { [100 x i8], i32 }
@Q = dso_local global [100005 x %struct.pp] zeroinitializer, align 16
@tail = dso_local local_unnamed_addr global i32 0, align 4
@head = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqueue(ptr nocapture noundef readonly byval(%struct.pp) align 8 %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dequeue(ptr noalias nocapture writeonly sret(%struct.pp) align 4 %agg.result) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @head, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%q = alloca i32, align 4
%u = alloca %struct.pp, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %u) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not25 = icmp slt i32 %0, 1
br i1 %cmp.not25, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%t = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 1, ptr @head, align 4, !tbaa !5
%add = add nsw i32 %.lcssa, 1
store i32 %add, ptr @tail, align 4, !tbaa !5
%cmp5.not27 = icmp eq i32 %.lcssa, 0
br i1 %cmp5.not27, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%t6 = getelementptr inbounds %struct.pp, ptr %u, i64 0, i32 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%3 = phi i32 [ %add, %while.body.lr.ph ], [ %7, %if.end ]
%4 = phi i32 [ 1, %while.body.lr.ph ], [ %8, %if.end ]
%elaps.028 = phi i32 [ 0, %while.body.lr.ph ], [ %add9, %if.end ]
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %u, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, i64 104, i1 false)
%add.i = add nsw i32 %4, 1
%rem.i = srem i32 %add.i, 100005
store i32 %rem.i, ptr @head, align 4, !tbaa !5, !noalias !13
%5 = load i32, ptr %q, align 4, !tbaa !5
%6 = load i32, ptr %t6, align 4, !tbaa !16
%cond.i = call i32 @llvm.smin.i32(i32 %5, i32 %6)
%sub = sub nsw i32 %6, %cond.i
store i32 %sub, ptr %t6, align 4, !tbaa !16
%add9 = add nsw i32 %cond.i, %elaps.028
%cmp11 = icmp sgt i32 %sub, 0
br i1 %cmp11, label %if.then, label %if.else
if.then: ; preds = %while.body
%idxprom.i21 = sext i32 %3 to i64
%arrayidx.i22 = getelementptr inbounds [100005 x %struct.pp], ptr @Q, i64 0, i64 %idxprom.i21
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i22, ptr noundef nonnull align 8 dereferenceable(104) %u, i64 104, i1 false)
%add.i23 = add nsw i32 %3, 1
%rem.i24 = srem i32 %add.i23, 100005
store i32 %rem.i24, ptr @tail, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %u, i32 noundef %add9)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre31 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%7 = phi i32 [ %.pre31, %if.else ], [ %rem.i24, %if.then ]
%8 = phi i32 [ %.pre, %if.else ], [ %rem.i, %if.then ]
%cmp5.not = icmp eq i32 %8, %7
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %if.end, %for.end
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %u) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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) #4
; 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 0, i64 100, !10, i64 100, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14}
!14 = distinct !{!14, !15, !"dequeue: %agg.result"}
!15 = distinct !{!15, !"dequeue"}
!16 = !{!17, !6, i64 100}
!17 = !{!"pp", !7, i64 0, !6, i64 100}
!18 = distinct !{!18, !12}
|
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#define NAME_MAX 10
struct process {
struct process* next;
char name[NAME_MAX + 1];
int time;
};
struct process_queue {
struct process* head;
struct process* tail;
int count;
};
static void enqueue(struct process_queue* queue, struct process* process) {
if ( queue->head == NULL ) {
assert( queue->tail == NULL );
assert( queue->count == 0 );
queue->head = queue->tail = process;
queue->tail->next = NULL;
queue->count++;
} else {
queue->tail->next = process;
queue->tail = process;
queue->tail->next = NULL;
queue->count++;
}
return;
}
static struct process* dequeue(struct process_queue* queue) {
assert( queue->head != NULL && queue->tail != NULL );
assert( queue->count > 0 );
struct process* head = queue->head;
if ( queue->head == queue->tail ) {
assert( queue->count == 1 );
queue->head = queue->tail = NULL;
} else {
queue->head = queue->head->next;
}
queue->count--;
head->next = NULL;
return head;
}
static int is_empty(struct process_queue* queue) {
if ( queue->count == 0 ) {
assert( queue->head == NULL || queue->tail == NULL );
return 1;
}
assert( queue->head != NULL && queue->tail != NULL );
return 0;
}
/* return elapsed time */
static int schedule(struct process_queue *queue, int q, int now) {
assert( queue != NULL );
assert( queue->head != NULL && queue->tail != NULL );
assert( queue->count > 0 );
int t;
struct process* head = dequeue(queue);
if ( head->time > q ) {
t = q;
head->time -= q;
enqueue(queue, head);
} else {
t = head->time;
printf("%s %d\n", head->name, now + t);
free(head);
}
return t;
}
static struct process* read_process(void) {
char buf[NAME_MAX + 1];
int time;
int ret;
ret = fscanf(stdin, "%s %d\n", buf, &time) ;
if (ret == EOF) {
return NULL;
}
assert( ret == 2 );
struct process* p = (struct process*)malloc(sizeof(struct process));
assert( p != NULL );
strcpy(p->name, buf);
p->time = time;
p->next = NULL;
return p;
}
int main(int argc, char* argv[]) {
int n, q;
int ret;
int i;
struct process_queue queue = {
.head = NULL,
.tail = NULL,
.count = 0
};
ret = fscanf(stdin, "%d %d\n", &n, &q);
assert( ret == 2);
for ( i = 0; i < n; i++ ) {
struct process* p = read_process();
assert( p != NULL );
enqueue(&queue, p);
}
int t = 0;
do {
t += schedule(&queue, q, t);
} while ( !is_empty(&queue) );
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253126/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253126/source.c"
target datalayout = "e-m:e-p270: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.process = type { ptr, [11 x i8], i32 }
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"ret == 2\00", align 1
@.str.2 = private unnamed_addr constant [63 x i8] c"/data/TheStack_IR/OJ_Samples/Collated/C/Source_253126/source.c\00", align 1
@__PRETTY_FUNCTION__.main = private unnamed_addr constant [23 x i8] c"int main(int, char **)\00", align 1
@.str.3 = private unnamed_addr constant [10 x i8] c"p != NULL\00", align 1
@.str.4 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
@__PRETTY_FUNCTION__.read_process = private unnamed_addr constant [35 x i8] c"struct process *read_process(void)\00", align 1
@.str.5 = private unnamed_addr constant [20 x i8] c"queue->tail == NULL\00", align 1
@__PRETTY_FUNCTION__.enqueue = private unnamed_addr constant [55 x i8] c"void enqueue(struct process_queue *, struct process *)\00", align 1
@.str.6 = private unnamed_addr constant [18 x i8] c"queue->count == 0\00", align 1
@__PRETTY_FUNCTION__.schedule = private unnamed_addr constant [47 x i8] c"int schedule(struct process_queue *, int, int)\00", align 1
@.str.8 = private unnamed_addr constant [43 x i8] c"queue->head != NULL && queue->tail != NULL\00", align 1
@.str.9 = private unnamed_addr constant [17 x i8] c"queue->count > 0\00", align 1
@__PRETTY_FUNCTION__.dequeue = private unnamed_addr constant [48 x i8] c"struct process *dequeue(struct process_queue *)\00", align 1
@.str.10 = private unnamed_addr constant [18 x i8] c"queue->count == 1\00", align 1
@.str.11 = private unnamed_addr constant [43 x i8] c"queue->head == NULL || queue->tail == NULL\00", align 1
@__PRETTY_FUNCTION__.is_empty = private unnamed_addr constant [37 x i8] c"int is_empty(struct process_queue *)\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%buf.i = alloca [11 x i8], align 1
%time.i = alloca i32, align 4
%n = alloca i32, align 4
%q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #8
%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, ptr noundef nonnull %q) #8
%cmp = icmp eq i32 %call, 2
br i1 %cmp, label %for.cond.preheader, label %if.else
for.cond.preheader: ; preds = %entry
%1 = load i32, ptr %n, align 4, !tbaa !9
%cmp191 = icmp sgt i32 %1, 0
br i1 %cmp191, label %for.body, label %if.else4.i
if.else: ; preds = %entry
call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 123, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #9
unreachable
for.body: ; preds = %for.cond.preheader, %enqueue.exit
%i.095 = phi i32 [ %inc, %enqueue.exit ], [ 0, %for.cond.preheader ]
%queue.sroa.0.094 = phi ptr [ %queue.sroa.0.1, %enqueue.exit ], [ null, %for.cond.preheader ]
%queue.sroa.18.093 = phi i32 [ %queue.sroa.18.1, %enqueue.exit ], [ 0, %for.cond.preheader ]
%queue.sroa.9.092 = phi ptr [ %call4.i, %enqueue.exit ], [ null, %for.cond.preheader ]
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %buf.i) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %time.i) #8
%2 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %2, ptr noundef nonnull @.str.4, ptr noundef nonnull %buf.i, ptr noundef nonnull %time.i) #8
switch i32 %call.i, label %if.else.i [
i32 -1, label %if.else5
i32 2, label %if.end3.i
]
if.else.i: ; preds = %for.body
call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 100, ptr noundef nonnull @__PRETTY_FUNCTION__.read_process) #9
unreachable
if.end3.i: ; preds = %for.body
%call4.i = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #10
%cmp5.not.i = icmp eq ptr %call4.i, null
br i1 %cmp5.not.i, label %if.else7.i, label %if.end6
if.else7.i: ; preds = %if.end3.i
call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.2, i32 noundef 103, ptr noundef nonnull @__PRETTY_FUNCTION__.read_process) #9
unreachable
if.else5: ; preds = %for.body
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %time.i) #8
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %buf.i) #8
call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.2, i32 noundef 127, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #9
unreachable
if.end6: ; preds = %if.end3.i
%name.i = getelementptr inbounds %struct.process, ptr %call4.i, i64 0, i32 1
%call11.i = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %name.i, ptr noundef nonnull dereferenceable(1) %buf.i) #8
%3 = load i32, ptr %time.i, align 4, !tbaa !9
%time12.i = getelementptr inbounds %struct.process, ptr %call4.i, i64 0, i32 2
store i32 %3, ptr %time12.i, align 4, !tbaa !11
store ptr null, ptr %call4.i, align 8, !tbaa !13
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %time.i) #8
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %buf.i) #8
%cmp.i = icmp eq ptr %queue.sroa.0.094, null
br i1 %cmp.i, label %if.then.i, label %if.else11.i
if.then.i: ; preds = %if.end6
%cmp1.i = icmp eq ptr %queue.sroa.9.092, null
br i1 %cmp1.i, label %if.end.i, label %if.else.i12
if.else.i12: ; preds = %if.then.i
call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.2, i32 noundef 22, ptr noundef nonnull @__PRETTY_FUNCTION__.enqueue) #9
unreachable
if.end.i: ; preds = %if.then.i
%cmp3.i = icmp eq i32 %queue.sroa.18.093, 0
br i1 %cmp3.i, label %if.end6.i, label %if.else5.i
if.else5.i: ; preds = %if.end.i
call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2, i32 noundef 23, ptr noundef nonnull @__PRETTY_FUNCTION__.enqueue) #9
unreachable
if.end6.i: ; preds = %if.end.i
store ptr null, ptr %call4.i, align 8, !tbaa !13
br label %enqueue.exit
if.else11.i: ; preds = %if.end6
store ptr %call4.i, ptr %queue.sroa.9.092, align 8, !tbaa !13
store ptr null, ptr %call4.i, align 8, !tbaa !13
%inc18.i = add nsw i32 %queue.sroa.18.093, 1
br label %enqueue.exit
enqueue.exit: ; preds = %if.end6.i, %if.else11.i
%queue.sroa.18.1 = phi i32 [ 1, %if.end6.i ], [ %inc18.i, %if.else11.i ]
%queue.sroa.0.1 = phi ptr [ %call4.i, %if.end6.i ], [ %queue.sroa.0.094, %if.else11.i ]
%inc = add nuw nsw i32 %i.095, 1
%4 = load i32, ptr %n, align 4, !tbaa !9
%cmp1 = icmp slt i32 %inc, %4
br i1 %cmp1, label %for.body, label %if.end5.i, !llvm.loop !14
if.else4.i: ; preds = %is_empty.exit, %for.cond.preheader
call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.2, i32 noundef 69, ptr noundef nonnull @__PRETTY_FUNCTION__.schedule) #9
unreachable
if.end5.i: ; preds = %enqueue.exit, %is_empty.exit
%t.0104 = phi i32 [ %add52.pre-phi, %is_empty.exit ], [ 0, %enqueue.exit ]
%queue.sroa.0.2103 = phi ptr [ %queue.sroa.0.350, %is_empty.exit ], [ %queue.sroa.0.1, %enqueue.exit ]
%queue.sroa.18.2102 = phi i32 [ %queue.sroa.18.348, %is_empty.exit ], [ %queue.sroa.18.1, %enqueue.exit ]
%queue.sroa.9.2101 = phi ptr [ %queue.sroa.9.446, %is_empty.exit ], [ %call4.i, %enqueue.exit ]
%5 = load i32, ptr %q, align 4, !tbaa !9
%cmp6.i = icmp sgt i32 %queue.sroa.18.2102, 0
br i1 %cmp6.i, label %if.end5.i.i, label %if.else8.i
if.else8.i: ; preds = %if.end5.i
call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.2, i32 noundef 70, ptr noundef nonnull @__PRETTY_FUNCTION__.schedule) #9
unreachable
if.end5.i.i: ; preds = %if.end5.i
%cmp10.i.i = icmp eq ptr %queue.sroa.0.2103, %queue.sroa.9.2101
br i1 %cmp10.i.i, label %if.then11.i.i, label %if.else19.i.i
if.then11.i.i: ; preds = %if.end5.i.i
%cmp13.i.i = icmp eq i32 %queue.sroa.18.2102, 1
br i1 %cmp13.i.i, label %dequeue.exit.i, label %if.else15.i.i
if.else15.i.i: ; preds = %if.then11.i.i
call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.2, i32 noundef 45, ptr noundef nonnull @__PRETTY_FUNCTION__.dequeue) #9
unreachable
if.else19.i.i: ; preds = %if.end5.i.i
%6 = load ptr, ptr %queue.sroa.0.2103, align 8, !tbaa !13
br label %dequeue.exit.i
dequeue.exit.i: ; preds = %if.then11.i.i, %if.else19.i.i
%queue.sroa.9.3 = phi ptr [ %queue.sroa.9.2101, %if.else19.i.i ], [ null, %if.then11.i.i ]
%storemerge.i.i = phi ptr [ %6, %if.else19.i.i ], [ null, %if.then11.i.i ]
%dec.i.i = add nsw i32 %queue.sroa.18.2102, -1
store ptr null, ptr %queue.sroa.0.2103, align 8, !tbaa !13
%time.i16 = getelementptr inbounds %struct.process, ptr %queue.sroa.0.2103, i64 0, i32 2
%7 = load i32, ptr %time.i16, align 4, !tbaa !11
%cmp11.i = icmp sgt i32 %7, %5
br i1 %cmp11.i, label %if.then12.i, label %schedule.exit
if.then12.i: ; preds = %dequeue.exit.i
%sub.i = sub nsw i32 %7, %5
store i32 %sub.i, ptr %time.i16, align 4, !tbaa !11
%cmp.i.i = icmp eq ptr %storemerge.i.i, null
br i1 %cmp.i.i, label %if.then.i.i, label %if.else11.i.i
if.then.i.i: ; preds = %if.then12.i
%cmp1.i.i = icmp eq ptr %queue.sroa.9.3, null
br i1 %cmp1.i.i, label %if.end.i33.i, label %if.else.i32.i
if.else.i32.i: ; preds = %if.then.i.i
call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.2, i32 noundef 22, ptr noundef nonnull @__PRETTY_FUNCTION__.enqueue) #9
unreachable
if.end.i33.i: ; preds = %if.then.i.i
%cmp3.i.i = icmp eq i32 %dec.i.i, 0
br i1 %cmp3.i.i, label %land.lhs.true.i21.thread, label %if.else5.i.i
if.else5.i.i: ; preds = %if.end.i33.i
call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2, i32 noundef 23, ptr noundef nonnull @__PRETTY_FUNCTION__.enqueue) #9
unreachable
if.else11.i.i: ; preds = %if.then12.i
store ptr %queue.sroa.0.2103, ptr %queue.sroa.9.3, align 8, !tbaa !13
br label %land.lhs.true.i21.thread
land.lhs.true.i21.thread: ; preds = %if.end.i33.i, %if.else11.i.i
%queue.sroa.0.3.ph = phi ptr [ %storemerge.i.i, %if.else11.i.i ], [ %queue.sroa.0.2103, %if.end.i33.i ]
store ptr null, ptr %queue.sroa.0.2103, align 8, !tbaa !13
%.pre = add nsw i32 %5, %t.0104
br label %is_empty.exit
schedule.exit: ; preds = %dequeue.exit.i
%name.i17 = getelementptr inbounds %struct.process, ptr %queue.sroa.0.2103, i64 0, i32 1
%add.i = add nsw i32 %7, %t.0104
%call16.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef nonnull %name.i17, i32 noundef %add.i)
call void @free(ptr noundef nonnull %queue.sroa.0.2103) #8
%cmp.i19 = icmp eq i32 %dec.i.i, 0
%cmp1.i20 = icmp eq ptr %storemerge.i.i, null
%cmp2.i = icmp eq ptr %queue.sroa.9.3, null
%or.cond70 = select i1 %cmp1.i20, i1 true, i1 %cmp2.i
br i1 %cmp.i19, label %if.then.i23, label %if.end4.i
if.then.i23: ; preds = %schedule.exit
br i1 %or.cond70, label %do.end, label %if.else.i25
if.else.i25: ; preds = %if.then.i23
call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.2, i32 noundef 59, ptr noundef nonnull @__PRETTY_FUNCTION__.is_empty) #9
unreachable
if.end4.i: ; preds = %schedule.exit
br i1 %or.cond70, label %if.else10.i, label %is_empty.exit
if.else10.i: ; preds = %if.end4.i
call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.2, i32 noundef 62, ptr noundef nonnull @__PRETTY_FUNCTION__.is_empty) #9
unreachable
is_empty.exit: ; preds = %if.end4.i, %land.lhs.true.i21.thread
%add52.pre-phi = phi i32 [ %add.i, %if.end4.i ], [ %.pre, %land.lhs.true.i21.thread ]
%queue.sroa.0.350 = phi ptr [ %storemerge.i.i, %if.end4.i ], [ %queue.sroa.0.3.ph, %land.lhs.true.i21.thread ]
%queue.sroa.18.348 = phi i32 [ %dec.i.i, %if.end4.i ], [ %queue.sroa.18.2102, %land.lhs.true.i21.thread ]
%queue.sroa.9.446 = phi ptr [ %queue.sroa.9.3, %if.end4.i ], [ %queue.sroa.0.2103, %land.lhs.true.i21.thread ]
%cmp1.not.i = icmp eq ptr %queue.sroa.0.350, null
br i1 %cmp1.not.i, label %if.else4.i, label %if.end5.i, !llvm.loop !16
do.end: ; preds = %if.then.i23
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #2
; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #7
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress 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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!12, !10, i64 20}
!12 = !{!"process", !6, i64 0, !7, i64 8, !10, i64 20}
!13 = !{!12, !6, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
long long n, p, m, k, l, t, i, j, k, q, a[1000000], c, d, x, y, b, g, w, e;
char s[1000000];
int war(const void* aa, const void* bb)
{
return(*(long long*)bb-*(long long*)aa);
}
/*
long long bins(long long p, long long k, long long s)
{
if(a[(p+k)/2]>=s && a[(p+k)/2-1]<s)return((p+k)/2);
if(a[(p+k)/2]<s)return(bins((p+k)/2+1,k,s));
return(bins(p,(p+k)/2-1,s));
}*/
int main()
{
scanf("%I64d", &n);
for(i=0; i<n-1; i++)
{
scanf("%I64d%I64d", &x, &y);
a[x]++;
a[y]++;
}
w=0;
for(i=1; i<=n; i++)
{
if(a[i]==2)w=1;
}
if(w==1)printf("NO\n");
else printf("YES\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25317/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25317/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%I64d\00", align 1
@n = dso_local global i64 0, align 8
@i = dso_local local_unnamed_addr global i64 0, align 8
@.str.1 = private unnamed_addr constant [11 x i8] c"%I64d%I64d\00", align 1
@x = dso_local global i64 0, align 8
@y = dso_local global i64 0, align 8
@a = dso_local local_unnamed_addr global [1000000 x i64] zeroinitializer, align 16
@w = dso_local local_unnamed_addr global i64 0, align 8
@p = dso_local local_unnamed_addr global i64 0, align 8
@m = dso_local local_unnamed_addr global i64 0, align 8
@k = dso_local local_unnamed_addr global i64 0, align 8
@l = dso_local local_unnamed_addr global i64 0, align 8
@t = dso_local local_unnamed_addr global i64 0, align 8
@j = dso_local local_unnamed_addr global i64 0, align 8
@q = dso_local local_unnamed_addr global i64 0, align 8
@c = dso_local local_unnamed_addr global i64 0, align 8
@d = dso_local local_unnamed_addr global i64 0, align 8
@b = dso_local local_unnamed_addr global i64 0, align 8
@g = dso_local local_unnamed_addr global i64 0, align 8
@e = dso_local local_unnamed_addr global i64 0, align 8
@s = dso_local local_unnamed_addr global [1000000 x i8] zeroinitializer, align 16
@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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @war(ptr nocapture noundef readonly %aa, ptr nocapture noundef readonly %bb) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %bb, align 8, !tbaa !5
%1 = load i64, ptr %aa, 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:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
store i64 0, ptr @i, align 8, !tbaa !5
%0 = load i64, ptr @n, align 8, !tbaa !5
%cmp21 = icmp sgt i64 %0, 1
br i1 %cmp21, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @x, ptr noundef nonnull @y)
%1 = load i64, ptr @x, align 8, !tbaa !5
%arrayidx = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %1
%2 = load i64, ptr %arrayidx, align 8, !tbaa !5
%inc = add nsw i64 %2, 1
store i64 %inc, ptr %arrayidx, align 8, !tbaa !5
%3 = load i64, ptr @y, align 8, !tbaa !5
%arrayidx2 = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %3
%4 = load i64, ptr %arrayidx2, align 8, !tbaa !5
%inc3 = add nsw i64 %4, 1
store i64 %inc3, ptr %arrayidx2, align 8, !tbaa !5
%5 = load i64, ptr @i, align 8, !tbaa !5
%inc4 = add nsw i64 %5, 1
store i64 %inc4, ptr @i, align 8, !tbaa !5
%6 = load i64, ptr @n, align 8, !tbaa !5
%sub = add nsw i64 %6, -1
%cmp = icmp slt i64 %inc4, %sub
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i64 [ %0, %entry ], [ %6, %for.body ]
store i64 0, ptr @w, align 8, !tbaa !5
%cmp6.not22 = icmp slt i64 %.lcssa, 1
br i1 %cmp6.not22, label %for.end12.thread, label %for.body7.preheader
for.end12.thread: ; preds = %for.end
store i64 1, ptr @i, align 8, !tbaa !5
br label %if.else
for.body7.preheader: ; preds = %for.end
%7 = add nuw i64 %.lcssa, 1
br label %for.body7.outer
for.body7.outer: ; preds = %for.inc10.thread, %for.body7.preheader
%8 = phi i1 [ true, %for.inc10.thread ], [ false, %for.body7.preheader ]
%storemerge1823.ph = phi i64 [ %inc1128, %for.inc10.thread ], [ 1, %for.body7.preheader ]
br label %for.body7
for.body7: ; preds = %for.body7.outer, %for.inc10
%storemerge1823 = phi i64 [ %inc11, %for.inc10 ], [ %storemerge1823.ph, %for.body7.outer ]
%arrayidx8 = getelementptr inbounds [1000000 x i64], ptr @a, i64 0, i64 %storemerge1823
%9 = load i64, ptr %arrayidx8, align 8, !tbaa !5
%cmp9 = icmp eq i64 %9, 2
br i1 %cmp9, label %for.inc10.thread, label %for.inc10
for.inc10: ; preds = %for.body7
%inc11 = add nuw i64 %storemerge1823, 1
%exitcond.not = icmp eq i64 %storemerge1823, %.lcssa
br i1 %exitcond.not, label %for.end12, label %for.body7, !llvm.loop !11
for.inc10.thread: ; preds = %for.body7
store i64 1, ptr @w, align 8, !tbaa !5
%inc1128 = add nuw i64 %storemerge1823, 1
%exitcond.not29 = icmp eq i64 %storemerge1823, %.lcssa
br i1 %exitcond.not29, label %for.end12.thread30, label %for.body7.outer, !llvm.loop !11
for.end12.thread30: ; preds = %for.inc10.thread
store i64 %7, ptr @i, align 8, !tbaa !5
br label %if.end17
for.end12: ; preds = %for.inc10
store i64 %7, ptr @i, align 8, !tbaa !5
br i1 %8, label %if.end17, label %if.else
if.else: ; preds = %for.end12.thread, %for.end12
br label %if.end17
if.end17: ; preds = %for.end12, %for.end12.thread30, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.4, %for.end12.thread30 ], [ @str.4, %for.end12 ]
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { nofree nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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>
#define LEN 100005
typedef struct{
char name[10];
int t;
}P;
int head,tail,n;
P Q[LEN];
P dequeue()
{
P x;
x=Q[head];
head=(head+1)%LEN; /*リングバッファで一周したら先頭に戻る*/
return x;
}
int min(int a,int b)
{
if(a<b)
{
return a;
}
else
{
return b;
}
}
void enqueue(P x)
{
Q[tail]=x;
tail=(tail+1)%LEN;
}
int main()
{
int c,elaps=0;
int i,q;
P u;
scanf("%d %d",&n,&q);
for(i=1;i<=n;i++)
{
scanf("%s",Q[i].name);
scanf("%d",&Q[i].t);
}
tail = n + 1;
head = 1;
while(head != tail)
{
u=dequeue();
c=min(q,u.t);
u.t-=c;
elaps += c;
if(u.t>0)
{
enqueue(u);
}
else
{
printf("%s %d\n",u.name,elaps);
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253212/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253212/source.c"
target datalayout = "e-m:e-p270: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.P = type { [10 x i8], i32 }
@Q = dso_local global [100005 x %struct.P] zeroinitializer, align 16
@head = dso_local local_unnamed_addr global i32 0, align 4
@tail = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local { i64, i64 } @dequeue() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.P], ptr @Q, i64 0, i64 %idxprom
%retval.sroa.0.0.copyload = load i64, ptr %arrayidx, align 16, !tbaa.struct !9
%retval.sroa.2.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 8
%retval.sroa.2.0.copyload = load i64, ptr %retval.sroa.2.0.arrayidx.sroa_idx, align 8, !tbaa.struct !11
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @head, align 4, !tbaa !5
%.fca.0.insert = insertvalue { i64, i64 } poison, i64 %retval.sroa.0.0.copyload, 0
%.fca.1.insert = insertvalue { i64, i64 } %.fca.0.insert, i64 %retval.sroa.2.0.copyload, 1
ret { i64, i64 } %.fca.1.insert
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @enqueue(i64 %x.coerce0, i64 %x.coerce1) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100005 x %struct.P], ptr @Q, i64 0, i64 %idxprom
store i64 %x.coerce0, ptr %arrayidx, align 16, !tbaa.struct !9
%x.sroa.2.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 8
store i64 %x.coerce1, ptr %x.sroa.2.0.arrayidx.sroa_idx, align 8, !tbaa.struct !11
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100005
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%q = alloca i32, align 4
%u = alloca %struct.P, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #6
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %u) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not25 = icmp slt i32 %0, 1
br i1 %cmp.not25, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100005 x %struct.P], ptr @Q, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%t = getelementptr inbounds [100005 x %struct.P], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %t)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%add = add nsw i32 %.lcssa, 1
store i32 %add, ptr @tail, align 4, !tbaa !5
store i32 1, ptr @head, align 4, !tbaa !5
%cmp5.not27 = icmp eq i32 %.lcssa, 0
br i1 %cmp5.not27, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%tmp.sroa.4.0.u.sroa_idx = getelementptr inbounds i8, ptr %u, i64 8
%t7 = getelementptr inbounds %struct.P, ptr %u, i64 0, i32 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%3 = phi i32 [ %add, %while.body.lr.ph ], [ %9, %if.end ]
%4 = phi i32 [ 1, %while.body.lr.ph ], [ %10, %if.end ]
%elaps.028 = phi i32 [ 0, %while.body.lr.ph ], [ %add10, %if.end ]
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100005 x %struct.P], ptr @Q, i64 0, i64 %idxprom.i
%retval.sroa.0.0.copyload.i = load i64, ptr %arrayidx.i, align 16, !tbaa.struct !9
%retval.sroa.2.0.arrayidx.sroa_idx.i = getelementptr inbounds i8, ptr %arrayidx.i, i64 8
%retval.sroa.2.0.copyload.i = load i64, ptr %retval.sroa.2.0.arrayidx.sroa_idx.i, align 8, !tbaa.struct !11
%add.i = add nsw i32 %4, 1
%rem.i = srem i32 %add.i, 100005
store i32 %rem.i, ptr @head, align 4, !tbaa !5
store i64 %retval.sroa.0.0.copyload.i, ptr %u, align 8, !tbaa.struct !9
store i64 %retval.sroa.2.0.copyload.i, ptr %tmp.sroa.4.0.u.sroa_idx, align 8, !tbaa.struct !11
%5 = load i32, ptr %q, align 4, !tbaa !5
%6 = lshr i64 %retval.sroa.2.0.copyload.i, 32
%7 = trunc i64 %6 to i32
%a.b.i = call i32 @llvm.smin.i32(i32 %5, i32 %7)
%sub = sub nsw i32 %7, %a.b.i
store i32 %sub, ptr %t7, align 4, !tbaa !14
%add10 = add nsw i32 %a.b.i, %elaps.028
%cmp12 = icmp sgt i32 %sub, 0
br i1 %cmp12, label %if.then, label %if.else
if.then: ; preds = %while.body
%8 = load i64, ptr %tmp.sroa.4.0.u.sroa_idx, align 8
%idxprom.i21 = sext i32 %3 to i64
%arrayidx.i22 = getelementptr inbounds [100005 x %struct.P], ptr @Q, i64 0, i64 %idxprom.i21
store i64 %retval.sroa.0.0.copyload.i, ptr %arrayidx.i22, align 16, !tbaa.struct !9
%x.sroa.2.0.arrayidx.sroa_idx.i = getelementptr inbounds i8, ptr %arrayidx.i22, i64 8
store i64 %8, ptr %x.sroa.2.0.arrayidx.sroa_idx.i, align 8, !tbaa.struct !11
%add.i23 = add nsw i32 %3, 1
%rem.i24 = srem i32 %add.i23, 100005
store i32 %rem.i24, ptr @tail, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %u, i32 noundef %add10)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre31 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%9 = phi i32 [ %.pre31, %if.else ], [ %rem.i24, %if.then ]
%10 = phi i32 [ %.pre, %if.else ], [ %rem.i, %if.then ]
%cmp5.not = icmp eq i32 %10, %9
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %if.end, %for.end
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %u) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; 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.smin.i32(i32, i32) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 0, i64 10, !10, i64 12, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = !{i64 0, i64 2, !10, i64 4, i64 4, !5}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !6, i64 12}
!15 = !{!"", !7, i64 0, !6, i64 12}
!16 = distinct !{!16, !13}
|
#include<stdio.h>
#include<string.h>
#define LEN 100000
typedef struct {
char name[100];
int t;
}P;
P Q[LEN];
int head,tail,n;
void enqueue(P x){
Q[tail]=x;
tail=(1+tail)%LEN;
}
P dequeue(){
P x=Q[head];
head=(head+1)%LEN;
return x;
}
int min(int a,int b){
if(a>b) return b;
else return a;
}
int main(){
int elaps=0,c;
int i,q;
P u;
scanf("%d%d",&n,&q);
for(i=1;i<=n;i++){
scanf("%s%d",Q[i].name,&Q[i].t);
}
head=1;
tail=n+1;
while(head!=tail){
u=dequeue();
c=min(q,u.t);
u.t-=c;
elaps+=c;
if(u.t>0)enqueue(u);
else printf("%s %d\n",u.name,elaps);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_253256/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_253256/source.c"
target datalayout = "e-m:e-p270: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.P = type { [100 x i8], i32 }
@Q = dso_local global [100000 x %struct.P] zeroinitializer, align 16
@tail = dso_local local_unnamed_addr global i32 0, align 4
@head = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [5 x i8] c"%s%d\00", align 1
@.str.2 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @enqueue(ptr nocapture noundef readonly byval(%struct.P) align 8 %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @tail, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100000 x %struct.P], ptr @Q, i64 0, i64 %idxprom
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, ptr noundef nonnull align 8 dereferenceable(104) %x, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100000
store i32 %rem, ptr @tail, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @dequeue(ptr noalias nocapture writeonly sret(%struct.P) align 4 %agg.result) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @head, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100000 x %struct.P], ptr @Q, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(104) %agg.result, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx, i64 104, i1 false), !tbaa.struct !9
%add = add nsw i32 %0, 1
%rem = srem i32 %add, 100000
store i32 %rem, ptr @head, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%b.a = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %b.a
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%q = alloca i32, align 4
%u = alloca %struct.P, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7
call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %u) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull %q)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not24 = icmp slt i32 %0, 1
br i1 %cmp.not24, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100000 x %struct.P], ptr @Q, i64 0, i64 %indvars.iv
%t = getelementptr inbounds [100000 x %struct.P], ptr @Q, i64 0, i64 %indvars.iv, i32 1
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %t)
%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.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
store i32 1, ptr @head, align 4, !tbaa !5
%add = add nsw i32 %.lcssa, 1
store i32 %add, ptr @tail, align 4, !tbaa !5
%cmp4.not26 = icmp eq i32 %.lcssa, 0
br i1 %cmp4.not26, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%t5 = getelementptr inbounds %struct.P, ptr %u, i64 0, i32 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end
%3 = phi i32 [ %add, %while.body.lr.ph ], [ %7, %if.end ]
%4 = phi i32 [ 1, %while.body.lr.ph ], [ %8, %if.end ]
%elaps.027 = phi i32 [ 0, %while.body.lr.ph ], [ %add8, %if.end ]
%idxprom.i = sext i32 %4 to i64
%arrayidx.i = getelementptr inbounds [100000 x %struct.P], ptr @Q, i64 0, i64 %idxprom.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %u, ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i, i64 104, i1 false)
%add.i = add nsw i32 %4, 1
%rem.i = srem i32 %add.i, 100000
store i32 %rem.i, ptr @head, align 4, !tbaa !5, !noalias !13
%5 = load i32, ptr %q, align 4, !tbaa !5
%6 = load i32, ptr %t5, align 4, !tbaa !16
%b.a.i = call i32 @llvm.smin.i32(i32 %5, i32 %6)
%sub = sub nsw i32 %6, %b.a.i
store i32 %sub, ptr %t5, align 4, !tbaa !16
%add8 = add nsw i32 %b.a.i, %elaps.027
%cmp10 = icmp sgt i32 %sub, 0
br i1 %cmp10, label %if.then, label %if.else
if.then: ; preds = %while.body
%idxprom.i20 = sext i32 %3 to i64
%arrayidx.i21 = getelementptr inbounds [100000 x %struct.P], ptr @Q, i64 0, i64 %idxprom.i20
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %arrayidx.i21, ptr noundef nonnull align 8 dereferenceable(104) %u, i64 104, i1 false)
%add.i22 = add nsw i32 %3, 1
%rem.i23 = srem i32 %add.i22, 100000
store i32 %rem.i23, ptr @tail, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %u, i32 noundef %add8)
%.pre = load i32, ptr @head, align 4, !tbaa !5
%.pre30 = load i32, ptr @tail, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%7 = phi i32 [ %.pre30, %if.else ], [ %rem.i23, %if.then ]
%8 = phi i32 [ %.pre, %if.else ], [ %rem.i, %if.then ]
%cmp4.not = icmp eq i32 %8, %7
br i1 %cmp4.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %if.end, %for.end
call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %u) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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) #4
; 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 0, i64 100, !10, i64 100, i64 4, !5}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14}
!14 = distinct !{!14, !15, !"dequeue: %agg.result"}
!15 = distinct !{!15, !"dequeue"}
!16 = !{!17, !6, i64 100}
!17 = !{!"", !7, i64 0, !6, i64 100}
!18 = distinct !{!18, !12}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.